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

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. 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
Report an issue
<< imult Complex 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:
Tue Feb 14 15:02:42 CET 2017