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

Please note that the recommended version of Scilab is 6.0.2. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Elementary Functions > Complex > isreal

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

VersionDescription
6.0 Extension to rationals
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Feb 12 19:26:47 CET 2018