HaskellForMaths-0.4.9: Combinatorics, group theory, commutative algebra, non-commutative algebra

Safe HaskellSafe
LanguageHaskell98

Math.Algebras.VectorSpace

Description

A module defining the type and operations of free k-vector spaces over a basis b (for a field k)

Synopsis

Documentation

newtype Vect k b Source #

Given a field type k and a basis type b, Vect k b is the type of the free k-vector space over b. Elements (values) of Vect k b consist of k-linear combinations of elements (values) of b.

In order for Vect k b to be a vector space, it is necessary that k is a field (that is, an instance of Fractional). In practice, we often relax this condition, and require that k is a ring (that is, an instance of Num). In that case, Vect k b should more correctly be called (the type of) the free k-module over b.

Most of the code requires that b is an instance of Ord. This is primarily to enable us to simplify to a normal form.

Constructors

V [(b, k)] 
Instances
Fractional QNF Source # 
Instance details

Defined in Math.NumberTheory.QuadraticField

Methods

(/) :: QNF -> QNF -> QNF #

recip :: QNF -> QNF #

fromRational :: Rational -> QNF #

(Eq k, Fractional k) => Fractional (LaurentPoly k) Source # 
Instance details

Defined in Math.Algebras.LaurentPoly

Num k => Monad (Vect k) Source #

Given a field k, the type constructor (Vect k) is a monad, the "free k-vector space monad".

In order to understand this, it is probably easiest to think of a free k-vector space as a kind of container, a bit like a list, except that order doesn't matter, and you're allowed arbitrary (even negative or fractional) quantities of the basis elements in the container.

According to this way of thinking, return is the function that puts a basis element into the vector space (container).

Given a function f from the basis of one vector space to another vector space (a -> Vect k b), bind (>>=) lifts it to a function (>>= f) from the first vector space to the second (Vect k a -> Vect k b).

Note that in general (>>= f) applied to a vector will not return a result in normal form, so it is usually preferable to use (linear f) instead.

Instance details

Defined in Math.Algebras.VectorSpace

Methods

(>>=) :: Vect k a -> (a -> Vect k b) -> Vect k b #

(>>) :: Vect k a -> Vect k b -> Vect k b #

return :: a -> Vect k a #

fail :: String -> Vect k a #

Functor (Vect k) Source #

Given a field k, (Vect k) is a functor, the "free k-vector space" functor.

In the mathematical sense, this can be regarded as a functor from the category Set (of sets) to the category k-Vect (of k-vector spaces). In Haskell, instead of Set we have Hask, the category of Haskell types. However, for our purposes it is helpful to identify Hask with Set, by identifying a Haskell type with its set of inhabitants.

The type constructor (Vect k) gives the action of the functor on objects in the category, taking a set (type) to a free k-vector space. fmap gives the action of the functor on arrows in the category, taking a function between sets (types) to a linear map between vector spaces.

Note that if f is not order-preserving, then (fmap f) is not guaranteed to return results in normal form, so it may be preferable to use (nf . fmap f).

Instance details

Defined in Math.Algebras.VectorSpace

Methods

fmap :: (a -> b) -> Vect k a -> Vect k b #

(<$) :: a -> Vect k b -> Vect k a #

Num k => Applicative (Vect k) Source # 
Instance details

Defined in Math.Algebras.VectorSpace

Methods

pure :: a -> Vect k a #

(<*>) :: Vect k (a -> b) -> Vect k a -> Vect k b #

liftA2 :: (a -> b -> c) -> Vect k a -> Vect k b -> Vect k c #

(*>) :: Vect k a -> Vect k b -> Vect k b #

(<*) :: Vect k a -> Vect k b -> Vect k a #

HasInverses (GroupAlgebra Q) Source #

Note that the inverse of a group algebra element can only be efficiently calculated if the group generated by the non-zero terms is very small (eg <100 elements).

Instance details

Defined in Math.Algebras.GroupAlgebra

HopfAlgebra (LaurentPoly Q) (SL2q String) Source # 
Instance details

Defined in Math.QuantumAlgebra.QuantumPlane

Bialgebra (LaurentPoly Q) (SL2q String) Source # 
Instance details

Defined in Math.QuantumAlgebra.QuantumPlane

Bialgebra (LaurentPoly Q) (M2q String) Source # 
Instance details

Defined in Math.QuantumAlgebra.QuantumPlane

Coalgebra (LaurentPoly Q) (SL2q String) Source # 
Instance details

Defined in Math.QuantumAlgebra.QuantumPlane

Coalgebra (LaurentPoly Q) (M2q String) Source # 
Instance details

Defined in Math.QuantumAlgebra.QuantumPlane

Algebra (LaurentPoly Q) (SL2q String) Source # 
Instance details

Defined in Math.QuantumAlgebra.QuantumPlane

Algebra (LaurentPoly Q) (M2q String) Source # 
Instance details

Defined in Math.QuantumAlgebra.QuantumPlane

Algebra (LaurentPoly Q) (Aq02 String) Source # 
Instance details

Defined in Math.QuantumAlgebra.QuantumPlane

Algebra (LaurentPoly Q) (Aq20 String) Source # 
Instance details

Defined in Math.QuantumAlgebra.QuantumPlane

Comodule (LaurentPoly Q) (M2q String) (Aq20 String) Source # 
Instance details

Defined in Math.QuantumAlgebra.QuantumPlane

(Eq b, Eq k) => Eq (Vect k b) Source # 
Instance details

Defined in Math.Algebras.VectorSpace

Methods

(==) :: Vect k b -> Vect k b -> Bool #

(/=) :: Vect k b -> Vect k b -> Bool #

(Eq k, Fractional k, Ord a, Show a, HasConjugation k a) => Fractional (Vect k a) Source #

If an algebra has a conjugation operation, then it has multiplicative inverses, via 1/x = conj x / sqnorm x

Instance details

Defined in Math.Algebras.Quaternions

Methods

(/) :: Vect k a -> Vect k a -> Vect k a #

recip :: Vect k a -> Vect k a #

fromRational :: Rational -> Vect k a #

(Eq k, Fractional k, Monomial m, Ord m, Algebra k m) => Fractional (Vect k m) Source #

As a convenience, a partial instance of Fractional is defined for polynomials. The instance is well-defined only for scalars, and gives an error if used on other values. The purpose of this is to allow entry of fractional scalars, in expressions such as x/2. On the other hand, an expression such as 2/x will return an error.

Instance details

Defined in Math.CommutativeAlgebra.Polynomial

Methods

(/) :: Vect k m -> Vect k m -> Vect k m #

recip :: Vect k m -> Vect k m #

fromRational :: Rational -> Vect k m #

(Eq k, Num k, Eq b, Ord b, Show b, Algebra k b) => Num (Vect k b) Source # 
Instance details

Defined in Math.Algebras.Structures

Methods

(+) :: Vect k b -> Vect k b -> Vect k b #

(-) :: Vect k b -> Vect k b -> Vect k b #

(*) :: Vect k b -> Vect k b -> Vect k b #

negate :: Vect k b -> Vect k b #

abs :: Vect k b -> Vect k b #

signum :: Vect k b -> Vect k b #

fromInteger :: Integer -> Vect k b #

(Ord b, Ord k) => Ord (Vect k b) Source # 
Instance details

Defined in Math.Algebras.VectorSpace

Methods

compare :: Vect k b -> Vect k b -> Ordering #

(<) :: Vect k b -> Vect k b -> Bool #

(<=) :: Vect k b -> Vect k b -> Bool #

(>) :: Vect k b -> Vect k b -> Bool #

(>=) :: Vect k b -> Vect k b -> Bool #

max :: Vect k b -> Vect k b -> Vect k b #

min :: Vect k b -> Vect k b -> Vect k b #

(Show k, Eq k, Num k, Show b) => Show (Vect k b) Source # 
Instance details

Defined in Math.Algebras.VectorSpace

Methods

showsPrec :: Int -> Vect k b -> ShowS #

show :: Vect k b -> String #

showList :: [Vect k b] -> ShowS #

(Eq k, Fractional k, Ord a, Show a) => HasInverses (Vect k (Interval a)) Source # 
Instance details

Defined in Math.Combinatorics.IncidenceAlgebra

Methods

inverse :: Vect k (Interval a) -> Vect k (Interval a) Source #

coeff :: (Num k, Eq b) => b -> Vect k b -> k Source #

Return the coefficient of the specified basis element in a vector

removeTerm :: (Eq k, Num k, Ord b) => b -> Vect k b -> Vect k b Source #

Remove the term for a specified basis element from a vector

zerov :: Vect k b Source #

The zero vector

add :: (Eq k, Num k, Ord b) => Vect k b -> Vect k b -> Vect k b Source #

Addition of vectors

(<+>) :: (Eq k, Num k, Ord b) => Vect k b -> Vect k b -> Vect k b infixl 6 Source #

Addition of vectors (same as add)

sumv :: (Eq k, Num k, Ord b) => [Vect k b] -> Vect k b Source #

Sum of a list of vectors

negatev :: (Eq k, Num k) => Vect k b -> Vect k b Source #

Negation of a vector

(<->) :: (Eq k, Num k, Ord b) => Vect k b -> Vect k b -> Vect k b infixl 6 Source #

Subtraction of vectors

smultL :: (Eq k, Num k) => k -> Vect k b -> Vect k b Source #

Scalar multiplication (on the left)

(*>) :: (Eq k, Num k) => k -> Vect k b -> Vect k b infixr 7 Source #

Same as smultL. Mnemonic is "multiply through (from the left)"

smultR :: (Eq k, Num k) => Vect k b -> k -> Vect k b Source #

Scalar multiplication on the right

(<*) :: (Eq k, Num k) => Vect k b -> k -> Vect k b infixl 7 Source #

Same as smultR. Mnemonic is "multiply through (from the right)"

nf :: (Eq k, Num k, Ord b) => Vect k b -> Vect k b Source #

Convert an element of Vect k b into normal form. Normal form consists in having the basis elements in ascending order, with no duplicates, and all coefficients non-zero

linear :: (Eq k, Num k, Ord b) => (a -> Vect k b) -> Vect k a -> Vect k b Source #

A linear map between vector spaces A and B can be defined by giving its action on the basis elements of A. The action on all elements of A then follows by linearity.

If we have A = Vect k a, B = Vect k b, and f :: a -> Vect k b is a function from the basis elements of A into B, then linear f is the linear map that this defines by linearity.

type Trivial k = Vect k () Source #

Trivial k is the field k considered as a k-vector space. In maths, we would not normally make a distinction here, but in the code, we need this if we want to be able to put k as one side of a tensor product.

wrap :: (Eq k, Num k) => k -> Vect k () Source #

Wrap an element of the field k to an element of the trivial k-vector space

unwrap :: Num k => Vect k () -> k Source #

Unwrap an element of the trivial k-vector space to an element of the field k

newtype Dual b Source #

Given a finite vector space basis b, Dual b can be used to represent a basis for the dual vector space. The intention is that for a given individual basis element b_i, (Dual b_i) represents the indicator function for b_i, which takes b_i to 1 and all other basis elements to 0.

(Note that if the basis b is infinite, then Dual b may only represent a sub-basis of the dual vector space.)

Constructors

Dual b 
Instances
(Eq k, Num k) => HasPairing k SSymF (Dual SSymF) Source # 
Instance details

Defined in Math.Combinatorics.CombinatorialHopfAlgebra

Methods

pairing :: Vect k (Tensor SSymF (Dual SSymF)) -> Vect k () Source #

(Eq k, Num k) => HopfAlgebra k (Dual SSymF) Source # 
Instance details

Defined in Math.Combinatorics.CombinatorialHopfAlgebra

Methods

antipode :: Vect k (Dual SSymF) -> Vect k (Dual SSymF) Source #

(Eq k, Num k) => Bialgebra k (Dual SSymF) Source # 
Instance details

Defined in Math.Combinatorics.CombinatorialHopfAlgebra

(Eq k, Num k) => Coalgebra k (Dual HBasis) Source # 
Instance details

Defined in Math.Algebras.Quaternions

(Eq k, Num k) => Coalgebra k (Dual SSymF) Source # 
Instance details

Defined in Math.Combinatorics.CombinatorialHopfAlgebra

(Eq k, Num k) => Algebra k (Dual SSymF) Source # 
Instance details

Defined in Math.Combinatorics.CombinatorialHopfAlgebra

Methods

unit :: k -> Vect k (Dual SSymF) Source #

mult :: Vect k (Tensor (Dual SSymF) (Dual SSymF)) -> Vect k (Dual SSymF) Source #

Eq b => Eq (Dual b) Source # 
Instance details

Defined in Math.Algebras.VectorSpace

Methods

(==) :: Dual b -> Dual b -> Bool #

(/=) :: Dual b -> Dual b -> Bool #

Ord b => Ord (Dual b) Source # 
Instance details

Defined in Math.Algebras.VectorSpace

Methods

compare :: Dual b -> Dual b -> Ordering #

(<) :: Dual b -> Dual b -> Bool #

(<=) :: Dual b -> Dual b -> Bool #

(>) :: Dual b -> Dual b -> Bool #

(>=) :: Dual b -> Dual b -> Bool #

max :: Dual b -> Dual b -> Dual b #

min :: Dual b -> Dual b -> Dual b #

Show basis => Show (Dual basis) Source # 
Instance details

Defined in Math.Algebras.VectorSpace

Methods

showsPrec :: Int -> Dual basis -> ShowS #

show :: Dual basis -> String #

showList :: [Dual basis] -> ShowS #

Graded b => Graded (Dual b) Source # 
Instance details

Defined in Math.Combinatorics.CombinatorialHopfAlgebra

Methods

grade :: Dual b -> Int Source #