as.function.spray

0th

Percentile

Coerce a spray object to a function

Coerce a spray object to a function

Keywords
symbolmath
Usage
# S3 method for spray
as.function(x,...)
Arguments
x

spray object, interpreted as a multivariate polynomial

...

Further arguments, currently ignored

Value

Returns a function; this function returns a numeric vector.

Note

Coercion is possible even if some indices are zero or negative.

The function is not vectorized in the arity of its argument.

Aliases
  • as.function.spray
Examples
# NOT RUN {
S1 <- spray(matrix(sample(-2:2,replace=TRUE,21),ncol=3),rnorm(7),addrepeats=TRUE)
S2 <- spray(matrix(sample(-2:2,replace=TRUE,15),ncol=3),rnorm(5),addrepeats=TRUE)

f1 <- as.function(S1)
f2 <- as.function(S2)

f3 <- as.function(S1*S2)


x <- 4:6

f1(x)*f2(x)-f3(x)  # should be zero



# coercion is vectorized:

f1(matrix(1:33,ncol=3))


  
# }
Documentation reproduced from package spray, version 1.0-8, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.