Description Usage Arguments Details Value Methods (by class) See Also Examples
Generic function to check if we can treat on object as being zero. For matrices the result is a matrix of the same size.
1 2 3 4 5 6 7 |
x |
The checked object |
eps |
Minimal numerical value which will not treat as zero |
Different type of objects can be treated as a zero in different ways:
Numerical types can be compare by absolute value with eps
.
Customer types should define an an customer method.
By befault eps:
ZERO_EPS
1 | ## [1] 1e-05
|
TRUE if the object can be treat as zero
polynomial
: a polynomail can be treated as zero
if all its coefficients can be treated as zero
polyMatrix
: for a polunomial matrix every item is checked as polynomial
1 2 3 4 5 6 7 8 9 10 11 12 | # 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.