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

Safe HaskellNone
LanguageHaskell98

Math.Algebras.Quaternions

Description

A module defining the algebra of quaternions over an arbitrary field.

The quaternions are the algebra defined by the basis {1,i,j,k}, where i^2 = j^2 = k^2 = ijk = -1

Synopsis

Documentation

data HBasis Source

Constructors

One 
I 
J 
K 

Instances

Eq HBasis 
Ord HBasis 
Show HBasis 
(Eq k, Num k) => Algebra k HBasis 
(Eq k, Num k) => HasConjugation k HBasis 
(Eq k, Num k) => Coalgebra k (Dual HBasis) 

i :: Num k => Quaternion k Source

The quaternions have {1,i,j,k} as basis, where i^2 = j^2 = k^2 = ijk = -1.

k :: Num k => Quaternion k Source

The quaternions have {1,i,j,k} as basis, where i^2 = j^2 = k^2 = ijk = -1.

j :: Num k => Quaternion k Source

The quaternions have {1,i,j,k} as basis, where i^2 = j^2 = k^2 = ijk = -1.

class Algebra k a => HasConjugation k a where Source

Methods

conj :: Vect k a -> Vect k a Source

A conjugation operation is required to satisfy the following laws:

  • conj (x+y) = conj x + conj y
  • conj (x*y) = conj y * conj x (note the order-reversal)
  • conj (conj x) = x
  • conj x = x if and only if x in k

sqnorm :: Vect k a -> k Source

The squared norm is defined as sqnorm x = x * conj x. It satisfies:

  • sqnorm (x*y) = sqnorm x * sqnorm y
  • sqnorm (unit k) = k^2, for k a scalar

Instances

(Eq k, Num k) => HasConjugation k HBasis 
(Eq k, Num k) => HasConjugation k OBasis 

scalarPart :: Num k => Quaternion k -> k Source

The scalar part of the quaternion w+xi+yj+zk is w. Also called the real part.

vectorPart :: (Eq k, Num k) => Quaternion k -> Quaternion k Source

The vector part of the quaternion w+xi+yj+zk is xi+yj+zk. Also called the pure part.

(<.>) :: (Num k, Eq k) => Vect k HBasis -> Quaternion k -> k Source

(^-) :: (Num a, Fractional a1, Eq a) => a1 -> a -> a1 Source

refl :: (HasConjugation k a, Show a, Ord a, Num k, Eq k) => Vect k a -> Vect k a -> Vect k a Source

asMatrix :: (Num t, Eq t) => (Vect t HBasis -> Quaternion t) -> [Vect t HBasis] -> [[t]] Source

reprSO3' :: Fractional a => a -> a -> a Source

reprSO3 :: (Eq k, Fractional k) => Quaternion k -> [[k]] Source

Given a non-zero quaternion q in H, the map x -> q^-1 * x * q defines an action on the 3-dimensional vector space of pure quaternions X (ie linear combinations of i,j,k). It turns out that this action is a rotation of X, and this is a surjective group homomorphism from H* onto SO3. If we restrict q to the group of unit quaternions (those of norm 1), then this homomorphism is 2-to-1 (since q and -q give the same rotation). This shows that the multiplicative group of unit quaternions is isomorphic to Spin3, the double cover of SO3.

reprSO3 q returns the 3*3 matrix representing this map.

reprSO4' :: Fractional a => (a, a) -> a -> a Source

reprSO4 :: (Eq k, Fractional k) => (Quaternion k, Quaternion k) -> [[k]] Source

Given a pair of unit quaternions (l,r), the map x -> l^-1 * x * r defines an action on the 4-dimensional space of quaternions. It turns out that this action is a rotation, and this is a surjective group homomorphism onto SO4. The homomorphism is 2-to-1 (since (l,r) and (-l,-r) give the same map). This shows that the multiplicative group of pairs of unit quaternions (with pointwise multiplication) is isomorphic to Spin4, the double cover of SO4.

reprSO4 (l,r) returns the 4*4 matrix representing this map.

reprSO4d :: (Fractional k, Eq k) => Vect k (DSum HBasis HBasis) -> [[k]] Source

k' :: Num k => Vect k (Dual HBasis) Source

j' :: Num k => Vect k (Dual HBasis) Source

i' :: Num k => Vect k (Dual HBasis) Source