Title: | Polynomials in R |
---|---|
Description: | Implements univariate polynomial operations in R, including polynomial arithmetic, finding zeros, plotting, and some operations on lists of polynomials. |
Authors: | Bill Venables, with contribution by Kurt Hornik, Georgi Boshnakov and Brian Ripley. |
Maintainer: | Bill Venables <[email protected]> |
License: | GPL-2 |
Version: | 2.0-8 |
Built: | 2025-02-16 02:45:02 UTC |
Source: | https://github.com/cran/PolynomF |
Extract components of a list of polynomials
## S3 method for class 'polylist' x[i]
## S3 method for class 'polylist' x[i]
x |
A polylist object |
i |
An index vector of any crongruent form |
A polylist object of the components
Produce a text representation of a polynomial object
## S3 method for class 'polynom' as.character(x, variable = "x", decreasing = FALSE, ...)
## S3 method for class 'polynom' as.character(x, variable = "x", decreasing = FALSE, ...)
x |
The polynomial object in question |
variable |
Character string: what variable name should be used? |
decreasing |
Logical: in decreasing powers or increasing powers? |
... |
Additional arguments (ignored as yet) |
A character string representation of the polynomial
p <- poly_from_zeros(-2:3) as.character(p, "z", FALSE) as.character(p, "z", TRUE) parse(text = as.character(p, "z", TRUE))[[1]]
p <- poly_from_zeros(-2:3) as.character(p, "z", FALSE) as.character(p, "z", TRUE) parse(text = as.character(p, "z", TRUE))[[1]]
PolynomF objects ARE functions, but this coercion method creates from a polynomial object a pure function with the coefficients fully exposed in the code and which evaluates the polynomial more efficiently.
## S3 method for class 'polynom' as.function(x, variable = "x", ...) ## S3 method for class 'polylist' as.function(x, ...)
## S3 method for class 'polynom' as.function(x, variable = "x", ...) ## S3 method for class 'polylist' as.function(x, ...)
x |
A polynomial object |
variable |
Character string: what variable name should be used? |
... |
Additional arguments |
An explicit R function evaluating the polynomial
p <- poly_from_zeros(-2:3) p as.function(p)
p <- poly_from_zeros(-2:3) p as.function(p)
Concatenation of polynomial objects into lists
## S3 method for class 'polynom' c(..., recursive = FALSE) ## S3 method for class 'polylist' c(..., recursive = FALSE)
## S3 method for class 'polynom' c(..., recursive = FALSE) ## S3 method for class 'polylist' c(..., recursive = FALSE)
... |
Polynomial or polylist objects |
recursive |
Logical, should the concatenation flatten all component lists? |
A polylist object with all argumets included
Given a polynomial P(x) and a new origin o
, find
the polynomial Q(x) = P(x + o). I.e. Q(0) = P(o)
change_origin(p, o, ...) ## Default S3 method: change_origin(p, o, ...) ## S3 method for class 'polynom' change_origin(p, o, ...) ## S3 method for class 'polylist' change_origin(p, o, ...)
change_origin(p, o, ...) ## Default S3 method: change_origin(p, o, ...) ## S3 method for class 'polynom' change_origin(p, o, ...) ## S3 method for class 'polylist' change_origin(p, o, ...)
p |
A polynom or polylist object |
o |
A single numeric quantity specifying the new x-origin |
... |
currently not used |
A polynom or polylist object with x measured from the new origin
Extract polynomial coefficients
## S3 method for class 'polynom' coef(object, ...) ## S3 method for class 'polylist' coef(object, ...)
## S3 method for class 'polynom' coef(object, ...) ## S3 method for class 'polylist' coef(object, ...)
object |
A polynomial object or list thereof |
... |
Ignored |
A numeric vector of coefficients
p <- polynomial(1:3)*polynomial(5:1) coef(p)
p <- polynomial(1:3)*polynomial(5:1) coef(p)
Find the derivative or indefinite integral of a polynomial object, or list thereof.
## S3 method for class 'polynom' deriv(expr, ...) integral(expr, ...) ## Default S3 method: integral(expr, ...) ## S3 method for class 'polynom' integral(expr, limits = NULL, ...) ## S3 method for class 'polylist' deriv(expr, ...) ## S3 method for class 'polylist' integral(expr, ...)
## S3 method for class 'polynom' deriv(expr, ...) integral(expr, ...) ## Default S3 method: integral(expr, ...) ## S3 method for class 'polynom' integral(expr, limits = NULL, ...) ## S3 method for class 'polylist' deriv(expr, ...) ## S3 method for class 'polylist' integral(expr, ...)
expr |
A polynomial object, or list thereof |
... |
Unused as yet |
limits |
Real limits of a definite integral |
A coeffieient vector, or list thereof
p <- poly_from_roots(-2:3) p deriv(p) integral(p)
p <- poly_from_roots(-2:3) p deriv(p) integral(p)
Find a monic polynomial of maximal degree that divides each of a set of polynomials exactly
GCD(...) greatest_common_divisor(...) ## S3 method for class 'polynom' GCD(...) ## S3 method for class 'polylist' GCD(...)
GCD(...) greatest_common_divisor(...) ## S3 method for class 'polynom' GCD(...) ## S3 method for class 'polylist' GCD(...)
... |
A list of polynomials or polylist objects |
A polynomial giving the greatest common divisor, as defined above
p <- poly_calc(0:5) r <- poly_calc(1:6) greatest_common_divisor(p, r) solve(greatest_common_divisor(p, r)) lowest_common_multiple(p, r) solve(lowest_common_multiple(p, r))
p <- poly_calc(0:5) r <- poly_calc(1:6) greatest_common_divisor(p, r) solve(greatest_common_divisor(p, r)) lowest_common_multiple(p, r) solve(lowest_common_multiple(p, r))
These provide methods for the generic function Summary
and Math
for polynomial and polylist objects. For Summary
only sum
and prod
members are implemented
## S3 method for class 'polynom' Summary(..., na.rm = FALSE) ## S3 method for class 'polylist' Summary(..., na.rm = FALSE) ## S3 method for class 'polynom' Math(x, ...) ## S3 method for class 'polylist' Math(x, ...)
## S3 method for class 'polynom' Summary(..., na.rm = FALSE) ## S3 method for class 'polylist' Summary(..., na.rm = FALSE) ## S3 method for class 'polynom' Math(x, ...) ## S3 method for class 'polylist' Math(x, ...)
... |
Additional arguments |
na.rm |
Logical: should missing values be removed? |
x |
a |
The result of the group generic operation
lis <- as_polylist(lapply(-2:3, function(x) polynomial() - x)) prod(lis) sum(lis) solve(prod(lis)) solve(sum(lis))
lis <- as_polylist(lapply(-2:3, function(x) polynomial() - x)) prod(lis) sum(lis) solve(prod(lis)) solve(sum(lis))
For a list of polynomials, find the lowest degree monic polynomial into which each divides exactly
LCM(...) lowest_common_multiple(...) ## S3 method for class 'polynom' LCM(...) ## S3 method for class 'polylist' LCM(...)
LCM(...) lowest_common_multiple(...) ## S3 method for class 'polynom' LCM(...) ## S3 method for class 'polylist' LCM(...)
... |
A list of polynomials or polylist objects |
A polynomial giving the lowest common multiple
p <- poly_calc(0:5) r <- poly_calc(1:6) greatest_common_divisor(p, r) solve(greatest_common_divisor(p, r)) lowest_common_multiple(p, r) solve(lowest_common_multiple(p, r))
p <- poly_calc(0:5) r <- poly_calc(1:6) greatest_common_divisor(p, r) solve(greatest_common_divisor(p, r)) lowest_common_multiple(p, r) solve(lowest_common_multiple(p, r))
Compute the Lagrange Interpolation Polynomial from a given set of x- and y-values, or, alterntively, compute the interpolated values at a set of given x-values. Two algorithms are provided, namely Neville's algorithm, or a more direct version based on the usual Lagrange formula. The latter is generally faster but the former can be more accurate numerically.
neville(x, y, x0 = polynomial()) lagrange(x, y, x0 = polynomial())
neville(x, y, x0 = polynomial()) lagrange(x, y, x0 = polynomial())
x |
A numeric vector of x-values |
y |
A numeric values of y-values corresponding to the x-values |
x0 |
Either a polynomial object or a vector of x-values for which interpolated y-values are required. |
Either an interpolation polynomial object or a vector of interpolated y-values
set.seed(123) x <- 1:5 y <- rnorm(x) xout <- 0.5 + 1:4 p1 <- neville(x, y) plot(p1, xlim = range(x), ylim = extendrange(y, f = 1), panel.first = grid()) points(x, y, col = 4) points(xout, lagrange(x, y, xout), col = 2)
set.seed(123) x <- 1:5 y <- rnorm(x) xout <- 0.5 + 1:4 p1 <- neville(x, y) plot(p1, xlim = range(x), ylim = extendrange(y, f = 1), panel.first = grid()) points(x, y, col = 4) points(xout, lagrange(x, y, xout), col = 2)
Group generic function to implement arithmetic operations on polynomial objects
## S3 method for class 'polynom' Ops(e1, e2) ## S3 method for class 'polylist' Ops(e1, e2)
## S3 method for class 'polynom' Ops(e1, e2) ## S3 method for class 'polylist' Ops(e1, e2)
e1 , e2
|
A numeric vector of a polynomial object. At least one of |
A polynomial or polylist object representing the result of the operation.
x <- polynomial() (p <- (x-1)^5 - 1) (p1 <- (p + 1)/(x - 1)^2 - 1) for(i in 0:10) cat(coef((x+1)^i), "\n")
x <- polynomial() (p <- (x-1)^5 - 1) (p1 <- (p + 1)/(x - 1)^2 - 1) for(i in 0:10) cat(coef((x+1)^i), "\n")
Plot methods for polynom or polylist objects
## S3 method for class 'polylist' plot( x, xlim = 0:1, ylim = range(Px), type = "l", xlab = "x", ylab = "P(x)", ..., col = seq_along(x), lty = if (length(col) == 1) seq_along(x) else "solid", len = 1000, legend = FALSE ) ## S3 method for class 'polynom' plot( x, xlim = 0:1, ylim = range(Px), type = "l", xlab = "x", ylab = "p(x)", ..., len = 1000, limits = pu[1:2] ) ## S3 method for class 'polynom' lines(x, ..., len = 1000, limits = pu[1:2]) ## S3 method for class 'polynom' points(x, ..., len = 100, limits = pu[1:2]) ## S3 method for class 'polylist' lines( x, ..., len = 1000, limits = pu[1:2], col = seq_along(x), lty = if (length(col) == 1) seq_along(x) else "solid" ) ## S3 method for class 'polylist' points(x, ..., len = 100)
## S3 method for class 'polylist' plot( x, xlim = 0:1, ylim = range(Px), type = "l", xlab = "x", ylab = "P(x)", ..., col = seq_along(x), lty = if (length(col) == 1) seq_along(x) else "solid", len = 1000, legend = FALSE ) ## S3 method for class 'polynom' plot( x, xlim = 0:1, ylim = range(Px), type = "l", xlab = "x", ylab = "p(x)", ..., len = 1000, limits = pu[1:2] ) ## S3 method for class 'polynom' lines(x, ..., len = 1000, limits = pu[1:2]) ## S3 method for class 'polynom' points(x, ..., len = 100, limits = pu[1:2]) ## S3 method for class 'polylist' lines( x, ..., len = 1000, limits = pu[1:2], col = seq_along(x), lty = if (length(col) == 1) seq_along(x) else "solid" ) ## S3 method for class 'polylist' points(x, ..., len = 100)
x |
A polynom or polylist object to be plotted |
xlim , ylim
|
as for graphics::plot |
type |
as for graphics::plot |
xlab , ylab
|
as for graphics::plot |
... |
additional arguments passed on to methods |
col , lty
|
Colour(s) and line type(s) as for graphics::plot |
len |
positive integer defining the point or curve resolution |
legend |
logical: for "polylist" objects, should a legend be drawn alongside the main plot? |
limits |
x-limits for the polynomial, default: the entire plot. For polylist objects this may be a two column matrix. |
Nothing of interest, invisibly
p <- poly_from_zeros((-3):4) plot(p) lines(deriv(p), col = "red")
p <- poly_from_zeros((-3):4) plot(p) lines(deriv(p), col = "red")
Calculate the Lagrange interpolation polynomial, or list of polynomials, given a set of (x, y) points to fit
poly_calc(x, y, tol = sqrt(.Machine$double.eps), lab = dimnames(y)[[2]]) poly_from_zeros(...) poly_from_roots(...) poly_from_roots(...) poly_from_values(x, y, tol = sqrt(.Machine$double.eps), lab = dimnames(y)[[2]])
poly_calc(x, y, tol = sqrt(.Machine$double.eps), lab = dimnames(y)[[2]]) poly_from_zeros(...) poly_from_roots(...) poly_from_roots(...) poly_from_values(x, y, tol = sqrt(.Machine$double.eps), lab = dimnames(y)[[2]])
x |
A numeric vector of x-points at which the y-values are specified. |
y |
Either a numeric vector of the same length as |
tol |
A numeric tolerance for duplicated |
lab |
A character string vector of names for the list result when |
... |
A list of specified zeros (for subsidiary functions) |
An interpolation polynomial, or list of interpolating polynomials.
(p <- poly_calc(0:5)) ## same as poly_from_zeros(0:5) (p <- poly_calc(0:5, exp(0:5))) plot(p) curve(exp, add = TRUE, col = "red")
(p <- poly_calc(0:5)) ## same as poly_from_zeros(0:5) (p <- poly_calc(0:5, exp(0:5))) plot(p) curve(exp, add = TRUE, col = "red")
Generate a list of polynomials up to a specified degree, orthogonal with respect to the natural inner product on a discrete, finite set of x-values with equal weights.
poly_orth(x, degree = length(unique(x)) - 1, norm = TRUE)
poly_orth(x, degree = length(unique(x)) - 1, norm = TRUE)
x |
A numeric vector |
degree |
The desired maximum degree |
norm |
Logical: should polynomials be normalised to length one? |
A list of orthogonal polynomials as a polylist object
x <- c(0:3, 5) P <- poly_orth(x) plot(P, lty = "solid") Pf <- as.function(P) zap(crossprod(Pf(x)))
x <- c(0:3, 5) P <- poly_orth(x) plot(P, lty = "solid") Pf <- as.function(P) zap(crossprod(Pf(x)))
Generate sets of polynomials orthogonal with respect to a general inner product. The inner product is specified by an R function of (at least) two polynomial arguments.
poly_orth_general(inner_product, degree, norm = FALSE, ...) Hermite(p, q = p) Legendre(p, q = p) ChebyshevT(p, q = p) ChebyshevU(p, q = p) Jacobi(p, q = p, alpha = -0.5, beta = alpha) Discrete(p, q = p, x, w = function(x, ...) 1, ...)
poly_orth_general(inner_product, degree, norm = FALSE, ...) Hermite(p, q = p) Legendre(p, q = p) ChebyshevT(p, q = p) ChebyshevU(p, q = p) Jacobi(p, q = p, alpha = -0.5, beta = alpha) Discrete(p, q = p, x, w = function(x, ...) 1, ...)
inner_product |
An R function of two |
degree |
A non-negative integer specifying the maximum degree |
norm |
Logical: should the polynomials be normalized? |
... |
additional arguments passed on to the inner product function |
p , q
|
Polynomials |
alpha , beta
|
Family parameters for the Jacobi polynomials |
x |
numeric vector defining discrete orthogonal polynomials |
w |
a weight function for discrete orthogonal polynomials |
Discrete orthogonal polynomials, equally or unequally weighted,
are included as special cases. See the Discrete
inner
product function.
Computations are done using the recurrence relation with computed coefficients. If the algebraic expressions for these recurrence relation coefficients are known the computation can be made much more efficient.
A "polylist"
object containing the orthogonal set
(P0 <- poly_orth(0:5, norm = FALSE)) (P1 <- poly_orth_general(Discrete, degree = 5, x = 0:5, norm = FALSE)) sapply(P0-P1, function(x) max(abs(coef(x)))) ## visual check for equality (P0 <- poly_orth_general(Legendre, 5)) ### should be same as P0, up to roundoff (P1 <- poly_orth_general(Jacobi, 5, alpha = 0, beta = 0)) ### check sapply(P0-P1, function(x) max(abs(coef(x))))
(P0 <- poly_orth(0:5, norm = FALSE)) (P1 <- poly_orth_general(Discrete, degree = 5, x = 0:5, norm = FALSE)) sapply(P0-P1, function(x) max(abs(coef(x)))) ## visual check for equality (P0 <- poly_orth_general(Legendre, 5)) ### should be same as P0, up to roundoff (P1 <- poly_orth_general(Jacobi, 5, alpha = 0, beta = 0)) ### check sapply(P0-P1, function(x) max(abs(coef(x))))
Functions to construct polynomial objects and check class membership
polynom(a = c(0, 1), ..., eps = 0) polynomial(a = c(0, 1), ..., eps = 0) as_polynom(a) is_polynom(a) polylist(...) is_polylist(x) as_polylist(x)
polynom(a = c(0, 1), ..., eps = 0) polynomial(a = c(0, 1), ..., eps = 0) as_polynom(a) is_polynom(a) polylist(...) is_polylist(x) as_polylist(x)
a |
A |
... |
Additional arguments, currently ignored. |
eps |
A small non-negative tolerance to check for zero components. |
x |
An object of class |
A polynomial object.
(s <- polynomial()) (p <- polynomial(c(1, 5, 4, 1)/11)) oldPar <- par(mar = c(5,5,2,2)+0.1) plot(p, xlim = 0:1, ylim = 0:1, type = "n", bty="n", xlab = "s", ylab = expression({P^(n)}(s))) lines(s, limits = 0:1) P <- p for(j in 1:7) { lines(P, col = j+1, limits = 0:1) P <- p(P) } lines(P, limits = 0:1, col = 9) (r <- Re(solve((p-s)/(1-s)))) arrows(r, p(r), r, par("usr")[3], lwd = 0.5, length = 0.125, angle = 15) text(r, 0.025, paste("r =", format(r, digits = 3))) leg <- sapply(0:8, function(x) bquote({P^(.(x))}(s))) legend("topleft", legend = as.expression(leg), lty = "solid", col = 1:9, bty = "n", ncol=3) par(oldPar) rm(leg, oldPar, p, P, r, s, j)
(s <- polynomial()) (p <- polynomial(c(1, 5, 4, 1)/11)) oldPar <- par(mar = c(5,5,2,2)+0.1) plot(p, xlim = 0:1, ylim = 0:1, type = "n", bty="n", xlab = "s", ylab = expression({P^(n)}(s))) lines(s, limits = 0:1) P <- p for(j in 1:7) { lines(P, col = j+1, limits = 0:1) P <- p(P) } lines(P, limits = 0:1, col = 9) (r <- Re(solve((p-s)/(1-s)))) arrows(r, p(r), r, par("usr")[3], lwd = 0.5, length = 0.125, angle = 15) text(r, 0.025, paste("r =", format(r, digits = 3))) leg <- sapply(0:8, function(x) bquote({P^(.(x))}(s))) legend("topleft", legend = as.expression(leg), lty = "solid", col = 1:9, bty = "n", ncol=3) par(oldPar) rm(leg, oldPar, p, P, r, s, j)
Evaluate a polynomial, or polylist object components.
## S3 method for class 'polynom' predict(object, newdata, ...) ## S3 method for class 'polylist' predict(object, newdata, ...)
## S3 method for class 'polynom' predict(object, newdata, ...) ## S3 method for class 'polylist' predict(object, newdata, ...)
object |
A polynomial or polylist object |
newdata |
A target object at which to evaluate. |
... |
Not used |
If newdata
is a numeric vector, a numeric vector of
results. If newdata
is a polynomial, then the composition
is returned as a polynomial, or polylist object.
Print method for polynomial objects
## S3 method for class 'polylist' print(x, ...)
## S3 method for class 'polylist' print(x, ...)
x |
A polynomial object or list thereof |
... |
Additional arguments passed on to methods |
The original object, invisibly.
Standard method for printing polynomial objects
## S3 method for class 'polynom' print(x, variable = "x", digits = getOption("digits"), decreasing = FALSE, ...)
## S3 method for class 'polynom' print(x, variable = "x", digits = getOption("digits"), decreasing = FALSE, ...)
x |
A polynomial object |
variable |
Character string: what variable name should be given? |
digits |
Integer: how many decimal degits to use? |
decreasing |
Logical: in descending powers, or ascending? |
... |
Additional arguments |
The original object x
, invisibly
Repeat components of a polylist object
## S3 method for class 'polylist' rep(x, times, ...) ## S3 method for class 'polynom' rep(x, times, ...)
## S3 method for class 'polylist' rep(x, times, ...) ## S3 method for class 'polynom' rep(x, times, ...)
x |
A single polynom or polylist object |
times , ...
|
As for the base package function |
The resulting polylist object.
Solve polynomial equations, a(x) = b(x), or alternatively find the zeros of the polynomial a(x) - b(x)
## S3 method for class 'polynom' solve(a, b, ...) ## S3 method for class 'polylist' solve(a, b, ...)
## S3 method for class 'polynom' solve(a, b, ...) ## S3 method for class 'polylist' solve(a, b, ...)
a , b
|
Polynomials for the LHS and RHS respectively |
... |
Currently unused |
A vector of roots, usually complex
p <- poly_calc(0:5) solve(p) solve(p, 1)
p <- poly_calc(0:5) solve(p) solve(p, 1)
Provide a succinct summary of the critical points of a polynomial, or list thereof
## S3 method for class 'polynom' summary(object, ...) ## S3 method for class 'polylist' summary(object, ...) ## S3 method for class 'summary.polynom' print(x, ...)
## S3 method for class 'polynom' summary(object, ...) ## S3 method for class 'polylist' summary(object, ...) ## S3 method for class 'summary.polynom' print(x, ...)
object , x
|
A polynomial or polylist object |
... |
Currently unused |
A list giving the zeros, stationary points and points of inflexion of the polynomial(s)
p <- poly_calc(0:5) summary(p)
p <- poly_calc(0:5) summary(p)
Find the tangent line to a polynomial at one or more x-points
tangent(p, x0)
tangent(p, x0)
p |
A polynomial object |
x0 |
A numeric vector of values at which the tangent line(s) are required |
A linear polynomial giving the tangent line, or a list of such polynomials
p <- poly_from_zeros(c(0, 0:5, 4)) plot(p, xlab = expression(italic(x)), ylab = expression(italic(P(x))), main = parse(text = paste("italic(P(x) ==", as.character(p, decreasing = TRUE),")"))) x0 <- solve(deriv(p)) ## stationary points lines(tangent(p, x0), col = "dark green", lty = "solid", limits = cbind(x0-1/4, x0+1/4)) points(x0, p(x0), col = "dark green") x0 <- solve(deriv(deriv(p))) ## points of inflexion lines(tangent(p, x0), col = "red", lty = "solid", lwd = 2, limits = cbind(x0-1/4, x0+1/4)) points(x0, p(x0), col = "red") legend("bottomleft", c("Stationary points", "Points of inflexion"), pch = 19, col = c("dark green", "red"), lty = "solid", cex = 0.7, bg = "beige", box.lwd = 0.25)
p <- poly_from_zeros(c(0, 0:5, 4)) plot(p, xlab = expression(italic(x)), ylab = expression(italic(P(x))), main = parse(text = paste("italic(P(x) ==", as.character(p, decreasing = TRUE),")"))) x0 <- solve(deriv(p)) ## stationary points lines(tangent(p, x0), col = "dark green", lty = "solid", limits = cbind(x0-1/4, x0+1/4)) points(x0, p(x0), col = "dark green") x0 <- solve(deriv(deriv(p))) ## points of inflexion lines(tangent(p, x0), col = "red", lty = "solid", lwd = 2, limits = cbind(x0-1/4, x0+1/4)) points(x0, p(x0), col = "red") legend("bottomleft", c("Stationary points", "Points of inflexion"), pch = 19, col = c("dark green", "red"), lty = "solid", cex = 0.7, bg = "beige", box.lwd = 0.25)
Remove duplicated polynomials in a polylist object
## S3 method for class 'polylist' unique(x, incomparables = FALSE, ...)
## S3 method for class 'polylist' unique(x, incomparables = FALSE, ...)
x |
A polylist object |
incomparables |
Logical: as for the base function |
... |
As for the base function |
A polylist object with no duplicated components
A convenience function for setting polynomial coefficients likely
to be entirely round-off error to zero. The decision is relegated
to the function base::zapsmall
, to which this is a front-end.
zap(x, digits = getOption("digits")) ## Default S3 method: zap(x, digits = getOption("digits")) ## S3 method for class 'polynom' zap(x, digits = getOption("digits")) ## S3 method for class 'polylist' zap(x, digits = getOption("digits")) ## S3 method for class 'list' zap(x, digits = getOption("digits"))
zap(x, digits = getOption("digits")) ## Default S3 method: zap(x, digits = getOption("digits")) ## S3 method for class 'polynom' zap(x, digits = getOption("digits")) ## S3 method for class 'polylist' zap(x, digits = getOption("digits")) ## S3 method for class 'list' zap(x, digits = getOption("digits"))
x |
A polynomial or polylist object |
digits |
As for |
A polynomial or polylist object with minuscule coefficients set to zero.
(P <- poly_orth(-2:2, norm = FALSE)) zap(35*P)
(P <- poly_orth(-2:2, norm = FALSE)) zap(35*P)