In [1]:
import SymPy: symbols, sympy, Sym
using GAlgebra

In [2]:
galgebra.printer.Format()

The following follows definitions in Homogeneous Coordinates for Computational Geometry by Hestenes and Rockwood.


In [3]:
CGA3D = galgebra.ga.Ga("e_1 e_2 e_3 e e_{0}", g="1 0 0 0 0,0 1 0 0 0,0 0 1 0 0,0 0 0 0 -1,0 0 0 -1 0")


Out[3]:
PyObject <galgebra.ga.Ga object at 0x119eba160>

In [4]:
galgebra.ga.Ga.dual_mode_value = "Iinv+"


Out[4]:
"Iinv+"

In [5]:
sympy.Matrix(CGA3D.g)


Out[5]:
\[\left[ \begin{array}{rrrrr}1&0&0&0&0\\0&1&0&0&0\\0&0&1&0&0\\0&0&0&0&-1\\0&0&0&-1&0\end{array}\right]\]

In [6]:
e1,e2,e3,e,e0 = CGA3D.mv()
e1+e2+e3+e+e0


Out[6]:
\begin{align*} \boldsymbol{e}_{1} + \boldsymbol{e}_{2} + \boldsymbol{e}_{3} + \boldsymbol{e} + \boldsymbol{e}_{{0}}\end{align*}

In [7]:
A = CGA3D.mv("A", "mv")


Out[7]:
\begin{align*}A + A^{1} \boldsymbol{e}_{1} + A^{2} \boldsymbol{e}_{2} + A^{3} \boldsymbol{e}_{3} + A^{} \boldsymbol{e} + A^{{0}} \boldsymbol{e}_{{0}} + A^{12} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2} + A^{13} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{3} + A^{1} \boldsymbol{e}_{1}\wedge \boldsymbol{e} + A^{1{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{{0}} + A^{23} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3} + A^{2} \boldsymbol{e}_{2}\wedge \boldsymbol{e} + A^{2{0}} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{{0}} + A^{3} \boldsymbol{e}_{3}\wedge \boldsymbol{e} + A^{3{0}} \boldsymbol{e}_{3}\wedge \boldsymbol{e}_{{0}} + A^{{0}} \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} + A^{123} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3} + A^{12} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e} + A^{12{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{{0}} + A^{13} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e} + A^{13{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}_{{0}} + A^{1{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} + A^{23} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e} + A^{23{0}} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}_{{0}} + A^{2{0}} \boldsymbol{e}_{2}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} + A^{3{0}} \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} + A^{123} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e} + A^{123{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}_{{0}} + A^{12{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} + A^{13{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} + A^{23{0}} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} + A^{123{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}}\end{align*}

In [8]:
I = CGA3D.I()


Out[8]:
\begin{align*} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}}\end{align*}

In [9]:
display("text/latex", A.Fmt(2))


\begin{align*} & A \\ & + A^{1} \boldsymbol{e}_{1} + A^{2} \boldsymbol{e}_{2} + A^{3} \boldsymbol{e}_{3} + A^{} \boldsymbol{e} + A^{{0}} \boldsymbol{e}_{{0}} \\ & + A^{12} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2} + A^{13} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{3} + A^{1} \boldsymbol{e}_{1}\wedge \boldsymbol{e} + A^{1{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{{0}} + A^{23} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3} + A^{2} \boldsymbol{e}_{2}\wedge \boldsymbol{e} + A^{2{0}} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{{0}} + A^{3} \boldsymbol{e}_{3}\wedge \boldsymbol{e} + A^{3{0}} \boldsymbol{e}_{3}\wedge \boldsymbol{e}_{{0}} + A^{{0}} \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} \\ & + A^{123} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3} + A^{12} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e} + A^{12{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{{0}} + A^{13} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e} + A^{13{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}_{{0}} + A^{1{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} + A^{23} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e} + A^{23{0}} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}_{{0}} + A^{2{0}} \boldsymbol{e}_{2}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} + A^{3{0}} \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} \\ & + A^{123} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e} + A^{123{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}_{{0}} + A^{12{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} + A^{13{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} + A^{23{0}} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} \\ & + A^{123{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} \end{align*}

In [10]:
display("text/latex", (A').Fmt(2))


\begin{align*} & A^{123{0}} \\ & + A^{23{0}} \boldsymbol{e}_{1} - A^{13{0}} \boldsymbol{e}_{2} + A^{12{0}} \boldsymbol{e}_{3} - A^{123} \boldsymbol{e} + A^{123{0}} \boldsymbol{e}_{{0}} \\ & - A^{3{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2} + A^{2{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{3} - A^{23} \boldsymbol{e}_{1}\wedge \boldsymbol{e} + A^{23{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{{0}} - A^{1{0}} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3} + A^{13} \boldsymbol{e}_{2}\wedge \boldsymbol{e} - A^{13{0}} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{{0}} - A^{12} \boldsymbol{e}_{3}\wedge \boldsymbol{e} + A^{12{0}} \boldsymbol{e}_{3}\wedge \boldsymbol{e}_{{0}} + A^{123} \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} \\ & - A^{{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3} + A^{3} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e} - A^{3{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{{0}} - A^{2} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e} + A^{2{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}_{{0}} + A^{23} \boldsymbol{e}_{1}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} + A^{1} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e} - A^{1{0}} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}_{{0}} - A^{13} \boldsymbol{e}_{2}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} + A^{12} \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} \\ & + A^{} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e} - A^{{0}} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}_{{0}} - A^{3} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} + A^{2} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} - A^{1} \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} \\ & - A \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}} \end{align*}

In [11]:
I


Out[11]:
\begin{align*} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}}\end{align*}

In [12]:
(I)⁻¹


Out[12]:
\begin{align*}- \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}\wedge \boldsymbol{e}_{{0}}\end{align*}

In [13]:
I == - (I)⁻¹


Out[13]:
true

In [14]:
dual(A) == A * inv(I)


Out[14]:
true

In [15]:
A' == A * (I)⁻¹


Out[15]:
true

In [16]:
(I)⁻¹ == (I)ǂ == I^2 * I


Out[16]:
true

In [17]:
e'


Out[17]:
\begin{align*} \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}\end{align*}

In [18]:
e0'


Out[18]:
\begin{align*}- \boldsymbol{e}_{1}\wedge \boldsymbol{e}_{2}\wedge \boldsymbol{e}_{3}\wedge \boldsymbol{e}_{{0}}\end{align*}

In [ ]: