Algosim documentation: IsReal

IsReal

Tests if a number, vector, or matrix is real.

Syntax

Description

If x is a number, vector, or a matrix, IsReal(x) is true iff x has zero imaginary part. Notice that even an object of data type complex number, complex vector, or complex matrix can be real in the mathematical sense of having a vanishing imaginary part.

Examples

count(compute(√(n + 5)⋅√n⋅√(n − 3), n, −10, 10), IsReal)
14
IsReal(eigenvalues(❨❨1, 2, 1❩, ❨6, −1, 0❩, ❨−2, 1, 2❩❩))
true

See also