HaskellForMaths-0.4.9: 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

Instances details
Eq HBasis Source # 
Instance details

Defined in Math.Algebras.Quaternions

Methods

(==) :: HBasis -> HBasis -> Bool

(/=) :: HBasis -> HBasis -> Bool

Ord HBasis Source # 
Instance details

Defined in Math.Algebras.Quaternions

Methods

compare :: HBasis -> HBasis -> Ordering

(<) :: HBasis -> HBasis -> Bool

(<=) :: HBasis -> HBasis -> Bool

(>) :: HBasis -> HBasis -> Bool

(>=) :: HBasis -> HBasis -> Bool

max :: HBasis -> HBasis -> HBasis

min :: HBasis -> HBasis -> HBasis

Show HBasis Source # 
Instance details

Defined in Math.Algebras.Quaternions

Methods

showsPrec :: Int -> HBasis -> ShowS

show :: HBasis -> String

showList :: [HBasis] -> ShowS

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

Defined in Math.Algebras.Quaternions

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

Defined in Math.Algebras.Quaternions

Methods

conj :: Vect k HBasis -> Vect k HBasis Source #

sqnorm :: Vect k HBasis -> k Source #

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

Defined in Math.Algebras.Quaternions

i :: 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.

k :: 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

Instances details
(Eq k, Num k) => HasConjugation k HBasis Source # 
Instance details

Defined in Math.Algebras.Quaternions

Methods

conj :: Vect k HBasis -> Vect k HBasis Source #

sqnorm :: Vect k HBasis -> k Source #

(Eq k, Num k) => HasConjugation k OBasis Source # 
Instance details

Defined in Math.Algebras.Octonions

Methods

conj :: Vect k OBasis -> Vect k OBasis Source #

sqnorm :: Vect k OBasis -> k Source #

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 -> Vect k HBasis -> k Source #

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

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

asMatrix :: (Num a, Eq a) => (Vect a HBasis -> Vect a HBasis) -> [Vect a HBasis] -> [[a]] 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 :: (Eq k, Fractional k) => Vect k (DSum HBasis HBasis) -> [[k]] Source #

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

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

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

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

Orphan instances

(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

Methods

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

recip :: Vect k a -> Vect k a

fromRational :: Rational -> Vect k a