as.function.ratioOfQsprays {ratioOfQsprays} | R Documentation |
Ratio of multivariate polynomials as function
Description
Coerces a ratioOfQsprays
polynomial to a function.
Usage
## S3 method for class 'ratioOfQsprays'
as.function(x, N = FALSE, ...)
Arguments
x |
object of class |
N |
Boolean, whether the function must numerically approximate the result |
... |
ignored |
Value
A function having the same variables as the polynomial. If
N=FALSE
, it returns a string. If N=TRUE
, it returns a number
if the result does not contain any variable, otherwise it returns a
R expression.
Examples
library(ratioOfQsprays)
x <- qlone(1); y <- qlone(2)
roq <- (x^2/2 + y^2 + x*y - 1) / (x + 1)
f <- as.function(roq)
g <- as.function(roq, N = TRUE)
f(2, "3/7")
g(2, "3/7")
f("x", "y")
g("x", "y")
# the evaluation is performed by (R)yacas and complex numbers are
# allowed; the imaginary unit is denoted by \code{I}:
f("2 + 2*I", "Sqrt(2)")
g("2 + 2*I", "Sqrt(2)")
[Package ratioOfQsprays version 1.1.0 Index]