This library gives you a MathFunction
object, which is created
with a function string as constructor argument, such as new MathFuction("sin(x)
- tan(x) + cos(x^2.4)")
. You can also set up a parametric function by using the
MathFunction.Compound
object, such as new MathFunction.Compound("cos(x)",
"sin(x)")
. If your function was balanced (i.e. all the opening parentheses have matching closing parentheses) you can use the following API (if unbalanced, the constructor throws an
error for you to catch):
{ label: 'var that changes', start: number,
end: number, step: number, clamps: [ {label:'var that is clamped', value:number}, ... ]}
. If a
viewbox is given, of the form {minx:num, maxx:num, miny:num, maxy:num}
, the plot will
be constrained to those values.The MathFunction object understands the following operators and functions:
The MathFunction object understands variable/function substitution, using the
replace
function.
new
MathFunction(string)
.