Learn R Programming

mosaic (version 0.3-13)

makeFun: Utilities for creating mathematical functions from expressions

Description

makeFun turns a mathematical expression (written as a formula) into the corresponding R function. It's purely a convenience that uses the same expression syntax as plotFun, D and antiD.

Usage

makeFun(sexpr = NULL, ...)

Arguments

sexpr
the mathematical expression written as a formula
...
additional arguments setting default numerical values for arguments or parameters

Value

  • a function

Examples

Run this code
f = makeFun(sin(x^2) ~ x)
g = makeFun(a*x + b ~ x,a=2,b=4)
g(x=10)
g(x=10,a=5,b=2)
h = makeFun(sin(x)*y ~ x&y)

Run the code above in your browser using DataLab