Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.1.0 - English


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
Report an issue
<< imult Complex numbers real >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jun 17 17:49:15 CEST 2024