CustomFunction constructor
CustomFunction(
- String name,
- List<
Variable> args, - Expression expression
Create a custom function with the given name, argument variables, and expression.
For example, the following is the implementation of the arithmetical left
shift operation as a custom function. It is characterised as
f(x, k): R^2 -> R
, where x
is the value to be multiplied by 2 to the
power of k
.
k = Variable('k');
fExpr = x * Power(2, k); // The left shift operation
f = CustomFunction('leftshift', [x, k], fExpr); // Creates a function R^2 -> R from fExpr
The name of the function has no functional impact, and is only used in the string representation.
Implementation
CustomFunction(super.name, super.args, this.expression);