Description Usage Arguments Details Value Examples
Simplify a polynomial by removing unwanted coefficients, combining coefficients corresponding to duplicate exponents, and sorting exponents.
1 2 3 |
x |
a polynomial, or an object which can be coerced by |
zero.rm |
logical. Should zero valued coefficients be removed? |
na.rm |
logical. Should missing valued coefficients (including |
finite |
logical. Should non-finite valued coefficients be removed? |
dflt.exp |
logical. Should the coefficients be rearranged such that the exponents take on their default values? |
fix.dup.exp |
logical. Should coefficients corresponding to duplicate exponents be summed? |
decreasing |
logical. Should the sort order of the exponents be increasing or decreasing? |
... |
further arguments passed to |
If zero.rm is TRUE, 0 valued coefficients and their
corresponding exponents will be removed from the polynomial.
If na.rm is FALSE, NA and NaN valued coefficients
will be retained, otherwise NA valued coefficients and their
corresponding exponents will be removed from the polynomial.
If finite is TRUE, non-finite valued coefficients and their
corresponding exponents will be removed from the polynomial, i.e., finite = TRUE
includes na.rm = TRUE.
If fix.dup.exp is TRUE, coefficients corresponding to duplicated
exponents will be summed.
If dflt.exp is TRUE, the coefficients are rearranged such that the
exponents take on their default values, given by seq(0L, along.with = x).
Note that this requires the exponents to be unique (or fix.dup.exp
= TRUE).
If decreasing is FALSE, the polynomial is reordered such that the
exponents are increasing. If decreasing is TRUE, the polynomial is
reordered such that the exponents are decreasing. If decreasing is
NA, the polynomial is left as is (the default).
A polynomial object.
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 | x <- as.polynomial(
c(1, NA, Inf, 6, 4, 3, 0, 1, 9),
c(5, 7, 4, 4, 5, 8, 2, 3, 8)
)
reduce(x) # 0 valued coefficient is removed
reduce(x, zero.rm = FALSE) # 0 valued coefficient is not removed
reduce(x, na.rm = TRUE) # missing valued coefficient is removed
reduce(x, finite = TRUE) # non-finite valued coefficients are removed
## 'dflt.exp = NA' means that 'reduce' will decide whether the coefficients
## should be rearranged such that the exponents take on their default values.
## In this case, it decides 'dflt.exp = TRUE'
reduce(x, dflt.exp = NA)
reduce(x, dflt.exp = TRUE) # exponents take on their default values (forced)
## coefficients corresponding to duplicate exponents are summed
reduce(x, fix.dup.exp = TRUE)
reduce(x, decreasing = FALSE) # increasing exponents
reduce(x, decreasing = TRUE) # decreasing exponents
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.