Class SymbolicPolynomialRing
- java.lang.Object
-
- org.matheclipse.core.polynomials.symbolicexponent.SymbolicPolynomialRing
-
- All Implemented Interfaces:
edu.jas.structure.AbelianGroupFactory<SymbolicPolynomial>,edu.jas.structure.ElemFactory<SymbolicPolynomial>,edu.jas.structure.MonoidFactory<SymbolicPolynomial>,edu.jas.structure.RingFactory<SymbolicPolynomial>,Serializable
public class SymbolicPolynomialRing extends Object implements edu.jas.structure.RingFactory<SymbolicPolynomial>
GenPolynomialRing generic polynomial factory implementing ExprRingFactory; Factory for n-variate ordered polynomials over C with JavaIExprexponents. Almost immutable object, except variable names.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description ExprRingFactorycoFacThe factory for the coefficients.ExpVectorSymbolicevzeroThe constant exponent vector 0 for this ring.protected intisFieldIndicator if this ring is a field.intnvarThe number of variables.SymbolicPolynomialONEThe constant polynomial 1 for this ring.protected booleanpartialTrue for partially reversed variables.protected static ThreadLocalRandomrandomA default random sequence generator.SymbolicTermOrdertordThe term order.protected IASTvarsThe names of the variables.SymbolicPolynomialZEROThe constant polyl 0 for this ring.
-
Constructor Summary
Constructors Constructor Description SymbolicPolynomialRing(IAST listOfVariables)The constructor creates a polynomial factory object.SymbolicPolynomialRing(IAST listOfVariables, SymbolicTermOrder t)The constructor creates a polynomial factory object.SymbolicPolynomialRing(ISymbol symbol)The constructor creates a polynomial factory object.SymbolicPolynomialRing(ISymbol symbol, SymbolicTermOrder t)The constructor creates a polynomial factory object.SymbolicPolynomialRing(ExprRingFactory cf, IAST listOfVariables)The constructor creates a polynomial factory object.SymbolicPolynomialRing(ExprRingFactory cf, IAST listOfVariables, int n, SymbolicTermOrder t, boolean numericFunction)The constructor creates a polynomial factory object.SymbolicPolynomialRing(ExprRingFactory cf, IAST listOfVariables, SymbolicTermOrder t)The constructor creates a polynomial factory object.SymbolicPolynomialRing(ExprRingFactory cf, SymbolicPolynomialRing o)The constructor creates a polynomial factory object with the the same term order, number of variables and variable names as the given polynomial factory, only the coefficient factories differ.SymbolicPolynomialRing(SymbolicPolynomialRing o, SymbolicTermOrder to)The constructor creates a polynomial factory object with the the same coefficient factory, number of variables and variable names as the given polynomial factory, only the term order differs.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BigIntegercharacteristic()Characteristic of this ring.SymbolicPolynomialRingcopy()Copy this factory.SymbolicPolynomialcopy(SymbolicPolynomial c)Copy polynomial c.SymbolicPolynomialcreate(IExpr exprPoly)Create aPolynomialfrom the givenexprPoly.SymbolicPolynomialcreate(IExpr exprPoly, boolean coefficient, boolean checkNegativeExponents, boolean coefficientListMode)Create aPolynomialfrom the givenexprPoly.static Map<IExpr,IExpr>create(IExpr exprPoly, IExpr x, Map<IExpr,IExpr> coefficientMap, IASTAppendable restList)Create the coefficients of the (univariate) polynomial incoefficientMapand append non-polynomial terms torestListstatic Map<IExpr,IExpr>createTimes(IAST ast, IExpr x, Map<IExpr,IExpr> coefficientMap, IASTAppendable restList)booleanequals(Object other)Comparison with any other object.SymbolicPolynomialRingextend(IAST vn)Extend variables.SymbolicPolynomialfromInteger(long a)Get a (constant) GenPolynomial<C> element from a long value.SymbolicPolynomialfromInteger(BigInteger a)Get a (constant) GenPolynomial<C> element from a BigInteger value.List<SymbolicPolynomial>generators()Get a list of the generating elements.List<SymbolicPolynomial>generators(int modv)Get a list of the generating elements excluding the module variables.org.matheclipse.core.polynomials.symbolicexponent.SymbolicPolynomialRing.SymbolicPolynomialComparatorgetComparator()Get PolynomialComparator.org.matheclipse.core.polynomials.symbolicexponent.SymbolicPolynomialRing.SymbolicPolynomialComparatorgetComparator(boolean rev)Get PolynomialComparator.List<SymbolicPolynomial>getGenerators()Get the generating elements excluding the generators for the coefficient ring.SymbolicPolynomialgetOne()Get the one element.SymbolicPolynomialgetONE()IExprgetONECoefficient()Get the one element from the coefficients.IASTgetVars()Get the variable names.SymbolicPolynomialgetZero()Get the zero element.SymbolicPolynomialgetZERO()IExprgetZEROCoefficient()Get the zero element from the coefficients.inthashCode()Hash code for this polynomial ring.booleanisAssociative()Query if this ring is associative.booleanisCommutative()Query if this ring is commutative.booleanisField()Query if this ring is a field.booleanisFinite()Is this structure finite or infinite.booleanisPolynomial(IExpr expression)Create aPolynomialfrom the givenexprPoly.booleanisPolynomial(IExpr expression, boolean coefficient)Create aPolynomialfrom the givenexprPoly.Iterator<SymbolicPolynomial>iterator()Get a GenPolynomial iterator.SymbolicPolynomialparse(Reader r)SymbolicPolynomialparse(String s)static String[]permuteVars(List<Integer> P, String[] vars)Permute variable names.SymbolicPolynomialrandom(int n)SymbolicPolynomialrandom(int n, Random random)IASTsetVars(IAST v)Set the variable names.StringtoScript()Get a scripting compatible string representation.StringtoScript(ExpVectorSymbolic e)Get a scripting compatible string representation of an ExpVectorLong of this ring.StringtoString()Get the String representation.SymbolicPolynomialunivariate(int i)Generate univariate polynomial in a given variable.SymbolicPolynomialunivariate(int modv, int i, IExpr e)Generate univariate polynomial in a given variable with given exponent.SymbolicPolynomialunivariate(int i, IExpr e)Generate univariate polynomial in a given variable with given exponent.List<? extends SymbolicPolynomial>univariateList()Generate list of univariate polynomials in all variables.List<? extends SymbolicPolynomial>univariateList(int modv)Generate list of univariate polynomials in all variables.List<? extends SymbolicPolynomial>univariateList(int modv, IExpr e)Generate list of univariate polynomials in all variables with given exponent.SymbolicPolynomialvalueOf(IExpr a)Get a (constant) GenPolynomial<C> element from a coefficient value.SymbolicPolynomialvalueOf(IExpr a, ExpVectorSymbolic e)Get a GenPolynomial<C> element from a coeffcient and an exponent vector.SymbolicPolynomialvalueOf(ExpVectorSymbolic e)Get a GenPolynomial<C> element from an exponent vector.StringvarsToString()Get a String representation of the variable names.
-
-
-
Field Detail
-
coFac
public final ExprRingFactory coFac
The factory for the coefficients.
-
nvar
public final int nvar
The number of variables.
-
tord
public final SymbolicTermOrder tord
The term order.
-
partial
protected boolean partial
True for partially reversed variables.
-
vars
protected IAST vars
The names of the variables. This value can be modified.
-
ZERO
public final SymbolicPolynomial ZERO
The constant polyl 0 for this ring.
-
ONE
public final SymbolicPolynomial ONE
The constant polynomial 1 for this ring.
-
evzero
public final ExpVectorSymbolic evzero
The constant exponent vector 0 for this ring.
-
random
protected static final ThreadLocalRandom random
A default random sequence generator.
-
isField
protected int isField
Indicator if this ring is a field.
-
-
Constructor Detail
-
SymbolicPolynomialRing
public SymbolicPolynomialRing(IAST listOfVariables)
The constructor creates a polynomial factory object.- Parameters:
listOfVariables- names for the variables.
-
SymbolicPolynomialRing
public SymbolicPolynomialRing(IAST listOfVariables, SymbolicTermOrder t)
The constructor creates a polynomial factory object.- Parameters:
listOfVariables- names for the variables.t- a term order.
-
SymbolicPolynomialRing
public SymbolicPolynomialRing(ISymbol symbol)
The constructor creates a polynomial factory object.- Parameters:
symbol- name of a variable.
-
SymbolicPolynomialRing
public SymbolicPolynomialRing(ISymbol symbol, SymbolicTermOrder t)
The constructor creates a polynomial factory object.- Parameters:
symbol- name of a variable.t- a term order.
-
SymbolicPolynomialRing
public SymbolicPolynomialRing(ExprRingFactory cf, IAST listOfVariables)
The constructor creates a polynomial factory object.- Parameters:
cf- factory for coefficients of type C.listOfVariables- names for the variables.
-
SymbolicPolynomialRing
public SymbolicPolynomialRing(ExprRingFactory cf, IAST listOfVariables, SymbolicTermOrder t)
The constructor creates a polynomial factory object.- Parameters:
cf- factory for coefficients of type C.listOfVariables- names for the variables.t- a term order.
-
SymbolicPolynomialRing
public SymbolicPolynomialRing(ExprRingFactory cf, IAST listOfVariables, int n, SymbolicTermOrder t, boolean numericFunction)
The constructor creates a polynomial factory object.- Parameters:
cf- factory for coefficients of type C.listOfVariables- names for the variables.n- number of variables.t- a term order.numericFunction-
-
SymbolicPolynomialRing
public SymbolicPolynomialRing(ExprRingFactory cf, SymbolicPolynomialRing o)
The constructor creates a polynomial factory object with the the same term order, number of variables and variable names as the given polynomial factory, only the coefficient factories differ.- Parameters:
cf- factory for coefficients of type C.o- other polynomial ring.
-
SymbolicPolynomialRing
public SymbolicPolynomialRing(SymbolicPolynomialRing o, SymbolicTermOrder to)
The constructor creates a polynomial factory object with the the same coefficient factory, number of variables and variable names as the given polynomial factory, only the term order differs.- Parameters:
to- term order.o- other polynomial ring.
-
-
Method Detail
-
copy
public SymbolicPolynomialRing copy()
Copy this factory.- Returns:
- a clone of this.
-
create
public SymbolicPolynomial create(IExpr exprPoly) throws ArithmeticException, ClassCastException
Create aPolynomialfrom the givenexprPoly.- Parameters:
exprPoly- the polynomial expression- Returns:
- Throws:
ArithmeticExceptionClassCastException
-
create
public SymbolicPolynomial create(IExpr exprPoly, boolean coefficient, boolean checkNegativeExponents, boolean coefficientListMode) throws ArithmeticException, ClassCastException
Create aPolynomialfrom the givenexprPoly.- Parameters:
exprPoly- the polynomial expressioncoefficient- set totrueif called by theCoefficient()functioncheckNegativeExponents- iftruedon't allow negative exponents and throw an ArithmeticExceptioncoefficientListMode- if in coefficient list mode don't collect negativePower()exponents- Returns:
- Throws:
ArithmeticExceptionClassCastException
-
create
public static Map<IExpr,IExpr> create(IExpr exprPoly, IExpr x, Map<IExpr,IExpr> coefficientMap, IASTAppendable restList) throws ArithmeticException
Create the coefficients of the (univariate) polynomial incoefficientMapand append non-polynomial terms torestList- Parameters:
exprPoly- the polynomial expressionx- the variable xcoefficientMap- the map of exponents to the associated coefficientsrestList- the terms which are non-polynomial- Returns:
- Throws:
ArithmeticException
-
createTimes
public static Map<IExpr,IExpr> createTimes(IAST ast, IExpr x, Map<IExpr,IExpr> coefficientMap, IASTAppendable restList)
-
isPolynomial
public boolean isPolynomial(IExpr expression) throws ArithmeticException, ClassCastException
Create aPolynomialfrom the givenexprPoly.- Parameters:
expression- the expression which should be checked if it's a polynomial- Returns:
trueif the given expression is a polynomial- Throws:
ArithmeticExceptionClassCastException
-
isPolynomial
public boolean isPolynomial(IExpr expression, boolean coefficient) throws ArithmeticException, ClassCastException
Create aPolynomialfrom the givenexprPoly.- Parameters:
expression- the expression which should be checked if it's a polynomialcoefficient- set totrueif called by theCoefficient()function- Returns:
trueif the given expression is a polynomial- Throws:
ArithmeticExceptionClassCastException
-
toString
public String toString()
Get the String representation.- Overrides:
toStringin classObject- See Also:
Object.toString()
-
toScript
public String toScript()
Get a scripting compatible string representation.- Specified by:
toScriptin interfaceedu.jas.structure.ElemFactory<SymbolicPolynomial>- Returns:
- script compatible representation for this Element.
- See Also:
Element.toScript()
-
toScript
public String toScript(ExpVectorSymbolic e)
Get a scripting compatible string representation of an ExpVectorLong of this ring.- Parameters:
e- exponent vector- Returns:
- script compatible representation for the ExpVectorLong.
-
equals
public boolean equals(Object other)
Comparison with any other object.- Overrides:
equalsin classObject- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Hash code for this polynomial ring.- Overrides:
hashCodein classObject- See Also:
Object.hashCode()
-
getVars
public IAST getVars()
Get the variable names.- Returns:
- vars.
-
varsToString
public String varsToString()
Get a String representation of the variable names.- Returns:
- names seperated by commas.
-
getZEROCoefficient
public IExpr getZEROCoefficient()
Get the zero element from the coefficients.- Returns:
- 0 as C.
-
getONECoefficient
public IExpr getONECoefficient()
Get the one element from the coefficients.- Returns:
- 1 as C.
-
getZero
public SymbolicPolynomial getZero()
Get the zero element.- Returns:
- 0 as GenPolynomial.
-
getOne
public SymbolicPolynomial getOne()
Get the one element.- Returns:
- 1 as GenPolynomial.
-
isCommutative
public boolean isCommutative()
Query if this ring is commutative.- Specified by:
isCommutativein interfaceedu.jas.structure.MonoidFactory<SymbolicPolynomial>- Returns:
- true if this ring is commutative, else false.
-
isAssociative
public boolean isAssociative()
Query if this ring is associative.- Specified by:
isAssociativein interfaceedu.jas.structure.MonoidFactory<SymbolicPolynomial>- Returns:
- true if this ring is associative, else false.
-
isField
public boolean isField()
Query if this ring is a field.- Specified by:
isFieldin interfaceedu.jas.structure.RingFactory<SymbolicPolynomial>- Returns:
- false.
-
characteristic
public BigInteger characteristic()
Characteristic of this ring.- Specified by:
characteristicin interfaceedu.jas.structure.RingFactory<SymbolicPolynomial>- Returns:
- characteristic of this ring.
-
valueOf
public SymbolicPolynomial valueOf(IExpr a)
Get a (constant) GenPolynomial<C> element from a coefficient value.- Parameters:
a- coefficient.- Returns:
- a GenPolynomial<C>.
-
valueOf
public SymbolicPolynomial valueOf(ExpVectorSymbolic e)
Get a GenPolynomial<C> element from an exponent vector.- Parameters:
e- exponent vector.- Returns:
- a GenPolynomial<C>.
-
valueOf
public SymbolicPolynomial valueOf(IExpr a, ExpVectorSymbolic e)
Get a GenPolynomial<C> element from a coeffcient and an exponent vector.- Parameters:
a- coefficient.e- exponent vector.- Returns:
- a GenPolynomial<C>.
-
fromInteger
public SymbolicPolynomial fromInteger(long a)
Get a (constant) GenPolynomial<C> element from a long value.- Specified by:
fromIntegerin interfaceedu.jas.structure.ElemFactory<SymbolicPolynomial>- Parameters:
a- long.- Returns:
- a GenPolynomial<C>.
-
fromInteger
public SymbolicPolynomial fromInteger(BigInteger a)
Get a (constant) GenPolynomial<C> element from a BigInteger value.- Specified by:
fromIntegerin interfaceedu.jas.structure.ElemFactory<SymbolicPolynomial>- Parameters:
a- BigInteger.- Returns:
- a GenPolynomial<C>.
-
copy
public SymbolicPolynomial copy(SymbolicPolynomial c)
Copy polynomial c.- Specified by:
copyin interfaceedu.jas.structure.ElemFactory<SymbolicPolynomial>- Parameters:
c-- Returns:
- a copy of c.
-
univariate
public SymbolicPolynomial univariate(int i)
Generate univariate polynomial in a given variable.- Parameters:
i- the index of the variable.- Returns:
- X_i as univariate polynomial.
-
univariate
public SymbolicPolynomial univariate(int i, IExpr e)
Generate univariate polynomial in a given variable with given exponent.- Parameters:
i- the index of the variable.e- the exponent of the variable.- Returns:
- X_i^e as univariate polynomial.
-
univariate
public SymbolicPolynomial univariate(int modv, int i, IExpr e)
Generate univariate polynomial in a given variable with given exponent.- Parameters:
modv- number of module variables.i- the index of the variable.e- the exponent of the variable.- Returns:
- X_i^e as univariate polynomial.
-
getGenerators
public List<SymbolicPolynomial> getGenerators()
Get the generating elements excluding the generators for the coefficient ring.- Returns:
- a list of generating elements for this ring.
-
generators
public List<SymbolicPolynomial> generators()
Get a list of the generating elements.- Specified by:
generatorsin interfaceedu.jas.structure.ElemFactory<SymbolicPolynomial>- Returns:
- list of generators for the algebraic structure.
- See Also:
ElemFactory.generators()
-
generators
public List<SymbolicPolynomial> generators(int modv)
Get a list of the generating elements excluding the module variables.- Parameters:
modv- number of module variables- Returns:
- list of generators for the polynomial ring.
-
isFinite
public boolean isFinite()
Is this structure finite or infinite.- Specified by:
isFinitein interfaceedu.jas.structure.ElemFactory<SymbolicPolynomial>- Returns:
- true if this structure is finite, else false.
- See Also:
ElemFactory.isFinite()
-
univariateList
public List<? extends SymbolicPolynomial> univariateList()
Generate list of univariate polynomials in all variables.- Returns:
- List(X_1,...,X_n) a list of univariate polynomials.
-
univariateList
public List<? extends SymbolicPolynomial> univariateList(int modv)
Generate list of univariate polynomials in all variables.- Parameters:
modv- number of module variables.- Returns:
- List(X_1,...,X_n) a list of univariate polynomials.
-
univariateList
public List<? extends SymbolicPolynomial> univariateList(int modv, IExpr e)
Generate list of univariate polynomials in all variables with given exponent.- Parameters:
modv- number of module variables.e- the exponent of the variables.- Returns:
- List(X_1^e,...,X_n^e) a list of univariate polynomials.
-
extend
public SymbolicPolynomialRing extend(IAST vn)
Extend variables. Used e.g. in module embedding. Extend number of variables by length(vn).- Parameters:
vn- names for extended variables.- Returns:
- extended polynomial ring factory.
-
getComparator
public org.matheclipse.core.polynomials.symbolicexponent.SymbolicPolynomialRing.SymbolicPolynomialComparator getComparator()
Get PolynomialComparator.- Returns:
- polynomial comparator.
-
getComparator
public org.matheclipse.core.polynomials.symbolicexponent.SymbolicPolynomialRing.SymbolicPolynomialComparator getComparator(boolean rev)
Get PolynomialComparator.- Parameters:
rev- for reverse comparator.- Returns:
- polynomial comparator.
-
permuteVars
public static String[] permuteVars(List<Integer> P, String[] vars)
Permute variable names.- Parameters:
vars- variable names.P- permutation.- Returns:
- P(vars).
-
iterator
public Iterator<SymbolicPolynomial> iterator()
Get a GenPolynomial iterator.- Returns:
- an iterator over all polynomials.
-
getZERO
public SymbolicPolynomial getZERO()
- Specified by:
getZEROin interfaceedu.jas.structure.AbelianGroupFactory<SymbolicPolynomial>
-
random
public SymbolicPolynomial random(int n)
- Specified by:
randomin interfaceedu.jas.structure.ElemFactory<SymbolicPolynomial>
-
random
public SymbolicPolynomial random(int n, Random random)
- Specified by:
randomin interfaceedu.jas.structure.ElemFactory<SymbolicPolynomial>
-
parse
public SymbolicPolynomial parse(String s)
- Specified by:
parsein interfaceedu.jas.structure.ElemFactory<SymbolicPolynomial>
-
parse
public SymbolicPolynomial parse(Reader r)
- Specified by:
parsein interfaceedu.jas.structure.ElemFactory<SymbolicPolynomial>
-
getONE
public SymbolicPolynomial getONE()
- Specified by:
getONEin interfaceedu.jas.structure.MonoidFactory<SymbolicPolynomial>
-
-