Class SymExpr

java.lang.Object
jline.util.symbolic.SymExpr

public final class SymExpr extends Object
A rational function over Q in the variables of a SymContext.

This is the scalar the SYMBOLIC arm of the pfqn_gld family computes over. It carries +, -, *, / and integer powers, and NOTHING ELSE, which is exactly the operation set that arm uses: the recursion is g = g + L*g/mu throughout, so its result is a polynomial over a monomial denominator and every intermediate is exact.

WHAT IT DELIBERATELY DOES NOT CARRY IS A COMPARISON. L > 0 and min(row) == 1 have no truth value on a symbol, which is the reason the reference's symbolic arm skips its own load-independence scan and its zero-demand guard rather than deciding them; the arms here do the same and select on N, which is always concrete. An equals IS provided, and is structural equality of the normal form Rings keeps, not a decision about the values the variables might take.

NO TRANSCENDENTAL FUNCTION IS AVAILABLE, so there is no log. The reference returns lG = log(G) as a symbolic expression and MATLAB, sympy and the C++ SymEngine backend can all represent that; a field of rational functions cannot. Ret.pfqnNcSym therefore carries the FORMAL expression as text and leaves the value to be taken after substitution. See _kb/07-cross-language-parity.md. Copyright (c) 2012-2026, Imperial College London All rights reserved.

  • Method Details

    • context

      public SymContext context()
      Returns:
      the context this expression belongs to
    • value

      public cc.redberry.rings.Rational<cc.redberry.rings.poly.multivar.MultivariatePolynomial<cc.redberry.rings.bigint.BigInteger>> value()
      Returns:
      the underlying Rings value
    • add

      public SymExpr add(SymExpr other)
      Parameters:
      other - the addend
      Returns:
      this + other
    • subtract

      public SymExpr subtract(SymExpr other)
      Parameters:
      other - the subtrahend
      Returns:
      this - other
    • multiply

      public SymExpr multiply(SymExpr other)
      Parameters:
      other - the multiplicand
      Returns:
      this * other
    • divide

      public SymExpr divide(SymExpr other)
      Parameters:
      other - the divisor, non-zero
      Returns:
      this / other
    • pow

      public SymExpr pow(int k)
      Parameters:
      k - a non-negative exponent
      Returns:
      this raised to k
    • isZero

      public boolean isZero()
      Returns:
      whether this is identically zero
    • isOne

      public boolean isOne()
      Returns:
      whether this is identically one
    • evaluate

      public double evaluate(Map<String,Double> at)
      The value at a numeric assignment of every variable.

      This is how a symbolic result is checked against the numeric routine: substitute, then compare. Every variable of the context must be given a value, since a partially substituted rational function is still symbolic and has no double to return.

      Parameters:
      at - variable name to value
      Returns:
      the value as a double
    • toString

      public String toString()
      The expression printed with the context's own variable names.
      Overrides:
      toString in class Object
      Returns:
      the printed form
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object