IsRealType
Tests if the data type of X
is considered a real type.
Syntax
-
IsRealType(X)
-
X
is any object
-
Description
IsRealType(X)
returns true
iff the data type of X
is considered a real data type. These include
-
integers,
-
rational numbers,
-
real number,
-
real vectors, and
-
real matrices
but exclude
-
complex numbers,
-
complex vectors, and
-
complex matrices.
Notes
Notice that X
can be of a complex type even if its imaginary part is zero. For example, a complex matrix may just happen to contain entries that all have zero imaginary parts.
Most often, you want to use the IsReal
function instead. This tests for “mathematical realness” (imaginary part equal to zero) instead of “technical realness” (real data type).
Examples
L ≔ '(2, π, i, i^2); Q ≔ X ↦ '(IsRealType(X), IsReal(X));
L @ Q
(true, true) (true, true) (false, false) (false, true)