np-extras-0.3: NumericPrelude extras

Safe HaskellNone




Polynomials in a countably infinite set of variables x1, x2, x3, ...



newtype T a Source

A polynomial is just a list of monomials, construed as their sum. We maintain the invariant that polynomials are always sorted by the ordering on monomials defined in MathObj.Monomial: first by partition degree, then by largest variable index (decreasing), then by exponent of the highest-index variable (decreasing). This works out nicely for operations on cycle index series.

Instances are provided for Additive, Ring, Differential (partial differentiation with respect to x1), and Show.


Cons [T a] 


(C a, C a, Ord a, Show a) => Show (T a) 

Constructing polynomials

fromMonomials :: [T a] -> T aSource

lift0 :: [T a] -> T aSource

lift1 :: ([T a] -> [T a]) -> T a -> T aSource

lift2 :: ([T a] -> [T a] -> [T a]) -> T a -> T a -> T aSource

x :: C a => Integer -> T aSource

Create the polynomial xn for a given n.

constant :: a -> T aSource

Create a constant polynomial.


compose :: (C a, C a) => T a -> T a -> T aSource

Plethyistic substitution: F o G = F(G(x1,x2,x3...), G(x2,x4,x6...), G(x3,x6,x9...), ...) See Bergeron, Labelle, and Leroux, "Combinatorial Species and Tree-Like Structures", p. 43.

merge :: Ord a => Bool -> (a -> a -> a) -> [a] -> [a] -> [a]Source

Merge two sorted lists, with a flag specifying whether to keep singletons, and a combining function for elements that are equal.