Description Usage Arguments Details Methods (by class) See Also Examples
Rounds objects to zero if there is too small
1 2 3 4 5 6 7 | zero.round(x, eps = ZERO_EPS)
## S4 method for signature 'polynomial'
zero.round(x, eps = ZERO_EPS)
## S4 method for signature 'polyMatrix'
zero.round(x, eps = ZERO_EPS)
|
x |
an R object |
eps |
Minimal numerical value which will not be treated as zero |
By befault eps
= {r} ZERO_EPS
polynomial
: rounding of a polynomial means rounding of each coefficient
polyMatrix
: rounding of a polynomial matrix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # numerical
zero.round(1) ## 1
zero.round(0) ## 0
zero.round(0.1, eps=0.5) ## 0
zero.round(c(1, 0, .01, 1e-10)) ## 1.00 0.00 0.01 0.00
# polynomials
zero.round(parse.polynomial("0.1 + x + 1e-7 x^2")) ## 0.1 + x
zero.round(parse.polynomial("0.1 + x + 1e-7 x^2"), eps=0.5) ## x
# polynomial matrix
zero.round(parse.polyMatrix(
"1 + 0.1 x, 10 + x + 3e-8 x^2, 1e-8",
"0.1 + x^2, .1 + 1e-8 x^4, 1e-8 x^5"
))
## [,1] [,2] [,3]
## [1,] 1 + 0.1x 10 + x 0
## [2,] 0.1 + x^2 0.1 0
zero.round(parse.polyMatrix(
"1 + 0.1 x, 10 + x + 3e-8 x^2, 1e-8",
"0.1 + x^2, .1 + 1e-8 x^4, 1e-8 x^5"
), eps=0.5)
## [,1] [,2] [,3]
## [1,] 1 10 + x 0
## [2,] x^2 0 0
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.