Quick Start (G2)

This notebook gives a terse introduction to using the clifford module, using a two-dimensional geometric algebra as the context.

Setup

First, import clifford and instantiate a two-dimensional algebra (G2),

In [ ]:
from numpy import e,pi
import clifford as cf

layout, blades = cf.Cl(2) # creates a 2-dimensional clifford algebra

Inspect blades.

In [ ]:
blades

Assign blades to variables

In [ ]:
e1 = blades['e1']
e2 = blades['e2']
e12 = blades['e12']

Basics

In [ ]:
e1*e2 # geometric product
In [ ]:
e1|e2 # inner product
In [ ]:
e1^e2 # outer product

Reflection

In [ ]:
a = e1+e2    # the vector
n = e1       # the reflector
-n*a*n.inv() # reflect `a` in hyperplane normal to `n`

Rotation

In [ ]:
from numpy  import pi

R = e**(pi/4*e12) # enacts rotation by pi/2
R
In [ ]:
R*e1*~R    # rotate e1 by pi/2 in the e12-plane