Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Scilab 6.0.2
Change language to: Français - Português - 日本語 - Русский

isreal

check if a variable is stored as a complex matrix

Syntax

```t = isreal(x)
t = isreal(x, eps)```

Arguments

x

Matrices of real or complex numbers (full or sparse storage). Matrices of polynomials or rationals, with real or complex coefficients.

eps

a positive or null real (default value = 0)

t

a boolean

Description

`isreal(x)` returns %T (true) if `x` is stored as a real variable, and %F (false) `x` is stored with an (eventually zero) imaginary part.

`isreal(x, eps)` returns %T (true) if `x` is stored as a real variable, or if the maximal absolute value of imaginary parts of its components is less or equal than `eps`.

Examples

```isreal([])        // => %T
isreal([1 2])
isreal(1+0*%i)
isreal(1+0*%i,0)

// Sparse matrix:
isreal(sparse([1-%i -3+4*%i]))

// Polynomial:
p = (1-2*%s)^2
isreal(p)

// Rational fraction:
r = [ (%i-%s)/%s^2 %s/(2-%s)]
isreal(r)```

History

 Version Description 6.0 Extension to rationals