Interface Expression<T extends Ring<T>>
- All Known Implementing Classes:
ConstantExpression, DivisionExpression, FunctionExpression, IntegralExpression, PolynomialExpression, ProductExpression, SumExpression, Variable
public interface Expression<T extends Ring<T>>
Represents a symbolic mathematical expression.
Expressions support algebraic operations, differentiation, integration, composition, simplification, and evaluation.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptionadd(Expression<T> other) Adds this expression to another.compose(Variable<T> variable, Expression<T> substitution) Composes this expression by substituting a variable with another expression.differentiate(Variable<T> variable) Differentiates this expression with respect to the given variable.divide(Expression<T> other) Divides this expression by another.Evaluates this expression with the given variable assignments.getRing()Returns the ring this expression belongs to.Integrates this expression with respect to the given variable.multiply(Expression<T> other) Multiplies this expression by another.negate()Negates this expression.default Expression<T> pow(int n) Raises this expression to an integer power.simplify()Simplifies this expression using algebraic rules.subtract(Expression<T> other) Subtracts another expression from this.toLatex()Converts this expression to LaTeX format.
-
Method Details
-
add
Adds this expression to another.- Parameters:
other- the other expression- Returns:
- the sum expression
-
multiply
Multiplies this expression by another.- Parameters:
other- the other expression- Returns:
- the product expression
-
subtract
Subtracts another expression from this.- Parameters:
other- the subtrahend- Returns:
- the difference expression
-
negate
-
divide
Divides this expression by another.- Parameters:
other- the divisor- Returns:
- the quotient expression
-
pow
Raises this expression to an integer power.- Parameters:
n- the exponent- Returns:
- the power expression
-
getRing
-
differentiate
Differentiates this expression with respect to the given variable.- Parameters:
variable- the variable to differentiate by- Returns:
- the derivative expression
-
integrate
Integrates this expression with respect to the given variable.- Parameters:
variable- the variable to integrate by- Returns:
- the integral expression
-
compose
Composes this expression by substituting a variable with another expression.- Parameters:
variable- the variable to substitutesubstitution- the expression to substitute with- Returns:
- the composed expression
-
simplify
Expression<T> simplify()Simplifies this expression using algebraic rules.- Returns:
- the simplified expression
-
toLatex
-
evaluate
-