as.function.qspray {qspray} | R Documentation |
Coerces a qspray
polynomial into a function.
## S3 method for class 'qspray'
as.function(x, ...)
x |
object of class |
... |
ignored |
A function having the same variables as the polynomial. It returns a string.
library(qspray)
P <- (qlone(1) + "1/2"*qlone(2))^2 + 5
f <- as.function(P)
f(2, "3/7")
f("x", "y")
# the evaluation is performed by (R)yacas and complex numbers are
# allowed; the imaginary unit is denoted by `I`
f("2 + 2*I", "1/4")