Safe Haskell | None |
---|---|
Language | Haskell2010 |
Multivariate polynomials where the variable set
looks like {x_1, x_2, ... , x_N}
Synopsis
- newtype Poly (coeff :: *) (var :: Symbol) (n :: Nat) = Poly (FreeMod coeff (XS var n))
- unPoly :: Poly c v n -> FreeMod c (XS v n)
- polyVar :: KnownSymbol var => Poly c var n -> String
- nOfPoly :: KnownNat n => Poly c var n -> Int
- renamePolyVar :: Poly c var1 n -> Poly c var2 n
- type ZPoly = Poly Integer
- type QPoly = Poly Rational
- fromZPoly :: (Ring c, KnownSymbol v, KnownNat n) => Poly Integer v n -> Poly c v n
- fromQPoly :: (Field c, KnownSymbol v, KnownNat n) => Poly Rational v n -> Poly c v n
- embed :: (Ring c, KnownNat n, KnownNat m) => Poly c v n -> Poly c v m
- newtype XS (var :: Symbol) (n :: Nat) = XS (UArray Int Int)
Documentation
newtype Poly (coeff :: *) (var :: Symbol) (n :: Nat) Source #
A multivariate polynomial in with a given coefficient ring.
It is also indexed by the (shared) name of the variables and the number of
variable. For example Polyn Rational "x" 3
the type of polynomials in the
variables x1, x2, x3
with rational coefficients.
Instances
renamePolyVar :: Poly c var1 n -> Poly c var2 n Source #
fromZPoly :: (Ring c, KnownSymbol v, KnownNat n) => Poly Integer v n -> Poly c v n Source #
Change the coefficient ring (from integers)
fromQPoly :: (Field c, KnownSymbol v, KnownNat n) => Poly Rational v n -> Poly c v n Source #
Change the coefficient field (from rationals)
embed :: (Ring c, KnownNat n, KnownNat m) => Poly c v n -> Poly c v m Source #
You can always increase the number of variables; you can also decrease, if don't use the last few ones.
This will throw an error if you try to eliminate variables which are in fact used. To do that, you can instead substitute 0 or 1 into them.
newtype XS (var :: Symbol) (n :: Nat) Source #
Monomials of the variables x1,x2,...,xn
. The internal representation is the
dense array of exponents: x1^e1*x2^e2*...*xn^en
is represented by [e1,e2,...,en]
.
The type is indexed by the name of the variables, and then the number of variables.
Note that we require here that the array has bounds (1,n)