Class AMultivariatePolynomial<Term extends AMonomial<Term>,​Poly extends AMultivariatePolynomial<Term,​Poly>>

  • Type Parameters:
    Term - type of monomials
    Poly - type of this (self-type)
    All Implemented Interfaces:
    Stringifiable<Poly>, IPolynomial<Poly>, Serializable, Comparable<Poly>, Iterable<Term>
    Direct Known Subclasses:
    MultivariatePolynomial, MultivariatePolynomialZp64

    public abstract class AMultivariatePolynomial<Term extends AMonomial<Term>,​Poly extends AMultivariatePolynomial<Term,​Poly>>
    extends Object
    implements IPolynomial<Poly>, Iterable<Term>
    Parent class for multivariate polynomials.

    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.

    Since:
    1.0
    See Also:
    IPolynomial, MultivariatePolynomialZp64, MultivariatePolynomial, Serialized Form
    • Method Detail

      • swapVariables

        public static <T extends AMonomial<T>,​P extends AMultivariatePolynomial<T,​P>> P swapVariables​(P poly,
                                                                                                                  int i,
                                                                                                                  int j)
        Renames variable i to j and j to i (new instance created)
        Parameters:
        poly - the polynomial
        i - the first variable
        j - the second variable
        Returns:
        polynomial with variable i renamed to j and j renamed to i
      • renameVariables

        public static <T extends AMonomial<T>,​P extends AMultivariatePolynomial<T,​P>> P renameVariables​(P poly,
                                                                                                                    int[] newVariables)
        Rename variables from [0,1,...N] to [newVariables[0], newVariables[1], ..., newVariables[N]] (new instance created)
        Parameters:
        poly - the polynomial
        newVariables - the new variables
        Returns:
        renamed polynomial
      • renameVariables

        public static <T extends AMonomial<T>> T renameVariables​(T e,
                                                                 int[] newVariables)
        Rename variables from [0,1,...N] to [newVariables[0], newVariables[1], ..., newVariables[N]] (new instance created)
        Parameters:
        e - the term
        newVariables - the new variables
        Returns:
        renamed term
      • renameVariables

        public static <T extends AMonomial<T>,​P extends AMultivariatePolynomial<T,​P>> 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)
        Parameters:
        poly - the polynomial
        newVariables - the new variables
        newOrdering - the new ordering
        Returns:
        renamed polynomial
      • asMultivariate

        public static <Term extends AMonomial<Term>,​Poly extends AMultivariatePolynomial<Term,​Poly>> Poly asMultivariate​(IUnivariatePolynomial poly,
                                                                                                                                     int nVariables,
                                                                                                                                     int variable,
                                                                                                                                     Comparator<DegreeVector> ordering)
        Converts univariate polynomial to multivariate. Example:
         //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)
         
         
        Type Parameters:
        Term - desired terms type
        Poly - desired polynomial type
        Parameters:
        poly - the univariate polynomial
        nVariables - the total number of variables in the result
        variable - the univariate variable
        ordering - the term order
        Returns:
        the multivariate polynomial
      • asUnivariate

        public abstract IUnivariatePolynomial asUnivariate()
        Converts this to univariate polynomial or throws exception if conversion is impossible (more than one variable have non zero exponents)
        Returns:
        univariate polynomial
        Throws:
        IllegalArgumentException - if this is not effectively a univariate polynomial
      • create

        public final Poly create​(Term... terms)
        Creates multivariate polynomial over the same ring as this from the list of monomials
        Parameters:
        terms - the monomials
        Returns:
        multivariate polynomial
      • create

        public final Poly create​(Iterable<Term> terms)
        Creates multivariate polynomial over the same ring as this from the list of monomials
        Parameters:
        terms - the monomials
        Returns:
        multivariate polynomial
      • create

        public final Poly create​(Term term)
        Creates multivariate polynomial over the same ring as this with the single monomial
        Parameters:
        term - the monomial
        Returns:
        multivariate polynomial
      • createConstantFromTerm

        public abstract Poly createConstantFromTerm​(Term term)
        Creates multivariate polynomial over the same ring as this with the single constant element taken from given monomial
        Parameters:
        term - the monomial
        Returns:
        multivariate polynomial
      • create

        public final Poly create​(DegreeVector term)
        Creates multivariate polynomial over the same ring as this with the single monomial
        Parameters:
        term - the monomial
        Returns:
        multivariate polynomial
      • createMonomial

        public final Poly createMonomial​(int variable,
                                         int degree)
        Creates monomial over the same ring as this of the form variable ^ degree
        Parameters:
        variable - the variable
        degree - the monomial degree
        Returns:
        monomial variable ^ degree
      • setOrdering

        public final Poly setOrdering​(Comparator<DegreeVector> newOrdering)
        Makes a copy of this with the new ordering newOrdering
        Parameters:
        newOrdering - the new ordering
        Returns:
        a copy of this with the new ordering
      • release

        protected void release()
        release caches
      • size

        public final int size()
        Returns the number of terms in this polynomial
        Specified by:
        size in interface IPolynomial<Term extends AMonomial<Term>>
        Returns:
        the number of terms
      • isZero

        public final boolean isZero()
        Description copied from interface: IPolynomial
        Returns true if this is zero
        Specified by:
        isZero in interface IPolynomial<Term extends AMonomial<Term>>
        Returns:
        whether this is zero
      • isLinearExactly

        public boolean isLinearExactly()
        Description copied from interface: IPolynomial
        Returns whether this polynomial is linear (i.e. of the form a * X + b with nonzero a)
        Specified by:
        isLinearExactly in interface IPolynomial<Term extends AMonomial<Term>>
      • isZeroCC

        public boolean isZeroCC()
        Description copied from interface: IPolynomial
        Returns true if constant term is zero
        Specified by:
        isZeroCC in interface IPolynomial<Term extends AMonomial<Term>>
        Returns:
        whether constant term is zero
      • ascendingIterator

        public Iterator<Term> ascendingIterator()
      • descendingIterator

        public Iterator<Term> descendingIterator()
      • first

        public Term first()
      • last

        public Term last()
      • toArray

        public final Term[] toArray()
      • isMonomial

        public final boolean isMonomial()
        Description copied from interface: IPolynomial
        Returns true if this polynomial has only one monomial term
        Specified by:
        isMonomial in interface IPolynomial<Term extends AMonomial<Term>>
        Returns:
        whether this has only one monomial term
      • isVariable

        public final boolean isVariable()
        Returns whether this is a plain variable (with no coefficient)
      • set

        public final Poly set​(Poly oth)
        Description copied from interface: IPolynomial
        Sets the content of this to oth
        Specified by:
        set in interface IPolynomial<Term extends AMonomial<Term>>
        Parameters:
        oth - the polynomial
        Returns:
        this := oth
      • dropVariable

        public final Poly dropVariable​(int variable)
        Makes a copy of this with the specified variable dropped
        Parameters:
        variable - the variable
      • dropVariables

        public final Poly dropVariables​(int[] variables)
        Makes a copy of this with the specified variable replaced with the unit
        Parameters:
        variables - the variables
      • dropSelectVariables

        public final Poly dropSelectVariables​(int... variables)
        Makes a copy of this with all variables except specified ones replaced with the units
        Parameters:
        variables - the variables
      • insertVariable

        public final Poly insertVariable​(int variable)
        Makes a copy of this by inserting new variable (the indexes will be shifted)
        Parameters:
        variable - the variable
      • insertVariable

        public final Poly insertVariable​(int variable,
                                         int count)
        Makes a copy of this by inserting new variables (the indexes will be shifted)
        Parameters:
        variable - the variable
        count - length of the insertion
      • setNVariables

        public final Poly setNVariables​(int newNVariables)
        auxiliary method
      • mapVariables

        public final Poly mapVariables​(int[] mapping)
        Renames old variables to new according to mapping
        Parameters:
        mapping - mapping from old variables to new variables
      • joinNewVariable

        public final Poly joinNewVariable()
        Returns a copy of this with nVariables = nVariables + 1
        Returns:
        a copy of this with one additional (last) variable added
        See Also:
        insertVariable(int)
      • joinNewVariables

        public final Poly joinNewVariables​(int n)
        Returns a copy of this with nVariables = nVariables + m
        Returns:
        a copy of this with n additional (last) variables added
        See Also:
        insertVariable(int)
      • nUsedVariables

        public final int nUsedVariables()
        Returns the number of really used variables (those which are not units)
        Returns:
        the number of variables (those which are not units)
      • degree

        public int degree()
        Returns the total degree of this polynomial, that is the maximal total degree among all terms
        Specified by:
        degree in interface IPolynomial<Term extends AMonomial<Term>>
        Returns:
        the total degree of this polynomial, that is the maximal total degree among all terms
      • degree

        public int degree​(int... variables)
        Gives the degree in specified variables
      • degreeMax

        public int degreeMax()
        Returns the maximal degree of variables in this polynomial
        Returns:
        the maximal degree of variables in this polynomial
      • degree

        public final int degree​(int variable)
        Returns the degree of this polynomial with respect to specified variable
        Parameters:
        variable - the variable
        Returns:
        the degree of this polynomial with respect to specified variable
      • degreesRef

        protected int[] degreesRef()
        returns reference (content must not be modified)
      • degrees

        public final 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
        Returns:
        array of degrees
      • multidegree

        public final int[] multidegree()
        Returns the multidegree of this polynomial i.e. exponents of the leading term (without copying)
        Returns:
        the multidegree of this polynomial i.e. exponents of the leading term (without copying)
      • degrees

        public final int[] degrees​(int variable)
        Returns the array of exponents in which variable occurs in this polynomial
        Returns:
        the array of exponents in which variable occurs in this polynomial
      • degreeSum

        public final int degreeSum()
        Returns the sum of degrees()
        Returns:
        sum of degrees()
      • totalDegree

        public final int totalDegree()
        Returns the total degree, that is sum of degrees()
      • sparsity

        public double sparsity()
        Sparsity level: size / (product of degrees)
      • sparsity2

        public 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.
      • ecart

        public final int ecart()
        Returns degreeSum - lt().totalDegree
      • isHomogeneous

        public final boolean isHomogeneous()
        Returns whether all terms have the same total degree
      • homogenize

        public final Poly homogenize​(int variable)
        Homogenize poly by adding new (homogenizing) variable
        Parameters:
        variable - variable that will be inserted (homogenization variable)
      • isEffectiveUnivariate

        public final boolean isEffectiveUnivariate()
        Returns whether this poly is effectively univariate (not more than one variable is non-unit)
        Returns:
        whether this poly is effectively univariate
      • univariateVariable

        public final int univariateVariable()
        Returns -1 if this poly is not effectively univariate or variable in which it is univariate
        Returns:
        -1 if this poly is not effectively univariate or variable in which it is univariate
      • coefficientOf

        public final Poly coefficientOf​(int variable,
                                        int exponent)
        Returns a coefficient before variable^exponent as a multivariate polynomial
        Parameters:
        variable - the variable
        exponent - the exponent
        Returns:
        coefficient before variable^exponent as a multivariate polynomial
      • coefficientOf

        public final Poly coefficientOf​(int[] variables,
                                        int[] exponents)
        Returns a coefficient before variables^exponents as a multivariate polynomial
        Parameters:
        variables - the variables
        exponents - the exponents
        Returns:
        coefficient before variables^exponents as a multivariate polynomial
      • dropCoefficientOf

        public final Poly dropCoefficientOf​(int[] variables,
                                            int[] exponents)
        Returns a coefficient before variables^exponents as a multivariate polynomial and drops all such terms from this
        Parameters:
        variables - the variables
        exponents - the exponents
        Returns:
        coefficient before variables^exponents as a multivariate polynomial
      • asUnivariate

        public final UnivariatePolynomial<Poly> asUnivariate​(int variable)
        Converts this polynomial to a univariate polynomial over specified variable with the multivariate coefficient ring.
        Parameters:
        variable - variable which will be treated as univariate variable
        Returns:
        univariate polynomial over the ring of multivariate coefficients
        Throws:
        IllegalArgumentException - if this is not effectively a univariate polynomial
      • asUnivariateEliminate

        public final UnivariatePolynomial<Poly> asUnivariateEliminate​(int variable)
        Converts this polynomial to a univariate polynomial over specified variable with the multivariate coefficient ring.
        Parameters:
        variable - variable which will be treated as univariate variable
        Returns:
        univariate polynomial over the ring of multivariate coefficients
        Throws:
        IllegalArgumentException - if this is not effectively a univariate polynomial
      • asOverUnivariate

        public abstract MultivariatePolynomial<? extends IUnivariatePolynomial> asOverUnivariate​(int variable)
        Converts this to a multivariate polynomial with coefficients being univariate polynomials over variable
        Parameters:
        variable - variable
        Returns:
        multivariate polynomial with coefficients being univariate polynomials over variable
      • asOverUnivariateEliminate

        public 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)
        Parameters:
        variable - the variable
        Returns:
        multivariate polynomial with coefficients being univariate polynomials over variable, the resulting polynomial have (nVariable - 1) multivariate variables
      • asOverMultivariate

        public 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]
        Parameters:
        variables - the variables to separate
        Returns:
        multivariate polynomial with coefficients being multivariate polynomials polynomials over variables that is polynomial in R[variables][other_variables]
      • asOverMultivariateEliminate

        public final 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]
        Parameters:
        variables - the variables to separate
        Returns:
        multivariate polynomial with coefficients being multivariate polynomials polynomials over variables that is polynomial in R[variables][other_variables]
      • asOverMultivariateEliminate

        public abstract MultivariatePolynomial<Poly> asOverMultivariateEliminate​(int[] variables,
                                                                                 Comparator<DegreeVector> ordering)
        Converts this to a multivariate polynomial with coefficients being multivariate polynomials polynomials over variables that is polynomial in R[variables][other_variables]
        Parameters:
        variables - the variables to separate
        ordering - monomial order to use for result
        Returns:
        multivariate polynomial with coefficients being multivariate polynomials polynomials over variables that is polynomial in R[variables][other_variables]
      • asMultivariate

        public static <Term extends AMonomial<Term>,​Poly extends AMultivariatePolynomial<Term,​Poly>> Poly asMultivariate​(UnivariatePolynomial<Poly> uPoly,
                                                                                                                                     int variable)
        Convert univariate polynomial over multivariate polynomials to a normal multivariate poly
        Parameters:
        uPoly - univariate polynomial over multivariate polynomials
        variable - the univariate variable
        Returns:
        multivariate poly
      • primitivePart

        public abstract Poly primitivePart​(int variable)
        Gives primitive part of this considered as R[variable][other_variables]
        Parameters:
        variable - the variable
        Returns:
        primitive part of this considered as R[variable][other_variables]
      • contentUnivariate

        public abstract IUnivariatePolynomial contentUnivariate​(int variable)
        Gives the content of this considered as R[variable][other_variables]
        Parameters:
        variable - the variable
        Returns:
        the content of this considered as R[variable][other_variables]
      • monic

        public abstract Poly monic​(Comparator<DegreeVector> ordering)
        Make this poly monic considering leading term with respect to given ordering
      • monicWithLC

        public 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
      • content

        public final Poly content​(int variable)
        Gives the content of this considered as R[variable][other_variables]
        Parameters:
        variable - the variable
        Returns:
        the content of this considered as R[variable][other_variables]
      • contentExcept

        public final Poly contentExcept​(int variable)
        Gives the content of this considered as R[other_variables][variable]
        Parameters:
        variable - the variable
        Returns:
        the content of this considered as R[other_variables][variable]
      • multiplyByMonomial

        public final Poly multiplyByMonomial​(int variable,
                                             int exponent)
        Multiplies this by variable^exponent
        Parameters:
        variable - the variable
        exponent - the exponent
        Returns:
        this multiplied by variable^exponent
      • lc

        public final Poly lc​(int variable)
        Returns the leading coefficient of this viewed as R[other_variables][variable]
        Parameters:
        variable - the variable
        Returns:
        multivariate leading coefficient of this viewed as R[other_variables][variable]
      • setLC

        public final 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])
        Parameters:
        variable - the variable
        lc - the leading coefficient of this viewed as R[other_variables][variable]
      • lt

        public final Term lt​(Comparator<DegreeVector> ordering)
        Returns the leading term in this polynomial according to specified ordering
        Returns:
        the leading term in this polynomial according to specified ordering
      • lt

        public final Term lt()
        Returns the leading term in this polynomial according to ordering
        Returns:
        the leading term in this polynomial according to ordering
      • mt

        public final Term mt()
        Returns the minimal term in this polynomial according to ordering
        Returns:
        the minimal term in this polynomial according to ordering
      • lcAsPoly

        public abstract Poly lcAsPoly​(Comparator<DegreeVector> ordering)
        Returns the leading coefficient with respect to specified ordering as a constant poly
      • ltAsPoly

        public final Poly ltAsPoly()
        Returns the leading term in this polynomial according to ordering
        Returns:
        the leading term in this polynomial according to ordering
      • monomialContent

        public final Term monomialContent()
        Returns the monomial content of this polynomial
        Returns:
        the monomial content of this polynomial
      • divideDegreeVectorOrNull

        public final 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. NOTE: if null is returned, the content of this is destroyed.
        Parameters:
        monomial - monomial
        Returns:
        this divided by the factor * monomial or null
      • divideOrNull

        public 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. NOTE: if null is returned, the content of this is destroyed.
        Parameters:
        monomial - monomial degrees
        Returns:
        this divided by the factor * monomial or null
      • subtract

        public final Poly subtract​(Term cf,
                                   Poly oth)
        Subtracts cf * oth from this polynomial
      • add

        public final Poly add​(Term monomial)
        Adds monomial to this polynomial
        Parameters:
        monomial - the monomial
        Returns:
        this + monomial
      • put

        public final Poly put​(Term monomial)
        Puts monomial to this polynomial replacing the previous entry if was
      • subtract

        public final Poly subtract​(Term monomial)
        Subtracts monomial from this polynomial
        Parameters:
        monomial - the monomial
        Returns:
        this - monomial
      • add

        public final Poly add​(Iterable<Term> monomials)
        Adds monomials to this polynomial
        Parameters:
        monomials - terms
        Returns:
        this + monomials
      • add

        public final Poly add​(Term... monomials)
        Adds monomials to this polynomial
        Parameters:
        monomials - terms
        Returns:
        this + monomials
      • subtractLt

        public final Poly subtractLt()
        Removes the leading term from this polynomial
        Returns:
        this - this.lt()
      • multiply

        public abstract Poly multiply​(Term monomial)
        Multiplies this by the monomial
        Parameters:
        monomial - the monomial
        Returns:
        this multiplied by the monomial
      • multiplyByDegreeVector

        public final Poly multiplyByDegreeVector​(DegreeVector dv)
        Multiplies this by the degree vector
        Parameters:
        dv - the degree vector
        Returns:
        this multiplied by the degree vector
      • getSkeleton

        public final Set<DegreeVector> getSkeleton()
        Returns skeleton of this poly
        Returns:
        skeleton of this poly
      • setAllCoefficientsToUnit

        public final Poly setAllCoefficientsToUnit()
        Set all coefficients to units
      • getSkeleton

        public final Set<DegreeVector> getSkeleton​(int... variables)
        Returns skeleton of this poly with respect to specified variables
        Parameters:
        variables - the variables
        Returns:
        skeleton of this poly with respect to specified variables
      • getSkeletonDrop

        public final Set<DegreeVector> getSkeletonDrop​(int... variables)
        Returns skeleton of this poly with respect to specified variables
        Parameters:
        variables - the variables
        Returns:
        skeleton of this poly with respect to specified variables
      • getSkeletonExcept

        public final Set<DegreeVector> getSkeletonExcept​(int... variables)
        Returns skeleton of this poly with respect to all except specified variables
        Parameters:
        variables - the variables to exclude
        Returns:
        skeleton of this poly with respect to all except specified variables
      • sameSkeletonQ

        public final boolean sameSkeletonQ​(AMultivariatePolynomial oth)
        Tests whether this and oth have the same skeleton
        Parameters:
        oth - other multivariate polynomial
        Returns:
        true if this and oth have the same skeleton and false otherwise
      • sameSkeletonQ

        public final boolean sameSkeletonQ​(AMultivariatePolynomial oth,
                                           int... variables)
        Tests whether this and oth have the same skeleton with respect to specified variables
        Parameters:
        oth - other multivariate polynomial
        variables - variables to test
        Returns:
        true if this and oth have the same skeleton with respect to specified variables and false otherwise
      • sameSkeletonExceptQ

        public final boolean sameSkeletonExceptQ​(AMultivariatePolynomial oth,
                                                 int... variables)
        Tests whether this and oth have the same skeleton with respect all except specified variables
        Parameters:
        oth - other multivariate polynomial
        variables - variables to exclude
        Returns:
        true if this and oth have the same skeleton with respect to all except specified variables and false otherwise
      • derivative

        public final Poly derivative​(int variable)
        Gives partial derivative with respect to specified variable (new instance created)
        Parameters:
        variable - the variable
        Returns:
        partial derivative with respect to specified variable
      • derivative

        public abstract Poly derivative​(int variable,
                                        int order)
        Gives partial derivative of specified order with respect to specified variable (new instance created)
        Parameters:
        variable - the variable
        order - derivative order
        Returns:
        partial derivative of specified order with respect to specified variable
      • seriesCoefficient

        public 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).
        Parameters:
        variable - the variable
        order - derivative order
        Returns:
        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)
      • evaluateAtZero

        public final Poly evaluateAtZero​(int variable)
        Substitutes 0 for variable (new instance created).
        Parameters:
        variable - the variable
        Returns:
        a new multivariate polynomial with 0 substituted for variable
      • evaluateAtZero

        public final Poly evaluateAtZero​(int[] variables)
        Substitutes 0 for all specified variables (new instance created).
        Parameters:
        variables - the variables
        Returns:
        a new multivariate polynomial with 0 substituted for all specified variables
      • derivative

        public final Poly[] derivative()
        Gives the derivative vector
        Returns:
        derivative vector
      • asOverPoly

        public final MultivariatePolynomial<Poly> asOverPoly​(Poly factory)
        Consider coefficients of this as constant polynomials of the same type as a given factory polynomial
        Parameters:
        factory - factory polynomial
      • composition

        public final Poly composition​(Poly... values)
        Substitutes given polynomials instead of variables of this (that is this(values_1, ..., values_N))
        Parameters:
        values - polynomial values (may have different nvars from this)
      • composition

        public final <sPoly extends IUnivariatePolynomial<sPoly>> sPoly composition​(sPoly... values)
        Substitutes given polynomials instead of variables of this (that is this(values_1, ..., values_N))
        Parameters:
        values - polynomial values (may have different nvars from this)
      • composition

        public final <sPoly extends IUnivariatePolynomial<sPoly>> sPoly composition​(Ring<sPoly> uRing,
                                                                                    sPoly... values)
        Substitutes given polynomials instead of variables of this (that is this(values_1, ..., values_N))
        Parameters:
        uRing - ring of univariate polynomials
        values - polynomial values (may have different nvars from this)
      • composition

        public final Poly composition​(List<Poly> values)
        Substitutes given polynomials instead of variables of this (that is this(values_1, ..., values_N))
        Parameters:
        values - polynomial values (may have different nvars from this)
      • composition

        public final 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)
      • composition

        public final Poly composition​(int[] variables,
                                      Poly[] values)
        Substitutes given polynomial instead of specified variable (that is this(x_1, ..., value, ..., x_N), where value is on the place of specified variable)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • skeletonHashCode

        public int skeletonHashCode()
      • evaluateAtRandom

        public abstract Poly evaluateAtRandom​(int variable,
                                              org.apache.commons.math3.random.RandomGenerator rnd)
        Evaluates poly at random point
      • evaluateAtRandomPreservingSkeleton

        public 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