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 Details

    • add

      Expression<T> add(Expression<T> other)
      Adds this expression to another.
      Parameters:
      other - the other expression
      Returns:
      the sum expression
    • multiply

      Expression<T> multiply(Expression<T> other)
      Multiplies this expression by another.
      Parameters:
      other - the other expression
      Returns:
      the product expression
    • subtract

      Expression<T> subtract(Expression<T> other)
      Subtracts another expression from this.
      Parameters:
      other - the subtrahend
      Returns:
      the difference expression
    • negate

      Expression<T> negate()
      Negates this expression.
      Returns:
      the negated expression
    • divide

      Expression<T> divide(Expression<T> other)
      Divides this expression by another.
      Parameters:
      other - the divisor
      Returns:
      the quotient expression
    • pow

      default Expression<T> pow(int n)
      Raises this expression to an integer power.
      Parameters:
      n - the exponent
      Returns:
      the power expression
    • getRing

      Ring<T> getRing()
      Returns the ring this expression belongs to.
      Returns:
      the ring
    • differentiate

      Expression<T> differentiate(Variable<T> variable)
      Differentiates this expression with respect to the given variable.
      Parameters:
      variable - the variable to differentiate by
      Returns:
      the derivative expression
    • integrate

      Expression<T> integrate(Variable<T> variable)
      Integrates this expression with respect to the given variable.
      Parameters:
      variable - the variable to integrate by
      Returns:
      the integral expression
    • compose

      Expression<T> compose(Variable<T> variable, Expression<T> substitution)
      Composes this expression by substituting a variable with another expression.
      Parameters:
      variable - the variable to substitute
      substitution - the expression to substitute with
      Returns:
      the composed expression
    • simplify

      Expression<T> simplify()
      Simplifies this expression using algebraic rules.
      Returns:
      the simplified expression
    • toLatex

      String toLatex()
      Converts this expression to LaTeX format.
      Returns:
      the LaTeX string
    • evaluate

      T evaluate(Map<Variable<T>, T> assignments)
      Evaluates this expression with the given variable assignments.
      Parameters:
      assignments - the variable assignments
      Returns:
      the evaluated value