SingleVariableFunction class

A callable class built from a string representation of a numerical function.

Two named arguments are required: fromExpression and withVariable.

Example

import "package:function_tree/function_tree.dart";

void main() {
  final expression = "a^2 + 3*a + 5",
      f = SingleVariableFunction(
        fromExpression: expression,
        withVariable: "a",
      ),
      x = 2.0,
      result = f(x);
  print("f($x) = $result");
}

Result

f(2.0) = 15.0
Inheritance

Constructors

SingleVariableFunction({required String fromExpression, String withVariable = "x"})
SingleVariableFunction.fromNode({required Node node, String withVariable = "x"})

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
variable String
getter/setter pair

Methods

call(num x) num
derivative(String variableName) SingleVariableFunction
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