Expression class abstract

An abstract representation of a mathematical expression.

The Expression class provides a framework for representing, evaluating, differentiating, and integrating mathematical expressions. Each specific type of expression (e.g., polynomial, symbolic, function) should extend this class and provide concrete implementations of the required methods.

Implementers
Available extensions

Constructors

Expression()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

depth() int
Calculate the depth of the expression tree.
differentiate([Variable? v]) Expression
Differentiates the expression with respect to a variable.
evaluate([dynamic arg]) → dynamic
Evaluates the expression for a given value of x.
expand() Expression
Expands the expression, if applicable, and returns a new expanded expression.
getVariables() Set<Variable>
Retrieves the base variables present in the expression, effectively decomposing composite variables into their constituent parts. For instance, for an expression containing x^2, it returns x, and for x*y, it returns both x and y.
getVariableTerms() Set<Variable>
Retrieves all variables present in the expression, including composite variables like x^2 or x*y.
integrate() Expression
Integrates the expression with respect to a variable.
isIndeterminate(dynamic x) bool
isInfinity(dynamic x) bool
isPoly([bool strict = false]) bool
Checks if the expression is a polynomial.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
simplify() Expression
Simplifies the expression, if possible, and returns a new simplified expression.
simplifyBasic() Expression
Performs basic simplification (arithmetic, combining like terms).
size() int
Compute the size of the expression based on the number of nodes in its tree.
substitute(Expression oldExpr, Expression newExpr) Expression
Replace a sub-expression or a variable with another expression.
toString() String
Returns the string representation of the expression.
override

Operators

operator %(dynamic other) Expression
Modulo operator. Creates a Modulo expression.
operator *(dynamic other) Expression
Multiply operator. Creates a Multiply expression.
operator +(dynamic other) Expression
Add operator. Creates an Add expression.
operator -(dynamic other) Expression
Subtract operator. Creates a Subtract expression.
operator /(dynamic other) Expression
Divide operator. Creates a Divide expression.
operator ==(Object other) bool
The equality operator.
inherited
operator ^(dynamic other) Expression
Power operator. Creates a Pow expression.
operator unary-() Expression
Unary minus operator. Creates a Negate expression.

Static Methods

parse(String formattedString) Expression
tryParse(String formattedString) Expression?