Copyright | (c) Alberto Ruiz 2009 |
---|---|

License | BSD3 |

Maintainer | Alberto Ruiz |

Stability | experimental |

Safe Haskell | None |

Language | Haskell98 |

A simple implementation of Geometric Algebra.

The Num instance provides the geometric product, and the Fractional instance provides the inverse of multivectors.

This module provides a simple Euclidean embedding.

- data Multivector
- coords :: Multivector -> [(Double, [Int])]
- scalar :: Double -> Multivector
- vector :: [Double] -> Multivector
- e :: Int -> Multivector
- (/\) :: Multivector -> Multivector -> Multivector
- (-|) :: Multivector -> Multivector -> Multivector
- (\/) :: Multivector -> Multivector -> Multivector
- rever :: Multivector -> Multivector
- full :: Int -> Multivector
- rotor :: Int -> Double -> Multivector -> Multivector
- apply :: (Int -> Multivector) -> Multivector -> Multivector
- grade :: Int -> Multivector -> Multivector
- maxGrade :: Multivector -> Int
- maxDim :: Multivector -> Int
- fromTensor :: Tensor Double -> Multivector

# Documentation

data Multivector Source

coords :: Multivector -> [(Double, [Int])] Source

scalar :: Double -> Multivector Source

Creates a scalar multivector.

vector :: [Double] -> Multivector Source

Creates a grade 1 multivector of from a list of coordinates.

e :: Int -> Multivector Source

The k-th basis element.

(/\) :: Multivector -> Multivector -> Multivector infixl 7 Source

The exterior (outer) product.

(-|) :: Multivector -> Multivector -> Multivector infixl 7 Source

The contractive inner product.

(\/) :: Multivector -> Multivector -> Multivector infixl 7 Source

Intersection of subspaces.

rever :: Multivector -> Multivector Source

The reversion operator.

full :: Int -> Multivector Source

The full space of the given dimension. This is the leviCivita simbol, and the basis of the pseudoscalar.

:: Int | dimension of the space |

-> Double | angle |

-> Multivector | axis |

-> Multivector | result |

The rotor operator, used in a sandwich product.

apply :: (Int -> Multivector) -> Multivector -> Multivector Source

Apply a linear transformation, expressed as the image of the element i-th of the basis.

(This is a monadic bind!)

grade :: Int -> Multivector -> Multivector Source

maxGrade :: Multivector -> Int Source

maxDim :: Multivector -> Int Source

fromTensor :: Tensor Double -> Multivector Source

Extract a multivector representation from a full antisymmetric tensor.

(We do not check that the tensor is actually antisymmetric.)