polynomial-0.5: Polynomials

Math.Polynomial

Synopsis

Documentation

data Endianness Source

Constructors

 BE Big-Endian (head is highest-order term) LE Little-Endian (head is const term)

Instances

 Bounded Endianness Enum Endianness Eq Endianness Ord Endianness Show Endianness

data Poly a Source

Instances

 Functor Poly (Num a, Eq a) => Eq (Poly a) Num a => Num (Poly a) Num a => Show (Poly a) (Pretty a, Num a, Ord a) => Pretty (Poly a) (RealFloat a, Pretty (Complex a)) => Pretty (Poly (Complex a)) VectorSpace a => VectorSpace (Poly a) AdditiveGroup a => AdditiveGroup (Poly a)

poly :: Num a => Endianness -> [a] -> Poly aSource

Make a `Poly` from a list of coefficients using the specified coefficient order.

polyCoeffs :: Num a => Endianness -> Poly a -> [a]Source

Get the coefficients of a a `Poly` in the specified order.

zero :: Num a => Poly aSource

one :: Num a => Poly aSource

x :: Num a => Poly aSource

scalePoly :: Num a => a -> Poly a -> Poly aSource

negatePoly :: Num a => Poly a -> Poly aSource

addPoly :: Num a => Poly a -> Poly a -> Poly aSource

sumPolys :: Num a => [Poly a] -> Poly aSource

multPoly :: Num a => Poly a -> Poly a -> Poly aSource

powPoly :: (Num a, Integral b) => Poly a -> b -> Poly aSource

quotRemPoly :: Fractional a => Poly a -> Poly a -> (Poly a, Poly a)Source

quotPoly :: Fractional a => Poly a -> Poly a -> Poly aSource

remPoly :: Fractional a => Poly a -> Poly a -> Poly aSource

evalPoly :: Num a => Poly a -> a -> aSource

evalPolyDeriv :: Num a => Poly a -> a -> (a, a)Source

evalPolyDerivs :: Num a => Poly a -> a -> [a]Source

contractPoly :: Num a => Poly a -> a -> (Poly a, a)Source

"Contract" a polynomial by attempting to divide out a root.

`contractPoly p a` returns `(q,r)` such that `q*(x-a) + r == p`

gcdPoly :: Fractional a => Poly a -> Poly a -> Poly aSource

separateRoots :: Fractional a => Poly a -> [Poly a]Source

Separate a polynomial into a set of factors none of which have multiple roots, and the product of which is the original polynomial. Note that if division is not exact, it may fail to separate roots. Rational coefficients is a good idea.

Useful when applicable as a way to simplify root-finding problems.

polyDeriv :: Num a => Poly a -> Poly aSource