Class PolynomialExpression<T extends Ring<T>>

java.lang.Object
org.episteme.core.mathematics.symbolic.PolynomialExpression<T>
All Implemented Interfaces:
Expression<T>

public class PolynomialExpression<T extends Ring<T>> extends Object implements Expression<T>
Represents a multivariate polynomial expression. Sum of terms, where each term is a coefficient * Monomial.
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • PolynomialExpression

      public PolynomialExpression(Map<Monomial<T>, T> terms, Ring<T> ring)
      Creates a polynomial expression.
      Parameters:
      terms - map of monomial to coefficient
      ring - the ring for coefficient arithmetic
  • Method Details

    • getRing

      public Ring<T> getRing()
      Description copied from interface: Expression
      Returns the ring this expression belongs to.
      Specified by:
      getRing in interface Expression<T extends Ring<T>>
      Returns:
      the ring
    • ofConstant

      public static <T extends Ring<T>> PolynomialExpression<T> ofConstant(T value, Ring<T> ring)
    • ofVariable

      public static <T extends Ring<T>> PolynomialExpression<T> ofVariable(Variable<T> v, Ring<T> ring)
    • add

      public Expression<T> add(Expression<T> other)
      Description copied from interface: Expression
      Adds this expression to another.
      Specified by:
      add in interface Expression<T extends Ring<T>>
      Parameters:
      other - the other expression
      Returns:
      the sum expression
    • multiply

      public Expression<T> multiply(Expression<T> other)
      Description copied from interface: Expression
      Multiplies this expression by another.
      Specified by:
      multiply in interface Expression<T extends Ring<T>>
      Parameters:
      other - the other expression
      Returns:
      the product expression
    • subtract

      public Expression<T> subtract(Expression<T> other)
      Description copied from interface: Expression
      Subtracts another expression from this.
      Specified by:
      subtract in interface Expression<T extends Ring<T>>
      Parameters:
      other - the subtrahend
      Returns:
      the difference expression
    • negate

      public PolynomialExpression<T> negate()
      Description copied from interface: Expression
      Negates this expression.
      Specified by:
      negate in interface Expression<T extends Ring<T>>
      Returns:
      the negated expression
    • divide

      public Expression<T> divide(Expression<T> other)
      Description copied from interface: Expression
      Divides this expression by another.
      Specified by:
      divide in interface Expression<T extends Ring<T>>
      Parameters:
      other - the divisor
      Returns:
      the quotient expression
    • differentiate

      public Expression<T> differentiate(Variable<T> variable)
      Description copied from interface: Expression
      Differentiates this expression with respect to the given variable.
      Specified by:
      differentiate in interface Expression<T extends Ring<T>>
      Parameters:
      variable - the variable to differentiate by
      Returns:
      the derivative expression
    • integrate

      public Expression<T> integrate(Variable<T> variable)
      Description copied from interface: Expression
      Integrates this expression with respect to the given variable.
      Specified by:
      integrate in interface Expression<T extends Ring<T>>
      Parameters:
      variable - the variable to integrate by
      Returns:
      the integral expression
    • compose

      public Expression<T> compose(Variable<T> variable, Expression<T> substitution)
      Description copied from interface: Expression
      Composes this expression by substituting a variable with another expression.
      Specified by:
      compose in interface Expression<T extends Ring<T>>
      Parameters:
      variable - the variable to substitute
      substitution - the expression to substitute with
      Returns:
      the composed expression
    • evaluate

      public T evaluate(Map<Variable<T>, T> assignments)
      Description copied from interface: Expression
      Evaluates this expression with the given variable assignments.
      Specified by:
      evaluate in interface Expression<T extends Ring<T>>
      Parameters:
      assignments - the variable assignments
      Returns:
      the evaluated value
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • simplify

      public Expression<T> simplify()
      Description copied from interface: Expression
      Simplifies this expression using algebraic rules.
      Specified by:
      simplify in interface Expression<T extends Ring<T>>
      Returns:
      the simplified expression
    • toLatex

      public String toLatex()
      Description copied from interface: Expression
      Converts this expression to LaTeX format.
      Specified by:
      toLatex in interface Expression<T extends Ring<T>>
      Returns:
      the LaTeX string