Copyright | (c) Matti A. Eskelinen 2016-2017 |
---|---|
License | MIT |
Maintainer | matti.a.eskelinen@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
This module provides the type Clif
for representing the elements of a Clifford algebra along with some standard operations.
See The inner products of geometric algebra by Leo Dorst for a concise explanation of the different inner products.
- data Clif b a
- blade :: (Eq a, Basis b a) => [b] -> a -> Clif b a
- (*:) :: (Eq a, Basis b a) => a -> [b] -> Clif b a
- vec :: (Eq a, Basis b a) => b -> a -> Clif b a
- fromList :: (Eq a, Basis b a) => [([b], a)] -> Clif b a
- grade :: (Eq a, Basis b a) => Int -> Clif b a -> Clif b a
- rev :: Ord b => Clif b a -> Clif b a
- wedge :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a
- (/\) :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a
- (<\) :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a
- (/>) :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a
- (.|.) :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a
- (<.>) :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a
- lContract :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a
- rContract :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a
- scalarProd :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a
- dot :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a
- hestenes :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a
- hodge :: (Eq a, Basis b a) => [b] -> Clif b a -> Clif b a
- proj :: (Eq a, Basis b a, Fractional a) => Clif b a -> Clif b a -> Clif b a
The Clif
type
A data type representing a Clif (multivector) composed of direct sum of scaled blades
Functor (Clif b) Source # | |
(Eq b, Eq a, Basis b a) => Eq (Clif b a) Source # | The Eq instance calculates the canonical forms of the compared Clifs before comparison. |
(Eq a, Basis b a, Fractional a) => Fractional (Clif b a) Source # | Inverse elements only exist for Clifs c for which c times c is scalar. For others, recip does not terminate. |
(Eq a, Basis b a) => Num (Clif b a) Source # | Note that abs and signum are only well-defined on the scalar component of each Clif, and zero otherwise. |
(Show b, Show a) => Show (Clif b a) Source # | |
Constructing and deconstructing Clifs
fromList :: (Eq a, Basis b a) => [([b], a)] -> Clif b a Source #
Constructs a Clif
from a list of blades and their multipliers in canonical form.
>>>
fromList [([], 42), ([E 1, E 2], 1)]
42 *: [] + 1 *: [E 1,E 2]
Geometric algebra operations
grade :: (Eq a, Basis b a) => Int -> Clif b a -> Clif b a Source #
Grade projection on the given grade. For negative values, returns zero.
Note that this always calculates the canonical form of a Clif before projecting it.
rev :: Ord b => Clif b a -> Clif b a Source #
Reverse of a Clif
, i.e. the reverse of all its component blades.
Outer product
(/\) :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a infixl 8 Source #
Infix synonym for wedge
Inner products
(<\) :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a infixl 8 Source #
Infix synonym for lContract
(/>) :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a infixl 8 Source #
Infix synonym for rContract
(.|.) :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a infixl 8 Source #
Infix synonym for scalarProd
(<.>) :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a infixl 8 Source #
Infix synonym for dot
scalarProd :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a Source #
Scalar product (0-grade components of the blade products)
Hodge duality
hodge :: (Eq a, Basis b a) => [b] -> Clif b a -> Clif b a Source #
Hodge dual of a Clif
in a Clifford algebra specified by a given pseudoscalar (volume element):
hodge (E <$> "abc") $ blade [E 'b'] 1 == blade (E <$> "ac") 1