Epilog:
Much of the discussion in the answers below revolves around the distinction between Real as a data type and real numbers as a domain or class of numbers (irrespective of the form in which they might be embodied).
This distinction between the data type and class is perhaps even clearer for the case of fractions and rational numbers. Rational numbers are those numbers that can be expressed a ratio of integers, a, b, where b is not equal to zero; that is, rational numbers are those that can be formatted as fractions. Although all fractions represent rational numbers, not all rational numbers are (formatted as) fractions. For example, the (rational) number 3 is not a fraction, even though it might be expressed as 3/1, a fraction. By this reasoning, it might be better if the head, Rational
, were replaced by Fraction
. Rationals
could then be used to represent the class of numbers.
This is more of a request for advice and input than a solution to a programming challenge, but I thought it might be useful to raise here nonetheless.
I am wondering if Mathematica and the Wolfram Language may have adopted a definition of real numbers that conflicts with the definition (or definitions) of real numbers in modern mathematics.
In mathematics, the domain of real numbers is loosely thought of as all the points on the real line (http://en.wikipedia.org/wiki/Real_number).
What real numbers are, according to the symbol, Reals
In Mathematica, the term Reals
is said to represent the domain of real numbers. [Update] And as Yves Klett and Szabolcs note, this is consistent with the mathematical definition of the domain.
The following shows that Mathematica recognizes the symbol for the golden ratio to represent a real number, in this sense.
GoldenRatio \[Element] Reals
True
What real numbers are, according to the symbol,Real
The head, Real
, however, is employed expressly to designate floating-point numbers.
The definition is: "Real is the head for real (floating point) numbers".
This definition appears to conflate the domain of real numbers with floating point numbers.
Integers and irrational numbers are not floating point numbers. So they would not, according to this view, be considered real numbers.
If the head, Real
, indicates that a number is a floating point number, not a real number, why not create the head, Float, to serve that purpose?
The designers of the language are certainly aware that integers and irrational numbers are real numbers. And they have expressly shunned the inclusion of RealQ
. After all, what would we expect RealQ[3]
to return, given that real numbers have been defined (in the definition of the head, Real
) to be floating point numbers, and also defined (in the definition of the domain, Reals
) as those numbers considered by mathematicians to be real numbers?
It seems to me that it would be advisable to eliminate the head, Real
, from the Wolfram language. The head, Float, would fit the bill much better. Then Reals coud be properly defined as including rational numbers (including Integers), and irrational numbers.
One might argue that we should simply treat the domain of real numbers in mathematics as having a different meaning from the domain of real numbers in the Wolfram language. However, the Wolfram Language has chosen to use the double-strike R to designate the domain. This is precisely the symbol used throughout mathematics for the set of real numbers.
I realize that it is rather late in the game to be rethinking fundamental objects of the language, such as real numbers, but now that regions have been formally introduced, in version 10, it seems that it will become increasingly important to be clear and consistent in the specification of number domains.