-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Multivariate polynomials. -- -- Manipulation of multivariate polynomials on a ring and Gröbner bases. @package hspray @version 0.2.2.0 -- | Deals with multivariate polynomials on a commutative ring. See README -- for examples. module Math.Algebra.Hspray data Powers Powers :: Seq Int -> Int -> Powers [exponents] :: Powers -> Seq Int [nvariables] :: Powers -> Int type Spray a = HashMap Powers a type Monomial a = (Powers, a) -- | Spray corresponding to the basic monomial x_n -- --
--   >>> x :: lone 1 :: Spray Int
--   
--   >>> y :: lone 2 :: Spray Int
--   
--   >>> p = 2*^x^**^2 ^-^ 3*^y
--   
--   >>> putStrLn $ prettySpray' p
--   (2) x1^2 + (-3) x2
--   
-- --
--   lone 0 == unitSpray
--   
lone :: C a => Int -> Spray a -- | The unit spray -- --
--   p ^*^ unitSpray == p
--   
unitSpray :: C a => Spray a -- | The null spray -- --
--   p ^+^ zeroSpray == p
--   
zeroSpray :: (Eq a, C a) => Spray a -- | Constant spray -- --
--   constantSpray 3 == 3 *^ unitSpray
--   
constantSpray :: (C a, Eq a) => a -> Spray a -- | Scale spray by a scalar (*^) :: (C a, Eq a) => a -> Spray a -> Spray a infixr 7 *^ -- | Scale spray by an integer -- --
--   3 .^ p == p ^+^ p ^+^ p
--   
(.^) :: (C a, Eq a) => Int -> Spray a -> Spray a infixr 7 .^ -- | Addition of two sprays (^+^) :: (C a, Eq a) => Spray a -> Spray a -> Spray a infixl 6 ^+^ -- | Substraction of two sprays (^-^) :: (C a, Eq a) => Spray a -> Spray a -> Spray a infixl 6 ^-^ -- | Multiply two sprays (^*^) :: (C a, Eq a) => Spray a -> Spray a -> Spray a infixl 7 ^*^ -- | Power of a spray (^**^) :: (C a, Eq a) => Spray a -> Int -> Spray a infixr 8 ^**^ -- | Pretty form of a spray -- --
--   >>> x :: lone 1 :: Spray Int
--   
--   >>> y :: lone 2 :: Spray Int
--   
--   >>> z :: lone 3 :: Spray Int
--   
--   >>> p = 2*^x ^+^ 3*^y^**^2 ^-^ 4*^z^**^3
--   
--   >>> putStrLn $ prettySpray show "x" p
--   (2) * x^(1) + (3) * x^(0, 2) + (-4) * x^(0, 0, 3)
--   
prettySpray :: (a -> String) -> String -> Spray a -> String -- | Pretty form of a spray, with monomials showed as "x1x3^2" -- --
--   >>> x :: lone 1 :: Spray Int
--   
--   >>> y :: lone 2 :: Spray Int
--   
--   >>> z :: lone 3 :: Spray Int
--   
--   >>> p = 2*^x ^+^ 3*^y^**^2 ^-^ 4*^z^**^3
--   
--   >>> putStrLn $ prettySpray' p
--   (2) x1 + (3) x2^2 + (-4) x3^3 
--   
prettySpray' :: Show a => Spray a -> String -- | Pretty form of a spray having at more three variables -- --
--   >>> x :: lone 1 :: Spray Int
--   
--   >>> y :: lone 2 :: Spray Int
--   
--   >>> z :: lone 3 :: Spray Int
--   
--   >>> p = 2*^x ^+^ 3*^y^**^2 ^-^ 4*^z^**^3
--   
--   >>> putStrLn $ prettySprayXYZ p
--   (2) X + (3) Y^2 + (-4) Z^3
--   
prettySprayXYZ :: Show a => Spray a -> String -- | Get coefficient of a term of a spray -- --
--   >>> x = lone 1 :: Spray Int
--   
--   >>> y = lone 2 :: Spray Int
--   
--   >>> z = lone 3 :: Spray Int
--   
--   >>> p = 2 *^ (2 *^ (x^**^3 ^*^ y^**^2)) ^+^ 4*^z ^+^ 5*^unitSpray
--   
--   >>> getCoefficient [3, 2, 0] p
--   4
--   
--   >>> getCoefficient [0, 4] p
--   0
--   
getCoefficient :: C a => [Int] -> Spray a -> a -- | Terms of a spray sprayTerms :: Spray a -> HashMap (Seq Int) a -- | Evaluates a spray -- --
--   >>> x :: lone 1 :: Spray Int
--   
--   >>> y :: lone 2 :: Spray Int
--   
--   >>> p = 2*^x^**^2 ^-^ 3*^y
--   
--   >>> evalSpray p [2, 1]
--   5
--   
evalSpray :: C a => Spray a -> [a] -> a -- | Substitutes some variables in a spray -- --
--   >>> x1 :: lone 1 :: Spray Int
--   
--   >>> x2 :: lone 2 :: Spray Int
--   
--   >>> x3 :: lone 3 :: Spray Int
--   
--   >>> p = x1^**^2 ^-^ x2 ^+^ x3 ^-^ unitSpray
--   
--   >>> p' = substituteSpray [Just 2, Nothing, Just 3] p
--   
--   >>> putStrLn $ prettySpray' p'
--   (-1) x2 + (6) 
--   
substituteSpray :: (Eq a, C a) => [Maybe a] -> Spray a -> Spray a -- | Composes a spray with a change of variables -- --
--   >>> x :: lone 1 :: Spray Int
--   
--   >>> y :: lone 2 :: Spray Int
--   
--   >>> z :: lone 3 :: Spray Int
--   
--   >>> p = x ^+^ y
--   
--   >>> q = composeSpray p [z, x ^+^ y ^+^ z]
--   
--   >>> putStrLn $ prettySprayXYZ q
--   (1) X + (1) Y + (2) Z
--   
composeSpray :: (C a, Eq a) => Spray a -> [Spray a] -> Spray a -- | Derivative of a spray derivSpray :: (C a, Eq a) => Int -> Spray a -> Spray a -- | 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 Rational
--   
--   >>> x2 = lone 2 :: Spray Rational
--   
--   >>> x3 = lone 3 :: Spray Rational
--   
--   >>> p = f x1 x2 x3
--   
-- --
--   permuteVariables p [3, 1, 2] == f x3 x1 x2
--   
permuteVariables :: Spray a -> [Int] -> Spray a -- | Swaps two variables of a spray -- --
--   swapVariables (1, 3) p == permuteVariables p [3, 2, 1]
--   
swapVariables :: Spray a -> (Int, Int) -> Spray a -- | Remainder of the division of a spray by a list of divisors, using the -- lexicographic ordering of the monomials sprayDivision :: forall a. (Eq a, C a) => Spray a -> [Spray a] -> Spray a -- | Groebner basis (always minimal and possibly reduced) -- --
--   groebner ps True = reduceGroebnerBasis (groebner ps False)
--   
groebner :: forall a. (Eq a, C a) => [Spray a] -> Bool -> [Spray a] -- | Reduces a Groebner basis reduceGroebnerBasis :: forall a. (Eq a, C a) => [Spray a] -> [Spray a] -- | Elementary symmetric polynomial -- --
--   >>> putStrLn $ prettySpray' (esPolynomial 3 2)
--   (1) x1x2 + (1) x1x3 + (1) x2x3
--   
esPolynomial :: (C a, Eq a) => Int -> Int -> Spray a -- | Whether a spray is a symmetric polynomial isSymmetricSpray :: forall a. (C a, Eq a) => Spray a -> Bool -- | Resultant of two sprays resultant :: (Eq a, C a) => Int -> Spray a -> Spray a -> Spray a -- | Resultant of two univariate sprays resultant1 :: (Eq a, C a) => Spray a -> Spray a -> a -- | Subresultants of two sprays subresultants :: (Eq a, C a) => Int -> Spray a -> Spray a -> [Spray a] -- | Subresultants of two univariate sprays subresultants1 :: (Eq a, C a) => Spray a -> Spray a -> [a] -- | Creates a spray from list of terms fromList :: (C a, Eq a) => [([Int], a)] -> Spray a -- | Spray as a list toList :: Spray a -> [([Int], a)] -- | Converts a spray with rational coefficients to a spray with double -- coefficients (useful for evaluation) fromRationalSpray :: Spray Rational -> Spray Double -- | Leading term of a spray leadingTerm :: Spray a -> Monomial a -- | 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 true -- --
--   >>> x = lone 1 :: Spray Rational
--   
--   >>> y = lone 2 :: Spray Rational
--   
--   >>> p1 = x ^+^ y
--   
--   >>> p2 = x ^-^ y
--   
--   >>> p = p1 ^*^ p2
--   
-- --
--   isPolynomialOf p [p1, p2] == (True, Just $ x ^*^ y)
--   
isPolynomialOf :: forall a. (C a, Eq a) => Spray a -> [Spray a] -> (Bool, Maybe (Spray a)) -- | Bombieri spray (for internal usage in the 'scubature' library) bombieriSpray :: C a => Spray a -> Spray a instance GHC.Show.Show Math.Algebra.Hspray.Powers instance (Algebra.Additive.C a, GHC.Classes.Eq a) => Algebra.Additive.C (Math.Algebra.Hspray.Spray a) instance (Algebra.Ring.C a, GHC.Classes.Eq a) => Algebra.Module.C a (Math.Algebra.Hspray.Spray a) instance (Algebra.Ring.C a, GHC.Classes.Eq a) => Algebra.Ring.C (Math.Algebra.Hspray.Spray a) instance GHC.Classes.Eq Math.Algebra.Hspray.Powers instance Data.Hashable.Class.Hashable Math.Algebra.Hspray.Powers