Term
- type of monomialsPoly
- type of this (self-type)public abstract class AMultivariatePolynomial<Term extends AMonomial<Term>,Poly extends AMultivariatePolynomial<Term,Poly>> extends Object implements IPolynomial<Poly>, Iterable<Term>
Variables:
The number of variables is invariant, which means that binary arithmetic operations
on polynomials with different number of variables (see nVariables
) are prohibited. Of course all exponents
of particular variable may be zero, so e.g.
MultivariatePolynomial.parse("x^2 + 2*x*y + y^3", "x", "y", "z")
will have nVariables == 3 while "z" is actually absent in the poly.
Particular string names of variables are not stored in the polynomial data structure, instead the variables are treated as consequent integer numbers (0, 1, 2,...), where 0 states for the first variable, 1 for the second etc. Information about variables is accessible by the integer index of the variable. The mapping between the variable index and its string representation should be stored separately outside this class. For example:
// x is the first variable, y is the second
String[] variables = {"x", "y"};
MultivariatePolynomial<BigInteger> poly =
MultivariatePolynomial.parse("x^2 + 2*x*y + y^3", variables);
// degree in x
int xDegree = poly.degree(0);
assert xDegree == 2;
// degree in y
int yDegree = poly.degree(1);
assert yDegree == 3;
// will use the specified mapping and print x^2 + 2*x*y + y^3
System.out.println(poly.toString(variables));
// will use the default mapping and print a^2 + 2*a*b + b^3
System.out.println(poly.toString());
Terms storage and ordering:
Terms of multivariate polynomial are stored in a sorted map DegreeVector -> Monomial
(see MonomialSet
). The order of monomials is defined by the Comparator<DegreeVector>
which possible values are
MonomialOrder.LEX
, MonomialOrder.ALEX
, MonomialOrder.GREVLEX
and MonomialOrder.GRLEX
.
All operations on the instances of this will preserve the ordering of this. The leading term of the poly is defined
with respect to this ordering.
IPolynomial
,
MultivariatePolynomialZp64
,
MultivariatePolynomial
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
AMultivariatePolynomial.PolynomialCollector<Term extends AMonomial<Term>,Poly extends AMultivariatePolynomial<Term,Poly>>
Collector which collects stream of element to a UnivariatePolynomial
|
Modifier and Type | Field and Description |
---|---|
IMonomialAlgebra<Term> |
monomialAlgebra
Monomial algebra
|
int |
nVariables
The number of variables
|
Comparator<DegreeVector> |
ordering
The ordering
|
Modifier and Type | Method and Description |
---|---|
Poly |
add(Iterable<Term> monomials)
Adds monomials to this polynomial
|
Poly |
add(Poly oth)
Adds
oth to this . |
Poly |
add(Term... monomials)
Adds monomials to this polynomial
|
Poly |
add(Term monomial)
Adds
monomial to this polynomial |
Iterator<Term> |
ascendingIterator() |
static <Term extends AMonomial<Term>,Poly extends AMultivariatePolynomial<Term,Poly>> |
asMultivariate(IUnivariatePolynomial poly,
int nVariables,
int variable,
Comparator<DegreeVector> ordering)
Converts univariate polynomial to multivariate.
|
static <Term extends AMonomial<Term>,Poly extends AMultivariatePolynomial<Term,Poly>> |
asMultivariate(UnivariatePolynomial<Poly> uPoly,
int variable)
Convert univariate polynomial over multivariate polynomials to a normal multivariate poly
|
static <Term extends AMonomial<Term>,Poly extends AMultivariatePolynomial<Term,Poly>> |
asMultivariate(UnivariatePolynomial<Poly> univariate,
int uVariable,
boolean join) |
abstract MultivariatePolynomial<Poly> |
asOverMultivariate(int... variables)
Converts this to a multivariate polynomial with coefficients being multivariate polynomials polynomials over
variables that is polynomial in R[variables][other_variables] |
MultivariatePolynomial<Poly> |
asOverMultivariateEliminate(int... variables)
Converts this to a multivariate polynomial with coefficients being multivariate polynomials polynomials over
variables that is polynomial in R[variables][other_variables] |
abstract MultivariatePolynomial<Poly> |
asOverMultivariateEliminate(int[] variables,
Comparator<DegreeVector> prdering)
Converts this to a multivariate polynomial with coefficients being multivariate polynomials polynomials over
variables that is polynomial in R[variables][other_variables] |
MultivariatePolynomial<Poly> |
asOverPoly(Poly factory)
Consider coefficients of this as constant polynomials of the same type as a given factory polynomial
|
abstract MultivariatePolynomial<? extends IUnivariatePolynomial> |
asOverUnivariate(int variable)
Converts this to a multivariate polynomial with coefficients being univariate polynomials over
variable |
abstract MultivariatePolynomial<? extends IUnivariatePolynomial> |
asOverUnivariateEliminate(int variable)
Converts this to a multivariate polynomial with coefficients being univariate polynomials over
variable ,
the resulting polynomial have (nVariable - 1) multivariate variables (specified variable is eliminated) |
abstract IUnivariatePolynomial |
asUnivariate()
Converts this to univariate polynomial or throws exception if conversion is impossible (more than one variable
have non zero exponents)
|
UnivariatePolynomial<Poly> |
asUnivariate(int variable)
Converts this polynomial to a univariate polynomial over specified variable with the multivariate coefficient
ring.
|
UnivariatePolynomial<Poly> |
asUnivariateEliminate(int variable)
Converts this polynomial to a univariate polynomial over specified variable with the multivariate coefficient
ring.
|
abstract Poly |
clone()
Deep copy of this
|
Poly |
coefficientOf(int[] variables,
int[] exponents)
Returns a coefficient before
variables^exponents as a multivariate polynomial |
Poly |
coefficientOf(int variable,
int exponent)
Returns a coefficient before
variable^exponent as a multivariate polynomial |
Collection<Term> |
collection()
Collection view of all terms
|
Poly |
composition(int variable,
Poly value)
Substitutes given polynomial instead of specified variable (that is
this(x_1, ..., value, ..., x_N) ,
where value is on the place of specified variable) |
Poly |
composition(List<Poly> values)
Substitutes given polynomials instead of variables of this (that is
this(values_1, ..., values_N) ) |
Poly |
composition(Poly... values)
Substitutes given polynomials instead of variables of this (that is
this(values_1, ..., values_N) ) |
<sPoly extends IUnivariatePolynomial<sPoly>> |
composition(Ring<sPoly> uRing,
sPoly... values)
Substitutes given polynomials instead of variables of this (that is
this(values_1, ..., values_N) ) |
<sPoly extends IUnivariatePolynomial<sPoly>> |
composition(sPoly... values)
Substitutes given polynomials instead of variables of this (that is
this(values_1, ..., values_N) ) |
Poly |
content(int variable)
Gives the content of this considered as R[variable][other_variables]
|
Poly |
contentExcept(int variable)
Gives the content of this considered as R[other_variables][variable]
|
abstract IUnivariatePolynomial |
contentUnivariate(int variable)
Gives the content of this considered as R[variable][other_variables]
|
Poly |
create(DegreeVector term)
Creates multivariate polynomial over the same ring as this with the single monomial
|
Poly |
create(Iterable<Term> terms)
Creates multivariate polynomial over the same ring as this from the list of monomials
|
Poly |
create(Term... terms)
Creates multivariate polynomial over the same ring as this from the list of monomials
|
Poly |
create(Term term)
Creates multivariate polynomial over the same ring as this with the single monomial
|
abstract Poly |
createConstantFromTerm(Term term)
Creates multivariate polynomial over the same ring as this with the single constant element taken from given
monomial
|
Poly |
createMonomial(int variable,
int degree)
Creates monomial over the same ring as this of the form
variable ^ degree |
int |
degree()
Returns the total degree of this polynomial, that is the maximal total degree among all terms
|
int |
degree(int... variables)
Gives the degree in specified variables
|
int |
degree(int variable)
Returns the degree of this polynomial with respect to specified variable
|
int |
degreeMax()
Returns the maximal degree of variables in this polynomial
|
int[] |
degrees()
Returns an array of degrees of all variables, so that is i-th element of the result is the polynomial degree with
respect to i-th variable
|
int[] |
degrees(int variable)
Returns the array of exponents in which
variable occurs in this polynomial |
protected int[] |
degreesRef()
returns reference (content must not be modified)
|
int |
degreeSum()
Returns the sum of
degrees() |
Poly[] |
derivative()
Gives the derivative vector
|
Poly |
derivative(int variable)
Gives partial derivative with respect to specified variable (new instance created)
|
abstract Poly |
derivative(int variable,
int order)
Gives partial derivative of specified
order with respect to specified variable (new instance created) |
Iterator<Term> |
descendingIterator() |
Poly |
divideDegreeVectorOrNull(DegreeVector monomial)
Divides this polynomial by a
monomial or returns null (causing loss of internal data) if some of
the elements can't be exactly divided by the monomial . |
abstract Poly |
divideOrNull(Term monomial)
Divides this polynomial by a
monomial or returns null (causing loss of internal data) if some of
the elements can't be exactly divided by the monomial . |
Poly |
dropCoefficientOf(int[] variables,
int[] exponents)
Returns a coefficient before
variables^exponents as a multivariate polynomial and drops all such terms
from this |
Poly |
dropSelectVariables(int... variables)
Makes a copy of this with all variables except specified ones replaced with the units
|
Poly |
dropVariable(int variable)
Makes a copy of this with the specified variable dropped
|
Poly |
dropVariables(int[] variables)
Makes a copy of this with the specified variable replaced with the unit
|
int |
ecart()
Returns degreeSum - lt().totalDegree
|
boolean |
equals(Object o) |
abstract Poly |
evaluateAtRandom(int variable,
org.apache.commons.math3.random.RandomGenerator rnd)
Evaluates
poly at random point |
abstract Poly |
evaluateAtRandomPreservingSkeleton(int variable,
org.apache.commons.math3.random.RandomGenerator rnd)
Evaluates
poly at random point chosen in such way that the skeleton of evaluated version is the same as
of the original poly with respect to all except variable variables |
Poly |
evaluateAtZero(int variable)
Substitutes
0 for variable (new instance created). |
Poly |
evaluateAtZero(int[] variables)
Substitutes
0 for all specified variables (new instance created). |
Term |
first() |
Set<DegreeVector> |
getSkeleton()
Returns skeleton of this poly
|
Set<DegreeVector> |
getSkeleton(int... variables)
Returns skeleton of this poly with respect to specified
variables |
Set<DegreeVector> |
getSkeletonDrop(int... variables)
Returns skeleton of this poly with respect to specified
variables |
Set<DegreeVector> |
getSkeletonExcept(int... variables)
Returns skeleton of this poly with respect to all except specified
variables |
int |
hashCode() |
Poly |
homogenize(int variable)
Homogenize poly by adding new (homogenizing) variable
|
Poly |
insertVariable(int variable)
Makes a copy of this by inserting new variable (the indexes will be shifted)
|
Poly |
insertVariable(int variable,
int count)
Makes a copy of this by inserting new variables (the indexes will be shifted)
|
boolean |
isEffectiveUnivariate()
Returns whether this poly is effectively univariate (not more than one variable is non-unit)
|
boolean |
isHomogeneous()
Returns whether all terms have the same total degree
|
boolean |
isLinearExactly()
Returns whether this polynomial is linear (i.e.
|
boolean |
isLinearOrConstant()
Returns whether this polynomial is linear (i.e.
|
boolean |
isMonomial()
Returns
true if this polynomial has only one monomial term |
boolean |
isZero()
Returns
true if this is zero |
boolean |
isZeroCC()
Returns true if constant term is zero
|
Iterator<Term> |
iterator() |
Poly |
joinNewVariable()
Returns a copy of this with
nVariables = nVariables + 1 |
Poly |
joinNewVariables(int n)
Returns a copy of this with
nVariables = nVariables + m |
Term |
last() |
Poly |
lc(int variable)
Returns the leading coefficient of this viewed as R[other_variables][variable]
|
abstract Poly |
lcAsPoly(Comparator<DegreeVector> ordering)
Returns the leading coefficient with respect to specified ordering as a constant poly
|
Term |
lt()
Returns the leading term in this polynomial according to ordering
|
Term |
lt(Comparator<DegreeVector> ordering)
Returns the leading term in this polynomial according to specified ordering
|
Poly |
ltAsPoly()
Returns the leading term in this polynomial according to ordering
|
abstract <E> MultivariatePolynomial<E> |
mapCoefficientsAsPolys(Ring<E> ring,
Function<Poly,E> mapper) |
Poly |
mapVariables(int[] mapping)
Renames old variables to new according to mapping
|
abstract Poly |
monic(Comparator<DegreeVector> ordering)
Make this poly monic considering leading term with respect to given ordering
|
abstract Poly |
monicWithLC(Comparator<DegreeVector> ordering,
Poly oth)
Sets
this to its monic part multiplied by the leading coefficient of other with respect to given
ordering |
Term |
monomialContent()
Returns the monomial content of this polynomial
|
Term |
mt()
Returns the minimal term in this polynomial according to ordering
|
int[] |
multidegree()
Returns the multidegree of this polynomial i.e.
|
abstract Poly |
multiply(Term monomial)
Multiplies
this by the monomial |
Poly |
multiplyByDegreeVector(DegreeVector dv)
Multiplies
this by the degree vector |
Poly |
multiplyByMonomial(int variable,
int exponent)
Multiplies this by variable^exponent
|
Poly |
negate()
Negates this and returns
|
int |
nUsedVariables()
Returns the number of really used variables (those which are not units)
|
abstract Poly |
primitivePart(int variable)
Gives primitive part of this considered as R[variable][other_variables]
|
Poly |
put(Term monomial)
Puts
monomial to this polynomial replacing the previous entry if was |
protected void |
release()
release caches
|
static <T extends AMonomial<T>,P extends AMultivariatePolynomial<T,P>> |
renameVariables(P poly,
int[] newVariables)
Rename variables from [0,1,...N] to [newVariables[0], newVariables[1], ..., newVariables[N]] (new instance
created)
|
static <T extends AMonomial<T>,P extends AMultivariatePolynomial<T,P>> |
renameVariables(P poly,
int[] newVariables,
Comparator<DegreeVector> newOrdering)
Rename variables from [0,1,...N] to [newVariables[0], newVariables[1], ..., newVariables[N]] (new instance
created)
|
static <T extends AMonomial<T>,P extends AMultivariatePolynomial<T,P>> |
renameVariables(T e,
int[] newVariables)
Rename variables from [0,1,...N] to [newVariables[0], newVariables[1], ..., newVariables[N]] (new instance
created)
|
boolean |
sameSkeletonExceptQ(AMultivariatePolynomial oth,
int... variables)
Tests whether
this and oth have the same skeleton with respect all except specified variables |
boolean |
sameSkeletonQ(AMultivariatePolynomial oth)
Tests whether
this and oth have the same skeleton |
boolean |
sameSkeletonQ(AMultivariatePolynomial oth,
int... variables)
Tests whether
this and oth have the same skeleton with respect to specified variables |
abstract Poly |
seriesCoefficient(int variable,
int order)
Gives (unevaluated) coefficient of Taylor series expansion for specified variable that is
derivative(poly,
variable, order) / order! , where the derivative is formal derivative and calculated with arithmetic performed
in Z ring (to overcome possible zeros in Zp). |
Poly |
set(Poly oth)
Sets the content of this to
oth |
Poly |
setAllCoefficientsToUnit()
Set all coefficients to units
|
Poly |
setLC(int variable,
Poly lc)
Set the leading coefficient of specified variable to a specified value (this is considered as
R[other_variables][variable])
|
Poly |
setNVariables(int newNVariables)
auxiliary method
|
Poly |
setOrdering(Comparator<DegreeVector> newOrdering)
Makes a copy of this with the new ordering
newOrdering |
int |
size()
Returns the number of terms in this polynomial
|
double |
sparsity()
Sparsity level: size / (product of degrees)
|
double |
sparsity2()
Sparsity level:
size / nDenseTerms where nDenseTerms is a total number of possible distinct terms with
total degree not larger than distinct total degrees presented in this. |
Poly |
subtract(Poly oth)
Subtracts
oth from this . |
Poly |
subtract(Term monomial)
Subtracts
monomial from this polynomial |
Poly |
subtract(Term cf,
Poly oth)
Subtracts
cf * oth from this polynomial |
Poly |
subtractLt()
Removes the leading term from this polynomial
|
static <T extends AMonomial<T>,P extends AMultivariatePolynomial<T,P>> |
swapVariables(P poly,
int i,
int j)
Renames variable
i to j and j to i (new instance created) |
Term[] |
toArray() |
String |
toString() |
int |
totalDegree()
Returns the total degree, that is sum of
degrees() |
Poly |
toZero()
Sets this to zero
|
int |
univariateVariable()
Returns -1 if this poly is not effectively univariate or variable in which it is univariate
|
finalize, getClass, notify, notifyAll, wait, wait, wait
add, assertSameCoefficientRingWith, canonical, ccAsPoly, coefficientRingCardinality, coefficientRingCharacteristic, coefficientRingPerfectPowerBase, coefficientRingPerfectPowerExponent, coefficientRingToString, coefficientRingToString, contentAsPoly, copy, createArray, createArray, createArray, createArray, createArray2d, createArray2d, createConstant, createOne, createZero, decrement, divideByLC, increment, isConstant, isMonic, isOne, isOverField, isOverFiniteField, isOverPerfectPower, isOverZ, isUnitCC, lcAsPoly, monic, monicExact, monicWithLC, multiply, multiply, multiply, multiply, multiplyByBigInteger, multiplyByLC, parsePoly, primitivePart, primitivePartSameSign, sameCoefficientRingWith, setCoefficientRingFrom, setCoefficientRingFromOptional, signumOfLC, square, subtract, toPositiveLC, toString
compareTo
toString
forEach, spliterator
public final int nVariables
public final Comparator<DegreeVector> ordering
public final IMonomialAlgebra<Term extends AMonomial<Term>> monomialAlgebra
public static <T extends AMonomial<T>,P extends AMultivariatePolynomial<T,P>> P swapVariables(P poly, int i, int j)
i
to j
and j
to i
(new instance created)poly
- the polynomiali
- the first variablej
- the second variablei
renamed to j
and j
renamed to i
public static <T extends AMonomial<T>,P extends AMultivariatePolynomial<T,P>> P renameVariables(P poly, int[] newVariables)
poly
- the polynomialnewVariables
- the new variablespublic static <T extends AMonomial<T>,P extends AMultivariatePolynomial<T,P>> T renameVariables(T e, int[] newVariables)
e
- the termnewVariables
- the new variablespublic static <T extends AMonomial<T>,P extends AMultivariatePolynomial<T,P>> P renameVariables(P poly, int[] newVariables, Comparator<DegreeVector> newOrdering)
poly
- the polynomialnewVariables
- the new variablesnewOrdering
- the new orderingpublic static <Term extends AMonomial<Term>,Poly extends AMultivariatePolynomial<Term,Poly>> Poly asMultivariate(IUnivariatePolynomial poly, int nVariables, int variable, Comparator<DegreeVector> ordering)
//convert (x^2 + 1) in Z[x] to multivariate polynomial (c^2 + 1) in Z[a,b,c]
multivarPoly = asMultivariate(univarPoly, 3, 2, MonomialOrder.LEX)
Term
- desired terms typePoly
- desired polynomial typepoly
- the univariate polynomialnVariables
- the total number of variables in the resultvariable
- the univariate variableordering
- the term orderpublic abstract IUnivariatePolynomial asUnivariate()
IllegalArgumentException
- if this is not effectively a univariate polynomialpublic final Poly create(Term... terms)
terms
- the monomialspublic final Poly create(Iterable<Term> terms)
terms
- the monomialspublic final Poly create(Term term)
term
- the monomialpublic abstract Poly createConstantFromTerm(Term term)
term
- the monomialpublic final Poly create(DegreeVector term)
term
- the monomialpublic final Poly createMonomial(int variable, int degree)
variable ^ degree
variable
- the variabledegree
- the monomial degreevariable ^ degree
public final Poly setOrdering(Comparator<DegreeVector> newOrdering)
newOrdering
newOrdering
- the new orderingprotected void release()
public final int size()
size
in interface IPolynomial<Poly extends AMultivariatePolynomial<Term,Poly>>
public final boolean isZero()
IPolynomial
true
if this is zeroisZero
in interface IPolynomial<Poly extends AMultivariatePolynomial<Term,Poly>>
this
is zeropublic boolean isLinearOrConstant()
IPolynomial
a * X + b
)isLinearOrConstant
in interface IPolynomial<Poly extends AMultivariatePolynomial<Term,Poly>>
public boolean isLinearExactly()
IPolynomial
a * X + b
with nonzero a
)isLinearExactly
in interface IPolynomial<Poly extends AMultivariatePolynomial<Term,Poly>>
public boolean isZeroCC()
IPolynomial
isZeroCC
in interface IPolynomial<Poly extends AMultivariatePolynomial<Term,Poly>>
public Term first()
public Term last()
public final Collection<Term> collection()
public final Term[] toArray()
public final boolean isMonomial()
IPolynomial
true
if this polynomial has only one monomial termisMonomial
in interface IPolynomial<Poly extends AMultivariatePolynomial<Term,Poly>>
this
has only one monomial termpublic final Poly toZero()
IPolynomial
toZero
in interface IPolynomial<Poly extends AMultivariatePolynomial<Term,Poly>>
public final Poly set(Poly oth)
IPolynomial
oth
set
in interface IPolynomial<Poly extends AMultivariatePolynomial<Term,Poly>>
oth
- the polynomialpublic final Poly dropVariable(int variable)
variable
- the variablepublic final Poly dropVariables(int[] variables)
variables
- the variablespublic final Poly dropSelectVariables(int... variables)
variables
- the variablespublic final Poly insertVariable(int variable)
variable
- the variablepublic final Poly insertVariable(int variable, int count)
variable
- the variablecount
- length of the insertionpublic final Poly setNVariables(int newNVariables)
public final Poly mapVariables(int[] mapping)
mapping
- mapping from old variables to new variablespublic final Poly joinNewVariable()
nVariables = nVariables + 1
insertVariable(int)
public final Poly joinNewVariables(int n)
nVariables = nVariables + m
insertVariable(int)
public final int nUsedVariables()
public int degree()
degree
in interface IPolynomial<Poly extends AMultivariatePolynomial<Term,Poly>>
public int degree(int... variables)
public int degreeMax()
public final int degree(int variable)
variable
- the variableprotected int[] degreesRef()
public final int[] degrees()
public final int[] multidegree()
public final int[] degrees(int variable)
variable
occurs in this polynomialvariable
occurs in this polynomialpublic final int totalDegree()
degrees()
public double sparsity()
public double sparsity2()
size / nDenseTerms
where nDenseTerms is a total number of possible distinct terms with
total degree not larger than distinct total degrees presented in this.public final int ecart()
public final boolean isHomogeneous()
public final Poly homogenize(int variable)
variable
- variable that will be inserted (homogenization variable)public final boolean isEffectiveUnivariate()
public final int univariateVariable()
public final Poly coefficientOf(int variable, int exponent)
variable^exponent
as a multivariate polynomialvariable
- the variableexponent
- the exponentvariable^exponent
as a multivariate polynomialpublic final Poly coefficientOf(int[] variables, int[] exponents)
variables^exponents
as a multivariate polynomialvariables
- the variablesexponents
- the exponentsvariables^exponents
as a multivariate polynomialpublic final Poly dropCoefficientOf(int[] variables, int[] exponents)
variables^exponents
as a multivariate polynomial and drops all such terms
from thisvariables
- the variablesexponents
- the exponentsvariables^exponents
as a multivariate polynomialpublic final UnivariatePolynomial<Poly> asUnivariate(int variable)
variable
- variable which will be treated as univariate variableIllegalArgumentException
- if this is not effectively a univariate polynomialpublic final UnivariatePolynomial<Poly> asUnivariateEliminate(int variable)
variable
- variable which will be treated as univariate variableIllegalArgumentException
- if this is not effectively a univariate polynomialpublic static <Term extends AMonomial<Term>,Poly extends AMultivariatePolynomial<Term,Poly>> Poly asMultivariate(UnivariatePolynomial<Poly> univariate, int uVariable, boolean join)
public abstract MultivariatePolynomial<? extends IUnivariatePolynomial> asOverUnivariate(int variable)
variable
variable
- variablevariable
public abstract MultivariatePolynomial<? extends IUnivariatePolynomial> asOverUnivariateEliminate(int variable)
variable
,
the resulting polynomial have (nVariable - 1) multivariate variables (specified variable
is eliminated)variable
- the variablevariable
, the
resulting polynomial have (nVariable - 1) multivariate variablespublic abstract MultivariatePolynomial<Poly> asOverMultivariate(int... variables)
variables
that is polynomial in R[variables][other_variables]variables
- the variables to separatevariables
that is polynomial in R[variables][other_variables]public final MultivariatePolynomial<Poly> asOverMultivariateEliminate(int... variables)
variables
that is polynomial in R[variables][other_variables]variables
- the variables to separatevariables
that is polynomial in R[variables][other_variables]public abstract MultivariatePolynomial<Poly> asOverMultivariateEliminate(int[] variables, Comparator<DegreeVector> prdering)
variables
that is polynomial in R[variables][other_variables]variables
- the variables to separateprdering
- monomial order to use for resultvariables
that is polynomial in R[variables][other_variables]public static <Term extends AMonomial<Term>,Poly extends AMultivariatePolynomial<Term,Poly>> Poly asMultivariate(UnivariatePolynomial<Poly> uPoly, int variable)
uPoly
- univariate polynomial over multivariate polynomialsvariable
- the univariate variablepublic abstract Poly primitivePart(int variable)
variable
- the variablepublic abstract IUnivariatePolynomial contentUnivariate(int variable)
variable
- the variablepublic abstract Poly monic(Comparator<DegreeVector> ordering)
public abstract Poly monicWithLC(Comparator<DegreeVector> ordering, Poly oth)
this
to its monic part multiplied by the leading coefficient of other
with respect to given
orderingpublic final Poly content(int variable)
variable
- the variablepublic final Poly contentExcept(int variable)
variable
- the variablepublic final Poly multiplyByMonomial(int variable, int exponent)
variable
- the variableexponent
- the exponentpublic final Poly lc(int variable)
variable
- the variablepublic final Poly setLC(int variable, Poly lc)
variable
- the variablelc
- the leading coefficient of this viewed as R[other_variables][variable]public final Term lt(Comparator<DegreeVector> ordering)
public final Term lt()
public final Term mt()
public abstract Poly lcAsPoly(Comparator<DegreeVector> ordering)
public final Poly ltAsPoly()
public final Term monomialContent()
public final Poly divideDegreeVectorOrNull(DegreeVector monomial)
monomial
or returns null
(causing loss of internal data) if some of
the elements can't be exactly divided by the monomial
. NOTE: if null
is returned, the content of
this
is destroyed.monomial
- monomialthis
divided by the factor * monomial
or null
public abstract Poly divideOrNull(Term monomial)
monomial
or returns null
(causing loss of internal data) if some of
the elements can't be exactly divided by the monomial
. NOTE: if null
is returned, the content of
this
is destroyed.monomial
- monomial degreesthis
divided by the factor * monomial
or null
public final Poly add(Poly oth)
IPolynomial
oth
to this
.add
in interface IPolynomial<Poly extends AMultivariatePolynomial<Term,Poly>>
oth
- the polynomialthis + oth
public final Poly subtract(Poly oth)
IPolynomial
oth
from this
.subtract
in interface IPolynomial<Poly extends AMultivariatePolynomial<Term,Poly>>
oth
- the polynomialthis - oth
public final Poly add(Term monomial)
monomial
to this polynomialmonomial
- the monomialthis + monomial
public final Poly put(Term monomial)
monomial
to this polynomial replacing the previous entry if waspublic final Poly subtract(Term monomial)
monomial
from this polynomialmonomial
- the monomialthis - monomial
public final Poly negate()
IPolynomial
negate
in interface IPolynomial<Poly extends AMultivariatePolynomial<Term,Poly>>
public final Poly add(Iterable<Term> monomials)
monomials
- termsthis + monomials
public final Poly add(Term... monomials)
monomials
- termsthis + monomials
public final Poly subtractLt()
public abstract Poly multiply(Term monomial)
this
by the monomial
monomial
- the monomialmonomial
public final Poly multiplyByDegreeVector(DegreeVector dv)
this
by the degree vectordv
- the degree vectorpublic final Set<DegreeVector> getSkeleton()
public final Poly setAllCoefficientsToUnit()
public final Set<DegreeVector> getSkeleton(int... variables)
variables
variables
- the variablesvariables
public final Set<DegreeVector> getSkeletonDrop(int... variables)
variables
variables
- the variablesvariables
public final Set<DegreeVector> getSkeletonExcept(int... variables)
variables
variables
- the variables to excludevariables
public final boolean sameSkeletonQ(AMultivariatePolynomial oth)
this
and oth
have the same skeletonoth
- other multivariate polynomialtrue
if this
and oth
have the same skeleton and false
otherwisepublic final boolean sameSkeletonQ(AMultivariatePolynomial oth, int... variables)
this
and oth
have the same skeleton with respect to specified variables
oth
- other multivariate polynomialvariables
- variables to testtrue
if this
and oth
have the same skeleton with respect to specified variables
and false
otherwisepublic final boolean sameSkeletonExceptQ(AMultivariatePolynomial oth, int... variables)
this
and oth
have the same skeleton with respect all except specified variables
oth
- other multivariate polynomialvariables
- variables to excludetrue
if this
and oth
have the same skeleton with respect to all except specified
variables
and false
otherwisepublic final Poly derivative(int variable)
variable
- the variablepublic abstract Poly derivative(int variable, int order)
order
with respect to specified variable (new instance created)variable
- the variableorder
- derivative orderorder
with respect to specified variablepublic abstract Poly seriesCoefficient(int variable, int order)
derivative(poly,
variable, order) / order!
, where the derivative is formal derivative and calculated with arithmetic performed
in Z ring (to overcome possible zeros in Zp).variable
- the variableorder
- derivative orderderivative(poly, variable, order) / order!
, where the derivative is formal derivative and
calculated with arithmetic performed in Z ring (to overcome possible zeros in Zp)public final Poly evaluateAtZero(int variable)
0
for variable
(new instance created).variable
- the variable0
substituted for variable
public final Poly evaluateAtZero(int[] variables)
0
for all specified variables
(new instance created).variables
- the variables0
substituted for all specified variables
public final Poly[] derivative()
public final MultivariatePolynomial<Poly> asOverPoly(Poly factory)
factory
- factory polynomialpublic final Poly composition(Poly... values)
this(values_1, ..., values_N)
)values
- polynomial values (may have different nvars from this)public final <sPoly extends IUnivariatePolynomial<sPoly>> sPoly composition(sPoly... values)
this(values_1, ..., values_N)
)values
- polynomial values (may have different nvars from this)public final <sPoly extends IUnivariatePolynomial<sPoly>> sPoly composition(Ring<sPoly> uRing, sPoly... values)
this(values_1, ..., values_N)
)uRing
- ring of univariate polynomialsvalues
- polynomial values (may have different nvars from this)public final Poly composition(List<Poly> values)
this(values_1, ..., values_N)
)values
- polynomial values (may have different nvars from this)public final Poly composition(int variable, Poly value)
this(x_1, ..., value, ..., x_N)
,
where value is on the place of specified variable)public abstract Poly clone()
IPolynomial
clone
in interface IPolynomial<Poly extends AMultivariatePolynomial<Term,Poly>>
clone
in class Object
public abstract Poly evaluateAtRandom(int variable, org.apache.commons.math3.random.RandomGenerator rnd)
poly
at random pointpublic abstract Poly evaluateAtRandomPreservingSkeleton(int variable, org.apache.commons.math3.random.RandomGenerator rnd)
poly
at random point chosen in such way that the skeleton of evaluated version is the same as
of the original poly
with respect to all except variable
variablespublic abstract <E> MultivariatePolynomial<E> mapCoefficientsAsPolys(Ring<E> ring, Function<Poly,E> mapper)
Copyright © 2018. All rights reserved.