powered by
Creates a text representation for a polynomial, in the following scenarios:
if digits is TRUE then as.character(.) is used
digits
TRUE
as.character(.)
if digits is FALSE then ./. is used
FALSE
./.
if digits is numeric then as.character(round(., digits)) is used
as.character(round(., digits))
# S3 method for polynomial toString( x, digits = TRUE, decreasing = FALSE, variable = "x", simplify = TRUE, tol = 1e-09, ... )
A character
polynomial: vector of coefficients (first is intercept)
numeric or logical: how to convert to text (default: NA)
NA
logical: order of the terms by increasing or decreasing powers (default: FALSE)
character: name of the variable used (default: "x")
"x"
logical: should the polynomial representation be simplified (default: TRUE)
numeric: tolerance (default: 1e-9). A negative value will keep zeros and ones too, but:
1e-9
If a coefficient is smaller than tol then zero terms are not kept.
tol
If a absolute value of coefficient minus one is smaller than tol then coefficient is not kept
unused parameters
p <- polynomial(c(-1,0,2)/3) toString(p, 4) toString(p, FALSE) toString(p, TRUE) toString(p, variable="z") toString(p, decreasing=TRUE) p <- polynomial(c(0,1,2)/3) toString(p) toString(p, tol=-1)
Run the code above in your browser using DataLab