Copyright | (c) Ross Paterson 2021 |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | [email protected] |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Data.YAP.PowerSeries.General
Description
An example instance of the algebraic classes: formal power series generalized to arbitrary exponents.
Synopsis
- data PowerSeries i a
- term :: (Eq a, AdditiveMonoid a) => i -> a -> PowerSeries i a
- constant :: (AdditiveMonoid i, Eq a, AdditiveMonoid a) => a -> PowerSeries i a
- identity :: (Semiring i, Semiring a) => PowerSeries i a
- fromTerms :: (Eq a, AdditiveMonoid a) => [(i, a)] -> PowerSeries i a
- fromCoefficients :: (Semiring i, Eq a, AdditiveMonoid a) => [a] -> PowerSeries i a
- order :: (Eq a, AdditiveMonoid a) => PowerSeries i a -> i
- terms :: (Eq a, AdditiveMonoid a) => PowerSeries i a -> [(i, a)]
- type LaurentSeries = PowerSeries Integer
- laurentSeries :: (Eq a, AdditiveMonoid a) => Integer -> [a] -> LaurentSeries a
- type LeviCivitaField = PowerSeries Rational
General power series
data PowerSeries i a Source #
A formal series of the form
\[ \sum_{e \in I} a_e x^e \]
such that the set of indices \(e\) for which \(a_e\) is non-zero is left-finite: for any \(i\), the set of indices \(e < i\) for which \(a_e\) is non-zero is finite.
Addition of indices is required to preserve the ordering.
Instances
Construction
term :: (Eq a, AdditiveMonoid a) => i -> a -> PowerSeries i a Source #
is a series consisting of the term \(a x^i\).term
i a
term i a * term j b = term (i+j) (a*b)
constant :: (AdditiveMonoid i, Eq a, AdditiveMonoid a) => a -> PowerSeries i a Source #
Power series representing a constant value \(c\)
constant a = term 0 a
identity :: (Semiring i, Semiring a) => PowerSeries i a Source #
Identity function, i.e. the indeterminate \(x\)
identity = term 1 1
fromTerms :: (Eq a, AdditiveMonoid a) => [(i, a)] -> PowerSeries i a Source #
Construct a power series from a list in ascending order of index
fromTerms ts = sum [term i a | (i, a) <- ts]
fromCoefficients :: (Semiring i, Eq a, AdditiveMonoid a) => [a] -> PowerSeries i a Source #
Power series formed from a list of coefficients of indices 0, 1, ... If the list is finite, the remaining coefficients are zero.
Queries
order :: (Eq a, AdditiveMonoid a) => PowerSeries i a -> i Source #
The smallest exponent with a non-zero coefficient (undefined on zero
)
terms :: (Eq a, AdditiveMonoid a) => PowerSeries i a -> [(i, a)] Source #
Indices with non-zero coefficients, in ascending order
Special cases
type LaurentSeries = PowerSeries Integer Source #
A formal power series with integer indices, of which finitely many are negative.
laurentSeries :: (Eq a, AdditiveMonoid a) => Integer -> [a] -> LaurentSeries a Source #
A Laurent series with coefficients starting from the given index
type LeviCivitaField = PowerSeries Rational Source #
The Levi-Civita field.