To be precise, a statement $f(x)=g(x)$ should always be accompanied by specifying the range of all free variables involved (in this case, presumably $x$ and only $x$ is free), e.g. "for all real $x$" or - in your example - "for all $\theta\in\mathbb R\setminus(2\mathbb Z+1)\frac\pi2$".
On the other hand, if one works with functions, then $f=g$ automatically means: $f(x)=g(x)$ for all $x$. Even if one does not care for differences on negligible sets (e.g. sets of Lebesgue measure $0$), one should write "$f(x)=g(x)\text{ a.e.}$" to mention this; one can unambiguously use strict equality if one works with appropriate equivalence classes of functions.
It is often understood that an implicit "almost everywhere" or "whenever both sides are defined" or similar should be added. Similarly, when introducing additivity of limits, one tends to memorize only
$$ \lim_{n\to\infty}(a_n+b_n)=\lim_{n\to\infty}a_n+\lim_{n\to\infty}b_n,$$
but the complete statement really involves "which is to say that if the two limits on the right exist, then so does the limit on the left and its value is the sum of the two single limits" or "if two of the limits exist then so does the third and the equality holds".
So to repeat: To be careful, domain restrictions should always be explicitly stated.
Especially, an exercise definitely should be written with so much care that the domain and any exceptions are mentioned explicitly. E.g. no exercise should ask "Show that $\frac{x^2-1}{x-1}=x+1$", but "Show that $\frac{x^2-1}{x-1}=x+1$ for $x\ne1$". However, you may encounter "Hint: Use $e^{\ln x}=x$" without specification of domain (or in complex analysis: branch) if the hint is to be applied for a suitable situation (in which case your answer must include "... because $x>0$" or the like).
Mathematics is really about relations between things. Therefore, while constructions are good and useful, you should never take them very seriously.
Construction agnosticism
Consider the real and complex numbers. Given $\mathbb R$, you can construct a ring which is isomorphic to $\mathbb C$ by taking pairs of real numbers and defining addition and multiplication in the usual way. Note here that I say that you can define a ring isomorphic to $\mathbb C$. We can ask the following question:
- Is the ring we have defined actually the ring of complex numbers $\mathbb C$ itself?
But you shouldn't ask yourself that question. (Just because you can ask a question, doesn't mean you should.) It won't do you any harm; it's just not useful to.
What really matters? That there is a ring which has all the properties that we want from the complex numbers — such a ring exists. Then we can say: let $\mathbb C$ be such a ring, and then study the maps $f: \mathbb C \to \mathbb C$.
When we say "the" complex number field, the word "the" is a red herring; we just want to talk about some ring which works that way. Similarly, we don't really care about "the" real numbers. If $\mathbb C$ is "the" complex number field, then it contains a principal ideal domain $Z$ coinciding with the abelian group generated by the multiplicative identity; a quotient field $Q$ induced by $Z$; and a subfield $F$ which is the analytic completion of $Q$. We can then call these "the" real numbers. Just as we don't care if "the" complex numbers consist of ordered pairs of objects from some ring $S$, we don't care if "the" real numbers are the ring $S$ or some set of ordered pairs $(s,0)$ for $s \in S$ and $0$ the additive identity of $S$. It just doesn't matter — we just care about the proper subfield $F \subseteq \mathbb C$ which has all of the same properties as the real numbers, so we may as well adopt the convention that this subfield is the field of real numbers.
This applies to the integers as well. The von Neumann construction of the natural numbers makes $3 = \{ \varnothing, \{\varnothing\}, \{\varnothing,\{\varnothing\}\}\} $. Does this mean that $3$ "really is" a set which e.g. has the empty set as a member? Not really, because these ideas are totally irrelevant to what we care about the number $3$. We could consider any other "construction" of the natural numbers, in which case $3$ might not be a set at all (for instance, if we consider a set theory in which the natural numbers are atoms), in which case it is not only irrelevant to consider the maps $f:3\to3$, but these would not even be defined. All we care about is that $3$ is part of a collection of objects $\mathbb N$ which forms a monoid with some specific properties. The "true identity" of $3$ is beside the point.
Mathematical "interfaces" (in place of "foundations")
If this ambiguity bothers you, you can think of it axiomatically as follows: treat each of the sets we care about — such as $\mathbb N$, $\mathbb Z$, $\mathbb Q$, $\mathbb R$, and $\mathbb C$ — as underspecified objects, where we specify all of the properties about them that we could care about, and only those properties.
von Neumann's construction of ordinals describes a certain countable well-ordered monoid: we don't define $\mathbb N$ to be that monoid, but merely say that it is isomorphic to it, leaving further details to be filled in later.
From equivalence classes of ordered pairs of elements of $\mathbb N$, you can define an ordered ring $Z$, which contains a monoid $M \cong \mathbb N$ and which is the closure of $M$ under differences. Now, $\mathbb N$ can never be a subset of this set of equivalence classes; but it can be a subset of some other set. We never pretended to characterize precisely what object $\mathbb
N$ is, so who is to say that $\mathbb N$ is not itself contained in
a ring which is isomorphic to $Z$? Nobody, that's who; without loss of generality we
may define $\mathbb Z$ to be a ring isomorphic to $Z$, and declare as
a refinement of the earlier specification that in fact $\mathbb N$ is
contained in $\mathbb Z$.
- We may similarly declare that $\mathbb Z \subseteq \mathbb Q$, where $\mathbb Q$ is isomorphic to the ring of equivalence classes of ordered pairs over $\mathbb Z$ in the usual way. We also declare that $\mathbb Q \subseteq \mathbb R$, where $\mathbb R$ is isomorphic to the field of Dedekind cuts over $\mathbb Q$, or (equivalently) to the field of equivalence classes of Cauchy sequences, or any of the typical constructions of the real numbers. The set $\mathbb R$ isn't defined to be any particular one of these constructions, because (a) any of these constructions is as good as the others, and (b) we don't really care about any of the details lying underneath any of the constructions, so long as the properties we care about hold for each.
You should think of these refinements as axioms which we add during the process of doing mathematics.
A definition is in the first place is only an axiom: one which defines a constant, such as defining ∅
by asserting ∀x:¬(x∈∅)
. These mathematical underspecifications — mathematical interfaces — are also axioms: having proven that a certain sort of monoid exists satisfying the Peano axioms, we assert that $\mathbb N$ is such a monoid, saying nothing more until it suits us to; and similarly declaring that $\mathbb C$ is a sort of number field of a kind which we've proven exists, and which happens to contain the field $\mathbb R$ which we mentioned previously without quite defining it completely.
Fundamentally, this approach to mathematics is not really all that different from what we usually do: it merely substitutes complete descriptions (what Bertrand Russell would call simply "a description") for objects, with partial descriptions. But pragmatically, in the real world as in mathematics, partial descriptions tend to be all that we care about (and in the real world, they are all that we ever have access to). Embracing this allows you to focus on what really matters.
If you are a mathematical "realist", in which the real numbers has an identity separate from our descriptions of it and has some fixed location in the mathematical firmament, this sort of wishy-washiness as to the "exact identity" of these objects may bother you. After all, if you imagine the possible identities of the objects $\mathbb N$, $\mathbb Z$, $\mathbb R$, etc. as you subsume them into more and more complicated objects, it would seem that the set of objects with which a set such as $\mathbb N$ could be identified recedes to infinity as our mathematical framework grows more elaborate. To this I can only say, "so much the worse for realism". If you want the freedom to construct objects and only concern yourself with the relationships that matter, in the end it is better to abandon this preoccupation with the precise identity of a mathematical object, and engage in mathematics as the creative, descriptive, and above all incomplete and ongoing endeavor that it is.
Best Answer
A basic question is, what would be the purpose of such a definition? Would it clarify anything if we came up with a definition that, say, included quaternions and not matrices or analytic functions?
Most of the usages of the term "number" are due to historical choices that have lived on. I'd be interested in seeing things that were called "numbers" initially, but are not called "numbers" now, I suppose, but any definition that applies is just a hack to justify choices at the boundaries, I think.
As mentioned, I haven't seen quaternions called "numbers." We say $1+i$ is a "complex number," but we just say $1+i+j+k$ is a "quaternion." At least in my experience.
Algebraic numbers
In "number theory," we often deal with "algebraic extensions" of the rational numbers. For example, $\mathbb Q(\sqrt{2})$ is the set of numbers of the form $a+b\sqrt 2, a,b\in\mathbb Q$. These can be seen as a subset of $\mathbb R$, but they actually exist more abstractly - for example, algebraically, we don't know whether $\sqrt{2}<0$ or $\sqrt{2}>0$ - the number exists as an algebraic object entirely - an object which, when squared, equals $2$.
The same thing happens with $\mathbb Q(\sqrt{-1})$. It would be strange to call $\sqrt{2}$ a "number" and not call $\sqrt{-1}$ a "number" in this context. Mathematicians call the two fields "algebraic number fields."
For example, $\mathbb Q(\sqrt[3]{2})$ can be seen as isomorphic to a subset of $\mathbb R$, but it is also isomorphic to a (different) subset of $\mathbb C$.
Complex Numbers
There are also ways to see, inside the 'real numbers,' that the complex numbers sort of have to exist. My favorite way: If you look at the radius of convergence of the Taylor series of $f(x)=\frac{1}{x^2-x}$ at $x=a$, you get the radius of convergence is $\min(|a|,|a-1|)$. That is, the zeros of the denominator "block" the Taylor series. If you look at the Taylor series of $g(x)=\frac{1}{1+x^2}$ at a real number $x=a$, you get that the radius of convergence is $\sqrt{1+a^2}$. There is something (a zero of $1+x^2$?) "blocking" the Taylor series of $g(x)$ that looks like it is exactly a distance $1$ from $0$ in a direction perpendicular to the real line.
Complex numbers also are necessary for breaking down real matrices into component parts. Well, not "necessary," but the representation of matrices in, say, Jordan canonical form, becomes quite a bit more complicated without complex numbers. So complex numbers, oddly, make matrices seem more regular (or, if you prefer, hide the complexity.)
Also, complex numbers are really necessary for understanding quantum theory in physics. Everything you think you intuit about the universe, in terms of "measurements" being real numbers, starts to fall apart at the quantum level. The universe is far stranger than it seems.
$p$-adic Numbers
$p$-adic numbers are probably called "numbers" just because their construction is essentially the "same" as the construction of the reals, only using a different metric on $\mathbb Q$, and because they can be used to answer questions about the natural numbers.
Ordinals, Cardinals
Ordinal and cardinal numbers represent a different type of extension of the natural numbers.
I think of "ordinals" as being like the results of a race with no ties. Every runner has a result "ordinal" and any non-empty subset of the runners has a "winner."
Cardinal numbers are like a pile of beans, and determining whether two piles of beans have the same amount in them.
Ordinals are by far the most weird, because even addition of ordinals is non-commutative.
In this case, then, ordinals and cardinals are "measurements" of something.
Non-standard real number definitions
There are also lots of variations of the real numbers that we call "numbers," basically because they are a variant of the real numbers.
Conclusion: Exclusions
The hardest part of coming up with a definition for "number" is to exclude: Why don't we call matrices, or functions, or other similar things "numbers?" Things we see as primarily functions are not seen as "numbers," but it is hard to exclude them with anything rigorous. Indeed, one way to see the complex numbers is as a sub-ring of the ring of real $2\times 2$ matrices, and one reason we need complex numbers is that they are great at representing the operation of rotation - that is why we see them come in studying real matrices.
Zero-divisors are often a sign that a thing isn't a number, but we do have $g$-adic numbers with $g$ not prime, which is a ring with zero divisors. (Usually, $g$-adic numbers are not actually used anywhere, since they are just products of rings of $p$-adic numbers...)
Does anybody refer to the elements of ring $\mathbb Z/n\mathbb Z$ as "numbers?" Not in my experience.
I also haven't seen finite field elements referred to as "numbers."
So, no, the entire history of mathematics has not ascribed a single logical meaning to the word "number," so that we can distinguish what is and isn't a number. As noted in comments, "Cayley numbers" is another name for the octonions, but there are zero occurrences in Google NGram of the singular phrase, "Cayley number." So octonions are numbers, but a single octonion is not a "number?" That's just the world we live in. Number, being the most basic idea in mathematics, gets generalized in a lot of interesting ways, not all consistent, and not the same way over time.
Recall, the ancients didn't define $0$ as a "number."
(I suspect this failure was due to the confusion between cardinals and ordinals - we count finite cardinals by arbitrarily sorting and then computing the ordinal of the last element, but that fails when counting an empty collection...)