# 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 [1]:

from numpy import e,pi
import clifford as cf

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


In [2]:

blades

Out[2]:

{'e1': (1^e1), 'e2': (1^e2), 'e12': (1^e12)}


Assign blades to variables

In [3]:

e1 = blades['e1']


## Basics¶

In [4]:

e1*e2 # geometric product

Out[4]:

(1.0^e12)

In [5]:

e1|e2 # inner product

Out[5]:

0

In [6]:

e1^e2 # outer product

Out[6]:

(1.0^e12)


## Reflection¶

In [7]:

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

Out[7]:

-(1.0^e1) + (1.0^e2)


## Rotation¶

In [8]:

from numpy  import pi

R = e**(pi/4*e12) # enacts rotation by pi/2
R

Out[8]:

0.70711 + (0.70711^e12)

In [9]:

R*e1*~R    # rotate e1 by pi/2 in the e12-plane

Out[9]:

-(1.0^e2)