Îõ³h*¶.2      !"#$%&'()*+,-./010.2.4.0#Multivariate polynomials on a ring.(c) Stéphane Laurent, 2023GPL-3laurent_step@outlook.fr Safe-Inferred 3ÂÃÄÅÆÝ®À2hsprayappend trailing zeros3hspray,append trailing zeros to get the same lengthhsprayAddition of two sprayshspraySubstraction of two sprayshsprayMultiply two sprays hsprayPower of a spray hsprayScale spray by a scalar hsprayScale spray by an integer3 .^ p == p ^+^ p ^+^ p4hspraydrop trailing zeros5hspray,drop trailing zeros in the powers of a spray6hspray%simplify powers and remove zero terms7hsprayaddition of two sprays8hsprayopposite spray9hsprayscale a spray by a scalar:hsprayderivative of a monomial hsprayDerivative of a spray;hspraymultiply two monomials<hspraymultiply two sprays hspray-Spray corresponding to the basic monomial x_nx :: lone 1 :: Spray Inty :: lone 2 :: Spray Intp = 2*^x^**^2 ^-^ 3*^yputStrLn $ prettySpray' p(2) x1^2 + (-3) x2lone 0 == unitSprayhsprayThe unit sprayp ^*^ unitSpray == phsprayThe null sprayp ^+^ zeroSpray == phsprayConstant spray!constantSpray 3 == 3 *^ unitSprayhspray%Get coefficient of a term of a spray x = lone 1 :: Spray Inty = lone 2 :: Spray Intz = lone 3 :: Spray Int=p = 2 *^ (2 *^ (x^**^3 ^*^ y^**^2)) ^+^ 4*^z ^+^ 5*^unitSpraygetCoefficient [3, 2, 0] p4getCoefficient [0, 4] p0=hspraynumber of variables in a spray>hsprayevaluates a monomialhsprayEvaluates a sprayx :: lone 1 :: Spray Inty :: lone 2 :: Spray Intp = 2*^x^**^2 ^-^ 3*^yevalSpray p [2, 1]5?hsprayspray from monomial@hspray'substitute some variables in a monomialhspray%Substitutes some variables in a sprayx1 :: lone 1 :: Spray Intx2 :: lone 2 :: Spray Intx3 :: lone 3 :: Spray Int'p = x1^**^2 ^-^ x2 ^+^ x3 ^-^ unitSpray0p' = substituteSpray [Just 2, Nothing, Just 3] pputStrLn $ prettySpray' p'(-1) x2 + (6) hsprayèConverts a spray with rational coefficients to a spray with double coefficients (useful for evaluation)hspray+Composes a spray with a change of variablesx :: lone 1 :: Spray Inty :: lone 2 :: Spray Intz :: lone 3 :: Spray Int p = x ^+^ y%q = composeSpray p [z, x ^+^ y ^+^ z]putStrLn $ prettySprayXYZ q(1) X + (1) Y + (2) Zhspray$Creates a spray from a list of termshspray!Permutes the variables of a sprayÉf :: Spray Rational -> Spray Rational -> Spray Rational -> Spray RationalÉf p1 p2 p3 = p1^**^4 ^+^ (2*^p2^**^3) ^+^ (3*^p3^**^2) ^-^ (4*^unitSpray)x1 = lone 1 :: Spray Rationalx2 = lone 2 :: Spray Rationalx3 = lone 3 :: Spray Rationalp = f x1 x2 x3*permuteVariables [3, 1, 2] p == f x3 x1 x2hspraySwaps two variables of a spray6swapVariables (1, 3) p == permuteVariables [3, 2, 1] pAhspray(prettyPowers "x" [0, 2, 1] = x^(0, 2, 1)hsprayPretty form of a sprayx :: lone 1 :: Spray Inty :: lone 2 :: Spray Intz :: lone 3 :: Spray Int$p = 2*^x ^+^ 3*^y^**^2 ^-^ 4*^z^**^3!putStrLn $ prettySpray show "x" p1(2) * x^(1) + (3) * x^(0, 2) + (-4) * x^(0, 0, 3)Bhspray"prettyPowers' [0, 2, 1] = "x2^2x3"hspray9Pretty form of a spray, with monomials showed as "x1x3^2"x :: lone 1 :: Spray Inty :: lone 2 :: Spray Intz :: lone 3 :: Spray Int$p = 2*^x ^+^ 3*^y^**^2 ^-^ 4*^z^**^3putStrLn $ prettySpray' p(2) x1 + (3) x2^2 + (-4) x3^3 Chspray!prettyPowersXYZ [1, 2, 1] = XY^2Zhspray5Pretty form of a spray having at more three variablesx :: lone 1 :: Spray Inty :: lone 2 :: Spray Intz :: lone 3 :: Spray Int$p = 2*^x ^+^ 3*^y^**^2 ^-^ 4*^z^**^3putStrLn $ prettySprayXYZ p(2) X + (3) Y^2 + (-4) Z^3hsprayTerms of a sprayhspraySpray as a listhspray>Bombieri spray (for internal usage in the 'scubature' library)Dhsprayindex of the maximum of a listhsprayLeading term of a spray Ehspray+whether a monomial divides another monomialFhspray:quotient of monomial Q by monomial p, assuming P divides Q hsprayïRemainder of the division of a spray by a list of divisors, using the lexicographic ordering of the monomials!hsprayDivision of a spray by a sprayGhsprayslight modification of   to speed up groebner00Hhspray+groebner basis, not minimal and not reducedIhspray'groebner basis, minimal but not reduced"hsprayReduces a Groebner basis#hspray4Groebner basis (always minimal and possibly reduced);groebner ps True == reduceGroebnerBasis (groebner ps False)Jhspray'combinations of k elements among a listKhspray/generates all permutations of a binary sequence$hsprayElementary symmetric polynomial*putStrLn $ prettySpray' (esPolynomial 3 2)(1) x1x2 + (1) x1x3 + (1) x2x3%hspray)Whether a spray is a symmetric polynomial&hsprayÆWhether a spray can be written as a polynomial of a given list of sprays (the sprays in the list must belong to the same polynomial ring as the spray); this polynomial is returned if this is truex = lone 1 :: Spray Rationaly = lone 2 :: Spray Rational p1 = x ^+^ y p2 = x ^-^ y p = p1 ^*^ p23isPolynomialOf p [p1, p2] == (True, Just $ x ^*^ y)'hsprayResultant of two  univariate sprays(hspraySubresultants of two  univariate sprays)hsprayResultant of two sprays*hspraySubresultants of two sprays+hsprayÂGreatest common divisor of two sprays with coefficients in a field hspray8index of the variable of differentiation (starting at 1)hspraythe spray to be derivatedhspraythe derivated sprayhspray6function mapping a coefficient to a string, typically Lhspray(a string denoting the variable, e.g. "x"hspray the spray!hspray dividend hspraydivisorhspray(quotient, remainder)#hspraylist of sprays hspray#whether to return the reduced basis$hspraynumber of variableshsprayindex)hspray×indicator of the variable with respect to which the resultant is desired (e.g. 1 for x)*hspray×indicator of the variable with respect to which the resultant is desired (e.g. 1 for x)Mhspraynumber of variableshsprayAhsprayBhspray)(c, (Q, R)) such that c^*^A = B^*^Q ^+^ R,    ! #"$%)'*(+&,    ! #"$%)'*(+&667 8 7 7Î      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQÒ%hspray-0.2.4.0-FjjymVt0mvK1GjL8CnZwFYMath.Algebra.HsprayhsprayMonomialSprayPowers exponents nvariables^+^^-^^*^^**^*^.^ derivSpraylone unitSpray zeroSpray constantSpraygetCoefficient evalSpraysubstituteSprayfromRationalSpray composeSprayfromListpermuteVariables swapVariables prettySpray prettySpray'prettySprayXYZ sprayTermstoList bombieriSpray leadingTermsprayDivisionRemainder sprayDivisionreduceGroebnerBasisgroebner esPolynomialisSymmetricSprayisPolynomialOf resultant1subresultants1 resultant subresultantsgcdSpray$fHashablePowers $fEqPowers $fCHashMap $fCaHashMap $fCHashMap0 $fShowPowers growSequence harmonizesimplifyPowers simplifySpray cleanSpray addSprays negateSpray scaleSpray derivMonomial multMonomial multSpraysnumberOfVariables evalMonomial fromMonomialsubstituteMonomial prettyPowers prettyPowers'prettyPowersXYZmaxIndexdividesquotientsprayDivisionRemainder' groebner00 groebner0combinationsOfpermutationsBinarySequencebaseGHC.ShowshowpseudoDivision