as.function: Functional form for multivariate polynomials

as.function.mvpR Documentation

Functional form for multivariate polynomials

Description

Coerces a multivariate polynomial into a function

Usage

## S3 method for class 'mvp'
as.function(x, ...)

Arguments

x

Multivariate polynomial

...

Further arguments (currently ignored)

Author(s)

Robin K. S. Hankin

Examples


p <- as.mvp("1+a^2 + a*b^2 + c")
p
f <- as.function(p)
f

f(a=1)
f(a=1,b=2)
f(a=1,b=2,c=3)             # coerces to a scalar
f(a=1,b=2,c=3,lose=FALSE)  # formal mvp object

mvp documentation built on March 31, 2023, 5:43 p.m.