GAlgebra.jl API

GAlgebra.GMethod
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.

source

class Mv

GAlgebra.MvType

A 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.
source
Base.:/Method

Division.

$A / B \equiv A B^{-1}$. Only valid when $B$ has inverse.

source
Base.:==Method

Comparisons of equality.

$A = B \equiv \mathrm{simplify}(A - B) = 0$

source
Base.:~Method

Reversion.

~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.

source
Base.adjointMethod

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}$
source
Base.conjMethod

Clifford conjugate.

(A)ǂ = A[:ǂ] $\equiv A^{*\dagger}$

Hint: type ǂ with \doublepipe.

In literature the notation is usually $A^{\ddagger}$, but \ddagger is reserved by Julia.

source
Base.getindexMethod

The i-th grade part.

A[i] = A.grade(i) $\equiv \langle A B^{\dagger} \rangle_i$

source
Base.invMethod

Inverse.

(A)⁻¹ = A^-1 = inv(A) = A.inv() $\equiv A^{-1}$

Hint: type ⁻¹ with \^-\^1.

source
GAlgebra.:≠Method

Comparisons of inequality.

Hint: Type ≠ with \neq. Alternatively, use !=.

$A \neq B \equiv \mathrm{simplify}(A - B) \neq 0$

source
GAlgebra.:⊙Method

Anti-commutator product.

Hint: type ⊙ with \odot. Alternatively, use <<.

$A \bar{\times} B \equiv \dfrac{1}{2}(AB+BA)$.

source
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 *.

source
GAlgebra.:⊠Method

Commutator product.

Hint: type ⊠ with \boxtimes. Alternatively, use >>.

$A \underline{\times} B \equiv \dfrac{1}{2}(AB-BA)$.

source
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.$

source
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.

source
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.

source
GAlgebra.involuteMethod

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^{*}$.

source
GAlgebra.normMethod

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.

source
GAlgebra.oddMethod

Odd-grade part.

A[:-] = (A)₋ = odd(A) = A.odd() $\equiv A_-$

source
GAlgebra.projMethod

Projection.

proj(B, A) $\equiv P_{B}(A) \equiv$ A.project_in_blade(B)

Only valid if B is a blade.

source
GAlgebra.reflMethod

Reflection.

refl(B, A) $\equiv \mathrm{Refl}_{B}(A) \equiv$ A.reflect_in_blade(B)

Only valid if B is a blade.

source
GAlgebra.rotMethod

Rotation.

Rotate the multivector A by the 2-blade itheta.

rot(itheta, A) $\equiv A e^{I \theta} \equiv$ A.rotate_multivector(itheta)

source
GAlgebra.scalarMethod

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

source