IsComplexType
Tests if the data type of X
is considered a complex type.
Syntax
-
IsComplexType(X)
-
X
is any object
-
Description
IsComplexType(X)
returns true
iff the data type of X
is considered a complex data type. These include
-
complex numbers,
-
complex vectors, and
-
complex matrices
but exclude
-
integers,
-
rational numbers,
-
real number,
-
real vectors, and
-
real 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 IsComplex
function instead. This tests for “mathematical complexness” (imaginary part non-zero) instead of “technical complexness” (complex data type).
Examples
L ≔ '(2, π, i, i^2); Q ≔ X ↦ '(IsComplexType(X), IsComplex(X));
L @ Q
(false, false) (false, false) (true, true) (true, false)