-
Notifications
You must be signed in to change notification settings - Fork 11
mvf.md
Richard Ambler edited this page Sep 7, 2023
·
1 revision
Home | Single variable functions | Multi-variable functions | About
function-tree defines a class called MultiVariableFunction
that constructs a function-like object from a string representation of a multi-variable function.
final f = MultiVariableFunction(
fromExpression: '4 * a + 2 * b',
withVariables: ['a', 'b']
);
print(f({'a': 10, 'b': 1}));
42.0
A more succinct way to construct a MultiVariableFunction
instance is directly from a string:
final f = 'sin(x) * cos(y)'.toMultiVariableFunction(['x', 'y']);
print(f({'x': 0.5, 'y': 0.5}));
0.42073549240394825