numeric-prelude-0.4.3.1: An experimental alternative hierarchy of numeric type classes

Safe HaskellNone
LanguageHaskell98

MathObj.Polynomial

Description

Polynomials and rational functions in a single indeterminate. Polynomials are represented by a list of coefficients. All non-zero coefficients are listed, but there may be extra '0's at the end.

Usage: Say you have the ring of Integer numbers and you want to add a transcendental element x, that is an element, which does not allow for simplifications. More precisely, for all positive integer exponents n the power x^n cannot be rewritten as a sum of powers with smaller exponents. The element x must be represented by the polynomial [0,1].

In principle, you can have more than one transcendental element by using polynomials whose coefficients are polynomials as well. However, most algorithms on multi-variate polynomials prefer a different (sparse) representation, where the ordering of elements is not so fixed.

If you want division, you need Number.Ratios of polynomials with coefficients from a Algebra.Field.

You can also compute with an algebraic element, that is an element which satisfies an algebraic equation like x^3-x-1==0. Actually, powers of x with exponents above 3 can be simplified, since it holds x^3==x+1. You can perform these computations with Number.ResidueClass of polynomials, where the divisor is the polynomial equation that determines x. If the polynomial is irreducible (in our case x^3-x-1 cannot be written as a non-trivial product) then the residue classes also allow unrestricted division (except by zero, of course). That is, using residue classes of polynomials you can work with roots of polynomial equations without representing them by radicals (powers with fractional exponents). It is well-known, that roots of polynomials of degree above 4 may not be representable by radicals.

Synopsis

Documentation

data T a Source #

Instances
Functor T Source # 
Instance details

Defined in MathObj.Polynomial

Methods

fmap :: (a -> b) -> T a -> T b #

(<$) :: a -> T b -> T a #

C T Source # 
Instance details

Defined in MathObj.Polynomial

Methods

zero :: C a => T a Source #

(<+>) :: C a => T a -> T a -> T a Source #

(*>) :: C a => a -> T a -> T a Source #

C a b => C a (T b) Source # 
Instance details

Defined in MathObj.Polynomial

Methods

(*>) :: a -> T b -> T b Source #

(C a, C a b) => C a (T b) Source # 
Instance details

Defined in MathObj.Polynomial

(Eq a, C a) => Eq (T a) Source # 
Instance details

Defined in MathObj.Polynomial

Methods

(==) :: T a -> T a -> Bool #

(/=) :: T a -> T a -> Bool #

Fractional a => Fractional (T a) Source # 
Instance details

Defined in MathObj.Polynomial

Methods

(/) :: T a -> T a -> T a #

recip :: T a -> T a #

fromRational :: Rational -> T a #

Num a => Num (T a) Source # 
Instance details

Defined in MathObj.Polynomial

Methods

(+) :: T a -> T a -> T a #

(-) :: T a -> T a -> T a #

(*) :: T a -> T a -> T a #

negate :: T a -> T a #

abs :: T a -> T a #

signum :: T a -> T a #

fromInteger :: Integer -> T a #

Show a => Show (T a) Source # 
Instance details

Defined in MathObj.Polynomial

Methods

showsPrec :: Int -> T a -> ShowS #

show :: T a -> String #

showList :: [T a] -> ShowS #

(Arbitrary a, C a) => Arbitrary (T a) Source # 
Instance details

Defined in MathObj.Polynomial

Methods

arbitrary :: Gen (T a) #

shrink :: T a -> [T a] #

(C a, C a) => C (T a) Source # 
Instance details

Defined in MathObj.Polynomial

Methods

compare :: T a -> T a -> Ordering Source #

C a => C (T a) Source # 
Instance details

Defined in MathObj.Polynomial

Methods

zero :: T a Source #

(+) :: T a -> T a -> T a Source #

(-) :: T a -> T a -> T a Source #

negate :: T a -> T a Source #

C a => C (T a) Source # 
Instance details

Defined in MathObj.Polynomial

Methods

isZero :: T a -> Bool Source #

C a => C (T a) Source # 
Instance details

Defined in MathObj.Polynomial

Methods

(*) :: T a -> T a -> T a Source #

one :: T a Source #

fromInteger :: Integer -> T a Source #

(^) :: T a -> Integer -> T a Source #

(C a, C a) => C (T a) Source #

The C instance is intensionally built from the C structure of the polynomial coefficients. If we would use Integral.C a superclass, then the Euclidean algorithm could not determine the greatest common divisor of e.g. [1,1] and [2].

Instance details

Defined in MathObj.Polynomial

Methods

div :: T a -> T a -> T a Source #

mod :: T a -> T a -> T a Source #

divMod :: T a -> T a -> (T a, T a) Source #

(C a, C a) => C (T a) Source # 
Instance details

Defined in MathObj.Polynomial

Methods

isUnit :: T a -> Bool Source #

stdAssociate :: T a -> T a Source #

stdUnit :: T a -> T a Source #

stdUnitInv :: T a -> T a Source #

(C a, C a) => C (T a) Source # 
Instance details

Defined in MathObj.Polynomial

Methods

extendedGCD :: T a -> T a -> (T a, (T a, T a)) Source #

gcd :: T a -> T a -> T a Source #

lcm :: T a -> T a -> T a Source #

C a => C (T a) Source # 
Instance details

Defined in MathObj.Polynomial

Methods

differentiate :: T a -> T a Source #

fromCoeffs :: [a] -> T a Source #

coeffs :: T a -> [a] Source #

degree :: C a => T a -> Maybe Int Source #

showsExpressionPrec :: (Show a, C a, C a) => Int -> String -> T a -> String -> String Source #

const :: a -> T a Source #

evaluate :: C a => T a -> a -> a Source #

evaluateCoeffVector :: C a v => T v -> a -> v Source #

Here the coefficients are vectors, for example the coefficients are real and the coefficents are real vectors.

evaluateArgVector :: (C a v, C v) => T a -> v -> v Source #

Here the argument is a vector, for example the coefficients are complex numbers or square matrices and the coefficents are reals.

collinear :: (Eq a, C a) => T a -> T a -> Bool Source #

integrate :: C a => a -> T a -> T a Source #

compose :: C a => T a -> T a -> T a Source #

compose is the functional composition of polynomials.

It fulfills eval x . eval y == eval (compose x y)

fromRoots :: C a => [a] -> T a Source #

reverse :: C a => T a -> T a Source #

translate :: C a => a -> T a -> T a Source #

dilate :: C a => a -> T a -> T a Source #

shrink :: C a => a -> T a -> T a Source #