Class ConstantExpression<T extends Ring<T>>

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

public class ConstantExpression<T extends Ring<T>> extends Object implements Expression<T>
Represents a constant value as a symbolic expression. *

Reference:
Mohr, P. J., et al. (2016). CODATA Recommended Values of the Fundamental Physical Constants. Reviews of Modern Physics.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • ConstantExpression

      public ConstantExpression(T value, Ring<T> ring)
      Creates a constant expression.
      Parameters:
      value - the constant value
      ring - the ring structure
  • Method Details

    • valueOf

      public static ConstantExpression<Real> valueOf(double value)
      Returns a constant expression for the given double value using Real numbers.
      Parameters:
      value - the double value
      Returns:
      the constant expression
    • ofConstant

      public static <E extends Ring<E>> ConstantExpression<E> ofConstant(E value, Ring<E> ring)
      Returns a constant expression for the given value and ring.
      Type Parameters:
      E - the type of the constant
      Parameters:
      value - the constant value
      ring - the ring structure
      Returns:
      the constant expression
    • 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 Expression<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
    • 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
    • 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
    • getValue

      public T getValue()
      Returns the constant value.
      Returns:
      the value
    • getRing

      public Ring<T> getRing()
      Returns the ring structure.
      Specified by:
      getRing in interface Expression<T extends Ring<T>>
      Returns:
      the ring
    • toString

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object