is.zero {polyMatrix} | R Documentation |
Generic function to check if we can treat on object as being zero. For matrices the result is a matrix of the same size.
is.zero(x, eps = ZERO_EPS)
## S4 method for signature 'polynomial'
is.zero(x, eps = ZERO_EPS)
## S4 method for signature 'polyMatrix'
is.zero(x, eps = ZERO_EPS)
x |
An R object |
eps |
The minimal numerical value which will not be treated as zero |
Different type of objects can be treated as zero in different ways:
Numerical types can be compared by absolute value with eps
.
Other types should define its own method.
By befault eps
= {r} ZERO_EPS
TRUE if the object can be treat as zero
polynomial
: a polynomial can be treated as zero
if all its coefficients can be treated as zero
polyMatrix
: for a polynomial matrix every item is checked if it is zero polynomial
# numericals and matrices
is.zero(0) ## TRUE
is.zero(0.0001, eps=0.01) ## TRUE
is.zero(c(0, 1, 0)) ## TRUE, FALSE, TRUE
is.zero(matrix(c(1, 9, 0, 0), 2, 2))
## FALSE TRUE
## FALSE TRUE
# polynomials
is.zero(parse.polynomial("0.1 - 0.5 x")) ## FALSE
is.zero(parse.polynomial("0.0001 - 0.0005 x + 0.00002 x^2"), eps=0.01) ## TRUE