1 | initial version |
You can read the documentation for is_real
by evaluating x.is_real?
: "Return True if this expression is known to be a real number." In particular, it is defined for expressions, which in Sage can include variables. If you evaluate parent(x)
, the answer will be Symbolic Ring
, the same as parent(pi)
.
RR
, on the other hand, is "An approximation to the field of real numbers using floating point numbers with any specified precision." For something to lie in RR
, there must be a way to convert it to an actual floating point number, so pi in RR
will return True
, whereas x in RR
will not:
sage: RR(pi)
3.14159265358979
and
sage: RR(x)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
[snip]
TypeError: Cannot evaluate symbolic expression to a numeric value.
and
sage: RR(I)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
[snip]
TypeError: unable to convert '1.00000000000000*I' to a real number