- data Polynomial coefficient exponent
- zero :: Polynomial c e
- one :: (Num c, Num e) => Polynomial c e
- evaluate :: (Num n, Integral e) => n -> Polynomial n e -> n
- getDegree :: Num e => Polynomial c e -> e
- getLeadingTerm :: Polynomial c e -> Monomial c e
- lift :: (MonomialList c1 e1 -> MonomialList c2 e2) -> Polynomial c1 e1 -> Polynomial c2 e2
- mod' :: Integral c => Polynomial c e -> c -> Polynomial c e
- normalise :: (Num c, Ord e) => Polynomial c e -> Polynomial c e
- raiseModulo :: (Integral c, Integral power, Num e, Ord e) => Polynomial c e -> power -> c -> Polynomial c e
- realCoefficientsToFrac :: (Real r, Fractional f) => Polynomial r e -> Polynomial f e
- terms :: Polynomial c e -> Int
- mkConstant :: (Num c, Num e) => c -> Polynomial c e
- mkLinear :: (Num c, Num e) => c -> c -> Polynomial c e
- mkPolynomial :: (Num c, Ord e) => MonomialList c e -> Polynomial c e
- (*=) :: (Num c, Num e) => Polynomial c e -> Monomial c e -> Polynomial c e
- areCongruentModulo :: (Integral c, Num e, Ord e) => Polynomial c e -> Polynomial c e -> c -> Bool
- inAscendingOrder :: Ord e => Polynomial c e -> Bool
- inDescendingOrder :: Ord e => Polynomial c e -> Bool
- isMonic :: Num c => Polynomial c e -> Bool
- isMonomial :: Polynomial c e -> Bool
- isNormalised :: (Num c, Ord e) => Polynomial c e -> Bool
- isPolynomial :: Integral e => Polynomial c e -> Bool
- isZero :: Polynomial c e -> Bool
- The type of an arbitrary univariate polynomial;
actually it's more general, since it permits negative powers (http://en.wikipedia.org/wiki/Laurent_polynomials).
It can't describe multivariate polynomials, which would require a list of exponents.
Rather than requiring the exponent to implement the type-class
Integral, this is implemented at the function-level, as required.
- The structure permits gaps between exponents, in which coefficients are inferred to be zero, thus enabling efficient representation of sparse polynomials.
- CAVEAT: the
MonomialListis required to; be ordered by descending exponent (ie. reverse http://en.wikipedia.org/wiki/Monomial_order); have had zero coefficients removed; and to have had like terms merged; so the raw data-constructor isn't exported.
|(Eq coefficient, Eq exponent) => Eq (Polynomial coefficient exponent)|
|(Show coefficient, Show exponent) => Show (Polynomial coefficient exponent)|
|(Num c, Num e, Ord e) => Ring (Polynomial c e)|
|(Fractional c, Num e, Ord e) => QuotientRing (Polynomial c e)|
Defines the ability to divide polynomials.
Constructs a constant monomial, independent of the indeterminate.
- Evaluate the polynomial at a specific indeterminate.
- CAVEAT: requires positive exponents; but it wouldn't really be a polynomial otherwise.
- If the polynomial is very sparse, this may be inefficient, since it memoizes the complete sequence of powers up to the polynomial's degree.
- Return the degree (AKA order) of the polynomial.
- Transforms the data behind the constructor.
- CAVEAT: similar to
Polynomialisn't an instance of
Data.Functor.Functorsince we may want to operate on both type-parameters.
- CAVEAT: the caller is required to re-
normalisethe resulting polynomial depending on the nature of the transformation of the data.
Reduces all the coefficients using modular arithmetic.
Sorts into descending order of exponents, groups like exponents, and calls
|:: (Integral c, Integral power, Num e, Ord e)|
|=> Polynomial c e|
The exponent to which the base should be raised.
|-> Polynomial c e|
- Raise a polynomial to the specified positive integral power, but using modulo-arithmetic.
- Whilst one could naively implement this as
(x Data.Ring.=^ n), this will result in arithmetic operatons on unnecessarily big integers.
Convert the type of the coefficients.
Constructs an arbitrary zeroeth-degree polynomial, ie. independent of the indeterminate.
Constructs an arbitrary first-degree polynomial.
Constructs an arbitrary polynomial.
- Scale-up the specified polynomial by a constant monomial factor.
Trueif the two specified polynomials are congruent in modulo-arithmetic.
True if the exponents of successive terms are in ascending order.
True if the exponents of successive terms are in descending order.
Trueif the leading coefficient is one.
True if no term has a coefficient of zero and the exponents of successive terms are in descending order.
True if all exponents are positive integers as required.