MultiVariableFunction class
A callable class built from a string representation of a multi-variable numerical function.
Two named arguments are required: fromExpression
and withVariables
.
Example
import "package:function_tree/function_tree.dart";
void main() {
final expression = "x * cos(3 * y) + z",
f = MultiVariableFunction(
fromExpression: expression,
withVariables: ["x", "y", "z"],
),
pi = "pi".interpret(),
x = 2.0,
y = pi / 4,
z = 0.5,
result = f({"x": x, "y": y, "z": z});
print("f($x, $y, $z) = $result");
}
Result
f(2.0, 0.7853981633974483, 0.5) = -0.9142135623730949
- Inheritance
-
- Object
- FunctionTree
- MultiVariableFunction
Constructors
-
MultiVariableFunction({required String fromExpression, required List<
String> withVariables})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- representation → String
-
A tree structure representation.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tex → String
-
A TeX expression representing the tree.
no setteroverride
- tree → Node
-
A callable tree representing the components of the function.
no setteroverride
Methods
-
call(
Map< String, num> variables) → num -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited