Copyright | (c) Henning Thielemann 2004-2006 |
---|---|

Maintainer | numericprelude@henning-thielemann.de |

Stability | provisional |

Portability | requires multi-parameter type classes |

Safe Haskell | None |

Language | Haskell98 |

Polynomials with negative and positive exponents.

## Synopsis

- data T a = Cons {}
- const :: a -> T a
- (!) :: C a => T a -> Int -> a
- fromCoeffs :: [a] -> T a
- fromShiftCoeffs :: Int -> [a] -> T a
- fromPolynomial :: T a -> T a
- fromPowerSeries :: T a -> T a
- bounds :: T a -> (Int, Int)
- shift :: Int -> T a -> T a
- translate :: Int -> T a -> T a
- appPrec :: Int
- add :: C a => T a -> T a -> T a
- series :: C a => [T a] -> T a
- addShiftedMany :: C a => [Int] -> [[a]] -> [a]
- addShifted :: C a => Int -> [a] -> [a] -> [a]
- negate :: C a => T a -> T a
- sub :: C a => T a -> T a -> T a
- mul :: C a => T a -> T a -> T a
- div :: (C a, C a) => T a -> T a -> T a
- divExample :: T Rational
- equivalent :: (Eq a, C a) => T a -> T a -> Bool
- identical :: Eq a => T a -> T a -> Bool
- isAbsolute :: C a => T a -> Bool
- alternate :: C a => T a -> T a
- reverse :: T a -> T a
- adjoint :: C a => T (T a) -> T (T a)

# Documentation

Polynomial including negative exponents

# Basic Operations

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

fromShiftCoeffs :: Int -> [a] -> T a Source #

fromPolynomial :: T a -> T a Source #

fromPowerSeries :: T a -> T a Source #

translate :: Int -> T a -> T a Source #

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

instead

# Show

# Additive

addShiftedMany :: C a => [Int] -> [[a]] -> [a] Source #

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:

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

addShifted :: C a => Int -> [a] -> [a] -> [a] Source #

# Module

# Ring

# Field.C

divExample :: T Rational Source #

# Comparisons

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

Two polynomials may be stored differently.
This function checks whether two values of type `LaurentPolynomial`

actually represent the same polynomial.

isAbsolute :: C a => T a -> Bool Source #

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