GAlgebra.jl API
GAlgebra.Mv
Base.:*
Base.:+
Base.:-
Base.:-
Base.:/
Base.:==
Base.:~
Base.adjoint
Base.conj
Base.exp
Base.getindex
Base.inv
GAlgebra.:×
GAlgebra.:∧
GAlgebra.:≠
GAlgebra.:⊙
GAlgebra.:⊛
GAlgebra.:⊠
GAlgebra.:⋅
GAlgebra.:⨼
GAlgebra.:⨽
GAlgebra.G
GAlgebra.even
GAlgebra.involute
GAlgebra.norm
GAlgebra.odd
GAlgebra.proj
GAlgebra.refl
GAlgebra.rot
GAlgebra.scalar
GAlgebra.G
— MethodG(p::Integer, q::Integer, r::Integer)
A convenient method to instantiate a Geometric Algebra with p
positive, q
negative and r
zero dimensions.
q
and r
defaults to zero if omitted.
The basis will be named with prefix e
and indexed starting from 1.
For example:
# Basic
Hyper = G(1) # Hyperbolic numbers.
ℂ = G(0,1) # Complex numbers.
Dual = G(0,0,1) # Dual numbers.
ℍ = G(0,2) # Quaternions.
# Clifford
Cl2 = G(2) # Clifford algebra for 2D vector space.
Cl3 = G(3) # Clifford algebra for 3D vector space.
Spacetime = G(1,3) # Clifford algebra for timespace vectors.
# Geometric
PGA2D = G(2,0,1) # Projective Euclidean 2D plane. (dual)
PGA3D = G(3,0,1) # Projective Euclidean 3D space. (dual)
CGA2D = G(3,1) # conformal 2D space.
CGA3D = G(4,1) # Conformal 3D space.
# High-Dimensional GA
DCGA3D = G(6,2) # Double Conformal 3D Space.
TCGA3D = G(9,3) # Tripple Conformal 3D Space.
DCGSTA = G(4,8) # Double Conformal Geometric Space Time Algebra.
QCGA = G(9,6) # Quadric Conformal Geometric Algebra.
To instantiate a Geometric Algebra with more parameters, use galgebra.ga.Ga
instead.
For example:
import SymPy: sympy
using GAlgebra
Ga = galgebra.ga.Ga
g3d = Ga("e*x|y|z")
(r, th, phi) = coords = sympy.symbols("r theta phi")
s3d = Ga("e_r e_theta e_phi", g=[1 0 0; 0 r^2 0; 0 0 r^2 * sympy.sin(th)^2], coords=coords, norm=true)
(er, eth, ephi) = s3d.mv()
Please also consult the documentation of GAlgebra.
class Mv
GAlgebra.Mv
— TypeA wrapper class for galgebra.mv.Mv
:
- all methods of
galgebra.mv.Mv
are delegated and can be called like in Python. - enhanced with operator overriding and extra methods.
- automatically supports pretty printing like in Python.
Base.:*
— MethodGeometric product.
$A * B \equiv A B$.
Base.:+
— MethodAddition.
Base.:-
— MethodSubtraction.
Base.:-
— MethodUnary negation.
Base.:/
— MethodDivision.
$A / B \equiv A B^{-1}$. Only valid when $B$ has inverse.
Base.:==
— MethodComparisons of equality.
$A = B \equiv \mathrm{simplify}(A - B) = 0$
Base.:~
— MethodReversion.
~A = A[:~] = rev(A) = A.rev()
$\equiv \tilde{A} \equiv A^{\dagger}$
In literature the notation is usually $\tilde{A}$ or $A^{\dagger}$, the former is illegal syntax and \dagger
in the latter is is reserved by Julia.
Base.adjoint
— MethodDual, i.e. orthogonal complement, $\Lambda^p \to \Lambda^{n-p}$.
A'
$\equiv A^{\bot} \equiv A I$
Note: call Ga.dual_mode(mode)
to globally specify a different dual mode (I+
is the default):
dual_mode | $A^{\bot}$ |
---|---|
+I | $IA$ |
-I | $-IA$ |
I+ | $AI$ |
I- | $-AI$ |
+Iinv | $I^{-1}A$ |
-Iinv | $-I^{-1}A$ |
Iinv+ | $AI^{-1}$ |
Iinv- | $-AI^{-1}$ |
Base.conj
— MethodClifford conjugate.
(A)ǂ = A[:ǂ]
$\equiv A^{*\dagger}$
Hint: type ǂ with \doublepipe
.
In literature the notation is usually $A^{\ddagger}$, but \ddagger
is reserved by Julia.
Base.exp
— MethodNatural base exponential of X: $e^X$
Base.getindex
— MethodThe i
-th grade part.
A[i] = A.grade(i)
$\equiv \langle A B^{\dagger} \rangle_i$
Base.inv
— MethodInverse.
(A)⁻¹ = A^-1 = inv(A) = A.inv()
$\equiv A^{-1}$
Hint: type ⁻¹ with \^-\^1
.
GAlgebra.:×
— MethodCross product for vectors in 3D.
GAlgebra.:∧
— MethodWedge product.
Hint: type ∧ with \wedge
.
GAlgebra.:≠
— MethodComparisons of inequality.
Hint: Type ≠ with \neq
. Alternatively, use !=
.
$A \neq B \equiv \mathrm{simplify}(A - B) \neq 0$
GAlgebra.:⊙
— MethodAnti-commutator product.
Hint: type ⊙ with \odot
. Alternatively, use <<
.
$A \bar{\times} B \equiv \dfrac{1}{2}(AB+BA)$.
GAlgebra.:⊛
— MethodScalar product.
Hint: type ⊛ with \circledast
. Alternatively, use %
.
$A \circledast B \equiv \langle A B^{\dagger} \rangle$.
In literature the notation is usually $\ast$ , but it's visually indistinguishable from *
.
GAlgebra.:⊠
— MethodCommutator product.
Hint: type ⊠ with \boxtimes
. Alternatively, use >>
.
$A \underline{\times} B \equiv \dfrac{1}{2}(AB-BA)$.
GAlgebra.:⋅
— MethodHestenes' inner product.
Hint: type ⋅ with \cdot
. Alternatively, use |
.
$\boldsymbol{A}_{r} \cdot \boldsymbol{B}_{s} \equiv \left\{\begin{array}{lr}{r \text { and } s \neq 0 :} & {\left\langle\boldsymbol{A}_{r} \boldsymbol{B}_{s}\right\rangle_{|r-s|}} \\ {r \text { or } s=0 :} & {0}\end{array}\right.$
GAlgebra.:⨼
— MethodLeft contraction, i.e. "contraction onto".
Hint: type ⨼ with \intprod
. Alternatively, use <
.
$A \rfloor B \equiv \sum\limits_{r, s}\left\langle\langle A\rangle_{r}\langle B\rangle_{s}\right\rangle_{s-r}$
In literature the notation is usually $A \rfloor B$, but \rfloor
is reserved by Julia.
GAlgebra.:⨽
— MethodRight contraction, i.e. "contraction by".
Hint: type ⨽ with \intprodr
. Alternatively, use >
.
$A \lfloor B \equiv \sum\limits_{r, s}\left\langle\langle A\rangle_{r}\langle B\rangle_{s}\right\rangle_{r-s}$
In literature the notation is usually $A \lfloor B$, but \lfloor
is reserved by Julia.
GAlgebra.even
— MethodEven-grade part.
A[:+] = (A)₊ = even(A) = A.even()
$\equiv A_+$
GAlgebra.involute
— MethodGrade involution.
(A)ˣ = A[:*] = involute(A)
$\equiv A_+ - A_- \equiv$ A.even() - A.odd()
Hint: type ˣ with \^x
.
In literature the notation is usually $A^{*}$.
GAlgebra.norm
— MethodNorm.
norm(A)
= A.norm()
$\equiv \left\lVert A \right\rVert \equiv \sqrt{A \tilde{A}}$
Alternatively:
A.norm(hint="+")
$\equiv \sqrt{A \tilde{A}}$A.norm(hint="-")
$\equiv \sqrt{- A \tilde{A}}$A.norm(hint="0")
$\equiv \sqrt{\left| A \tilde{A} \right|}$
Only valid when the result is a scalar.
GAlgebra.odd
— MethodOdd-grade part.
A[:-] = (A)₋ = odd(A) = A.odd()
$\equiv A_-$
GAlgebra.proj
— MethodProjection.
proj(B, A)
$\equiv P_{B}(A) \equiv$ A.project_in_blade(B)
Only valid if B is a blade.
GAlgebra.refl
— MethodReflection.
refl(B, A)
$\equiv \mathrm{Refl}_{B}(A) \equiv$ A.reflect_in_blade(B)
Only valid if B is a blade.
GAlgebra.rot
— MethodRotation.
Rotate the multivector A
by the 2-blade itheta
.
rot(itheta, A)
$\equiv A e^{I \theta} \equiv$ A.rotate_multivector(itheta)
GAlgebra.scalar
— MethodScalar (grade-0) part.
scalar(A) = A.scalar()
$\equiv \langle A B^{\dagger} \rangle \equiv \langle A B^{\dagger} \rangle_0$
Note: it returns a SymPy expression unlike A[0] which returns a Mv object