isinf
tests for infinite elements
Syntax
r = isinf(x)
Arguments
- x
matrix of real or complex numbers, or of polynomials with real or complex coefficients.
- r
matrix of booleans of the same size as
x
.
Description
x
are real or complex numbers:
r = isinf(x)
returns the matrix r
of booleans such that r(i)
is %T
if abs(x(i))
is infinite, and %F
otherwise.
x
are polynomials with real or complex coefficients:
Then after r = isinf(x)
, r(i)
is %T
if at least one of the x(i)
coefficients is infinite,
and %F
otherwise.
Examples
With real and complex numbers:
[i, inf, nan] = (%i, %inf, %nan); isinf([-1 0.01 -inf inf nan]) isinf([2+i, -10-inf, inf+i]) isinf([nan-i, nan+i*inf]) isinf(inf-nan*i)
--> isinf([-1 0.01 -inf inf nan]) ans = F F T T F --> isinf([2+i, -10-inf, inf+i]) ans = F T T --> isinf([nan-i, nan+i*inf]) ans = F T --> isinf(inf-nan*i) ans = F
%inf-%nan*%i
is computed as
%inf - %nan*complex(0,1) == %inf - complex(%nan*0, %nan*1) == %inf - complex(%nan, %nan)
== complex(%inf-%nan, -%nan) == complex(%nan, %nan)
, where Inf is eaten by Nan and no longer appears.
With polynomials :
p = poly([%nan -2 0 3],"x","coeff") q = poly([0 %inf %i],"x","coeff") r = poly([%nan %inf*%i 1],"x","coeff") isinf([p q r])
--> p = poly([%nan -2 0 3],"x","coeff") p = Nan -2x +3x³ --> q = poly([0 %inf %i],"x","coeff") q = Infx +ix² --> r = poly([%nan %inf*%i 1],"x","coeff") r = Nan -(Nan-Infi)x +x² --> isinf([p q r]) ans = F T F
See also
- percentinf — 無限大
- isnan — "Not a Number" エントリを調べる
- isreal — 変数が実数または複素数のエントリかどうかを調べるc
- isnum — 文字列が数字であるかどうかを調べる
- type — 変数の型を返す
History
バージョン | 記述 |
6.1.0 | Extension to polynomials. |
Report an issue | ||
<< int | Floating point | isnan >> |