Class SymContext
SymExpr values shares.
Rings fixes the number of indeterminates when the ring is built, so every expression that is to be added or multiplied has to come from ONE context. That is what this class owns: the names, their positions, and the two Rings objects derived from them.
THE FIELD IS THE FIELD OF RATIONAL FUNCTIONS over Q, not a polynomial ring,
because the gld recursion divides. Every divisor there is a bare mu
symbol, so a denominator is always a monomial and the normal form Rings keeps
is already the smallest one; nothing here has to call gcd for correctness.
Names are compared literally and are the strings the caller printed them
with, so a round trip through SymExpr.toString() names the same
symbols the caller supplied.
Copyright (c) 2012-2026, Imperial College London
All rights reserved.
-
Method Summary
Modifier and TypeMethodDescriptionconstant(double v) A double carried in EXACTLY, as the dyadic rational it already is.constant(long v) An exact integer constant.cc.redberry.rings.Rationals<cc.redberry.rings.poly.multivar.MultivariatePolynomial<cc.redberry.rings.bigint.BigInteger>>field()names()static SymContextA context over the given variable names, in the order given.static SymContextA context over the given variable names, in the order given.one()intpositionOf(String name) rational(long num, long den) An exact rational constant.cc.redberry.rings.poly.MultivariateRing<cc.redberry.rings.poly.multivar.MultivariatePolynomial<cc.redberry.rings.bigint.BigInteger>>ring()The variable of the given name as an expression.zero()
-
Method Details
-
of
A context over the given variable names, in the order given.- Parameters:
names- the variable names, each distinct- Returns:
- the context
-
of
A context over the given variable names, in the order given.- Parameters:
names- the variable names, each distinct- Returns:
- the context
-
var
The variable of the given name as an expression.- Parameters:
name- a name this context was built with- Returns:
- the variable
-
constant
An exact integer constant.- Parameters:
v- the value- Returns:
- the constant
-
rational
An exact rational constant.- Parameters:
num- numeratorden- denominator, non-zero- Returns:
- the constant
-
constant
A double carried in EXACTLY, as the dyadic rational it already is.No rounding happens here and none is wanted: a demand written 0.1 in the caller's source is the double nearest 0.1, and turning it into the rational 1/10 would answer for a model the caller did not state. The same rule the C++
num_traits<Rational>::from_doublefollows.- Parameters:
v- the value, finite- Returns:
- the constant
-
zero
- Returns:
- zero in this context
-
one
- Returns:
- one in this context
-
names
- Returns:
- the variable names, in ring order
-
positionOf
- Returns:
- the position of a variable in ring order, or -1
-
ring
public cc.redberry.rings.poly.MultivariateRing<cc.redberry.rings.poly.multivar.MultivariatePolynomial<cc.redberry.rings.bigint.BigInteger>> ring()- Returns:
- the underlying polynomial ring
-
field
public cc.redberry.rings.Rationals<cc.redberry.rings.poly.multivar.MultivariatePolynomial<cc.redberry.rings.bigint.BigInteger>> field()- Returns:
- the underlying field of rational functions
-