GAlgebra.jl API
GAlgebra.MvBase.:*Base.:+Base.:-Base.:-Base.:/Base.:==Base.:~Base.adjointBase.conjBase.expBase.getindexBase.invGAlgebra.:×GAlgebra.:∧GAlgebra.:≠GAlgebra.:⊙GAlgebra.:⊛GAlgebra.:⊠GAlgebra.:⋅GAlgebra.:⨼GAlgebra.:⨽GAlgebra.GGAlgebra.evenGAlgebra.involuteGAlgebra.normGAlgebra.oddGAlgebra.projGAlgebra.reflGAlgebra.rotGAlgebra.scalar
GAlgebra.G — Method
G(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 — Type
A wrapper class for galgebra.mv.Mv:
- all methods of
galgebra.mv.Mvare delegated and can be called like in Python. - enhanced with operator overriding and extra methods.
- automatically supports pretty printing like in Python.
Base.adjoint — Method
Dual, 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.getindex — Method
The i-th grade part.
A[i] = A.grade(i) $\equiv \langle A B^{\dagger} \rangle_i$
GAlgebra.:× — Method
Cross product for vectors in 3D.
GAlgebra.:∧ — Method
Wedge product.
Hint: type ∧ with \wedge.
GAlgebra.:≠ — Method
Comparisons of inequality.
Hint: Type ≠ with \neq. Alternatively, use !=.
$A \neq B \equiv \mathrm{simplify}(A - B) \neq 0$
GAlgebra.:⊙ — Method
Anti-commutator product.
Hint: type ⊙ with \odot. Alternatively, use <<.
$A \bar{\times} B \equiv \dfrac{1}{2}(AB+BA)$.
GAlgebra.:⊛ — Method
Scalar 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.:⊠ — Method
Commutator product.
Hint: type ⊠ with \boxtimes. Alternatively, use >>.
$A \underline{\times} B \equiv \dfrac{1}{2}(AB-BA)$.
GAlgebra.:⋅ — Method
Hestenes' 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.:⨼ — Method
Left 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.:⨽ — Method
Right 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 — Method
Even-grade part.
A[:+] = (A)₊ = even(A) = A.even() $\equiv A_+$
GAlgebra.involute — Method
Grade 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 — Method
Norm.
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 — Method
Odd-grade part.
A[:-] = (A)₋ = odd(A) = A.odd() $\equiv A_-$
GAlgebra.proj — Method
Projection.
proj(B, A) $\equiv P_{B}(A) \equiv$ A.project_in_blade(B)
Only valid if B is a blade.
GAlgebra.refl — Method
Reflection.
refl(B, A) $\equiv \mathrm{Refl}_{B}(A) \equiv$ A.reflect_in_blade(B)
Only valid if B is a blade.
GAlgebra.rot — Method
Rotation.
Rotate the multivector A by the 2-blade itheta.
rot(itheta, A) $\equiv A e^{I \theta} \equiv$ A.rotate_multivector(itheta)
GAlgebra.scalar — Method
Scalar (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