HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulenumeric-prelude-0.4.4Haskell98

MathObj.LaurentPolynomial

Polynomials with negative and positive exponents.

  • 1 type
  • 25 values
datadata T a
#

Polynomial including negative exponents

Constructors

Instances9Functor, Eq, Show, C, …
  • Functor TDefined in numeric-prelude-0.4.4 · MathObj.LaurentPolynomial
  • C TDefined in numeric-prelude-0.4.4 · MathObj.LaurentPolynomial
  • (C a, C a b) => C a (T b)Defined in numeric-prelude-0.4.4 · MathObj.LaurentPolynomial
  • C a b => C a (T b)Defined in numeric-prelude-0.4.4 · MathObj.LaurentPolynomial
  • (Eq a, C a) => Eq (T a)Defined in numeric-prelude-0.4.4 · MathObj.LaurentPolynomial
  • Show a => Show (T a)Defined in numeric-prelude-0.4.4 · MathObj.LaurentPolynomial
  • C a => C (T a)Defined in numeric-prelude-0.4.4 · MathObj.LaurentPolynomial
  • C a => C (T a)Defined in numeric-prelude-0.4.4 · MathObj.LaurentPolynomial
  • (C a, C a) => C (T a)Defined in numeric-prelude-0.4.4 · MathObj.LaurentPolynomial

Basic Operations

9 declarations
value(!) :: C a => T a -> Int -> a
#
valuetranslate :: Int -> T a -> T a
#

Deprecated. In order to avoid confusion with Polynomial.translate, use shift instead

Show

1 declaration

Additive

6 declarations
valueadd :: C a => T a -> T a -> T a
#
valueaddShiftedMany :: C a => [Int] -> [[a]] -> [a]
#

Add lists of numbers respecting a relative shift between the starts of the lists. The shifts must be non-negative. The list of relative shifts is one element shorter than the list of summands. Infinitely many summands are permitted, provided that runs of zero shifts are all finite.

We could add the lists either with foldl or with foldr, foldl would be straightforward, but more time consuming (quadratic time) whereas foldr is not so obvious but needs only linear time.

(stars denote the coefficients, frames denote what is contained in the interim results) foldl sums this way:

| | | *******************************
| | +--------------------------------
| |          ************************
| +----------------------------------
|                        ************
+------------------------------------

I.e. foldl would use much time find the time differences by successive subtraction 1.

foldr mixes this way:

    +--------------------------------
    | *******************************
    |      +-------------------------
    |      | ************************
    |      |           +-------------
    |      |           | ************
valuesub :: C a => T a -> T a -> T a
#

Module

0 declarations

Ring

1 declaration
valuemul :: C a => T a -> T a -> T a
#

Field.C

2 declarations
valuediv :: (C a, C a) => T a -> T a -> T a
#

Comparisons

3 declarations
valueequivalent :: (Eq a, C a) => T a -> T a -> Bool
#

Two polynomials may be stored differently. This function checks whether two values of type LaurentPolynomial actually represent the same polynomial.

valueisAbsolute :: C a => T a -> Bool
#

Check whether a Laurent polynomial has only the absolute term, that is, it represents the constant polynomial.

Transformations of arguments

3 declarations
valueadjoint :: C a => T (T a) -> T (T a)
#

p(exp(i·x)) -> conjugate(p(exp(i·x)))

If you interpret (p*) as a linear operator on the space of Laurent polynomials, then (adjoint p *) is the adjoint operator.