Quaternions #
In this file we define quaternions ℍ[R]
over a commutative ring R
, and define some
algebraic structures on ℍ[R]
.
Main definitions #
QuaternionAlgebra R a b c
,ℍ[R, a, b, c]
: [Bourbaki, Algebra I][bourbaki1989] with coefficientsa
,b
,c
(Many other references such as Wikipedia assume $\operatorname{char} R ≠ 2$ therefore one can complete the square and WLOG assume $b = 0$.)Quaternion R
,ℍ[R]
: the space of quaternions, a.k.a.QuaternionAlgebra R (-1) (0) (-1)
;Quaternion.normSq
: square of the norm of a quaternion;
We also define the following algebraic structures on ℍ[R]
:
Ring ℍ[R, a, b, c]
,StarRing ℍ[R, a, b, c]
, andAlgebra R ℍ[R, a, b, c]
: for any commutative ringR
;Ring ℍ[R]
,StarRing ℍ[R]
, andAlgebra R ℍ[R]
: for any commutative ringR
;IsDomain ℍ[R]
: for a linear ordered commutative ringR
;DivisionRing ℍ[R]
: for a linear ordered fieldR
.
Notation #
The following notation is available with open Quaternion
or open scoped Quaternion
.
ℍ[R, c₁, c₂, c₃]
:QuaternionAlgebra R c₁ c₂ c₃
ℍ[R, c₁, c₂]
:QuaternionAlgebra R c₁ 0 c₂
ℍ[R]
: quaternions overR
.
Implementation notes #
We define quaternions over any ring R
, not just ℝ
to be able to deal with, e.g., integer
or rational quaternions without using real numbers. In particular, all definitions in this file
are computable.
Tags #
quaternion
Quaternion algebra over a type with fixed coefficients where $i^2 = a + bi$ and $j^2 = c$,
denoted as ℍ[R,a,b]
.
Implemented as a structure with four fields: re
, imI
, imJ
, and imK
.
- re : R
Real part of a quaternion.
- imI : R
First imaginary part (i) of a quaternion.
- imJ : R
Second imaginary part (j) of a quaternion.
- imK : R
Third imaginary part (k) of a quaternion.
Instances For
The equivalence between a quaternion algebra over R
and R × R × R × R
.
Equations
Instances For
The equivalence between a quaternion algebra over R
and Fin 4 → R
.
Equations
Instances For
The imaginary part of a quaternion.
Note that unless c₂ = 0
, this definition is not particularly well-behaved;
for instance, QuaternionAlgebra.star_im
only says that the star of an imaginary quaternion
is imaginary under this condition.
Equations
Instances For
Coercion R → ℍ[R,c₁,c₂,c₃]
.
Equations
Instances For
Equations
Equations
Equations
Equations
Equations
Equations
Equations
Multiplication is given by
1 * x = x * 1 = x
;i * i = c₁ + c₂ * i
;j * j = c₃
;i * j = k
,j * i = c₂ * j - k
;k * k = - c₁ * c₃
;i * k = c₁ * j + c₂ * k
,k * i = -c₁ * j
;j * k = c₂ * c₃ - c₃ * i
,k * j = c₃ * i
.
Equations
Equations
Equations
Equations
Equations
Equations
QuaternionAlgebra.re
as a LinearMap
Equations
Instances For
QuaternionAlgebra.imI
as a LinearMap
Equations
Instances For
QuaternionAlgebra.imJ
as a LinearMap
Equations
Instances For
QuaternionAlgebra.imK
as a LinearMap
Equations
Instances For
QuaternionAlgebra.equivTuple
as a linear equivalence.
Equations
Instances For
ℍ[R, c₁, c₂, c₃]
has a basis over R
given by 1
, i
, j
, and k
.
Equations
Instances For
There is a natural equivalence when swapping the first and third coefficients of a
quaternion algebra if c₂
is 0.
Equations
Instances For
Quaternion conjugate.
Equations
Equations
A version of star_smul
for the special case when c₂ = 0
, without SMulCommClass S R R
.
Quaternion conjugate as an AlgEquiv
to the opposite ring.
Equations
Instances For
Space of quaternions over a type, denoted as ℍ[R]
.
Implemented as a structure with four fields: re
, im_i
, im_j
, and im_k
.
Equations
Instances For
Coercion R → ℍ[R]
.
Equations
Instances For
Equations
Equations
Equations
Equations
The imaginary part of a quaternion.
Equations
Instances For
Square of the norm.
Equations
Instances For
Equations
Equations
The cardinality of a quaternion algebra, as a type.
Show the quaternion ⟨w, x, y, z⟩ as a string "{ re := w, imI := x, imJ := y, imK := z }".
For the typical case of quaternions over ℝ, each component will show as a Cauchy sequence due to the way Real numbers are represented.