CliffMath2014a Examples

Clifford algebra computations with Mathematica

G. Stacey Staples

November 2014

Quit[]  (* Quit the kernel and start from scratch *)

Getting started

(* Load the package.  This should match the name of the .m file you downloaded. *)

<<CliffMath2014a`

Initialize the algebra. This is how the algebraic operations get defined!

SetSignature[2, 5]

Verify the current algebra’s signature using GetSignature

GetSignature

Binary Operations

Use CircleDot for Clifford multiplication.  CircleDot[x,y]=x[ESC]c.[ESC]y

w=(2(Subscript[e, {1}])+3(Subscript[e, {3}]))⊙((Subscript[e, {2}])-(Subscript[e, {1}]))//ClExpand

Equivalently,

CircleDot[2(Subscript[e, {1}])+3(Subscript[e, {3}]),(Subscript[e, {2}])-(Subscript[e, {1}]) ]//ClExpand

Use Wedge for the exterior product.  
Wedge[x,y] = x[ESC]^[ESC]y

WExpand expands the wedge product.

z=(2(Subscript[e, {1}])+3(Subscript[e, {3}]))⋀((Subscript[e, {2}])-(Subscript[e, {1}]))//WExpand

Note the use of parentheses in the following examples.  ⊙ acts on nearest factors only!

(3(Subscript[e, {1}]))⊙(2 (Subscript[e, {2}]))//ClExpand

Compare...

3(Subscript[e, {1}])⊙2(Subscript[e, {2}])//ClExpand

Exterior product example

SetSignature[7,0];
x=12(Subscript[e, {1}]);
y=2(Subscript[e, {2,3}])+7(Subscript[e, {1,7}]);
x⋀y//WExpand

Clifford product of elements of previous example

CircleDot[x,y]//ClExpand

Try these by hand first!

(x+3y)⊙y//ClExpand

z=ClExpand[(x+y)⊙x]

Powers of Clifford elements

CliffordPower[z,3]//ClExpand

Expand[%]

Change the signature  and compute (z^2)

SetSignature[4,3];
f=z⊙z//ClExpand

Left & right contractions

LeftContract[(Subscript[e, {2}]),f]

RightContract[f,(Subscript[e, {3}])]

Norms

Clifford 2-norm

CliffordNorm[f,2]

Infinity norm

CliffordNorm[f,∞]

Involutions & Anti-Involutions

Reversion[w]

GradeInvolution[w]

CliffordConjugate[w]

The familiar notation for these is also available. 
Clifford conjugate (OverBar[w]) is obtained by w [CTRL+7] _

(OverBar[w])

Grade involution (OverHat[w])is obtained by w [CTRL+7] ^

(* Alternate notation for grade involution *)

(OverHat[w])

Reversion (OverTilde[w])is obtained by w [CTRL+7] ~

(OverTilde[w])

Other examples

Get canonical basis blades for current signature with ClBasis

SetSignature[2,1];
ClBasis

Basis blades of particular grade are obtained using ClKVectors

ClKVectors[2]

The grade filter is GradeKPart

GradeKPart[f,3]

Here’s a graph enumeration problem.

SetSignature[15,0]

Form the “Clifford adjacency matrix” for a graph on 6 vertices.

(A={{0,(Subscript[e, {2,7}]),(Subscript[e, {3,8}]),0,(Subscript[e, {5,9}]),(Subscript[e, {6,10}])},{(Subscript[e, {1,7}]),0,(Subscript[e, {3,11}]),0,0,0},
{(Subscript[e, {1,8}]),(Subscript[e, {2,11}]),0,(Subscript[e, {4,12}]),(Subscript[e, {5,13}]),0},{0,0,(Subscript[e, {3,12}]),0,(Subscript[e, {5,14}]),0},
{(Subscript[e, {1,9}]),0,(Subscript[e, {3,13}]),(Subscript[e, {4,14}]),0,(Subscript[e, {6,15}])},{(Subscript[e, {1,10}]),0,0,0,(Subscript[e, {5,15}]),0}})//MatrixForm

Here’s the graph.

GraphPlot[A/.(Subscript[e, _])->1]

Computer the trace of the 5th power of the Clifford matrix.

Tr[CliffordMatrixPower[A,5]] //ClExpand

The 5-cycles in the graph are counted by taking the 1-norm of the grade-10 part of the trace.  Each cycle is overcounted with 5 choices of base point and 2 choices of orientation, so we divide by 10.

CliffordNorm[GradeKPart[%,10],1]/10

Computation is much faster considering only the wedge product, since only 5-cycles survive in the trace.

Tr[WedgeMatrixPower[A,5]]//WExpand

CliffordNorm[%,1]/10

Other signatures...

Computations in (Subscript[Cl, p,q,r]) are also supported.

SetSignature[2,4,1];
GetSignature

In (Subscript[Cl, 2,4,1]), ((Subscript[e, 7])^2) should be zero.

(Subscript[e, {7}])⊙(Subscript[e, {7}])

Use SetAlternatingSignature to construct a Clifford algebra with 2n generators.  Even indexed generators square to 1 and odd indexed generators square to -1.

SetAlternatingSignature[3];

GetSignature

(Subscript[e, {5}])⊙(Subscript[e, {5}])

(Subscript[e, {2}])⊙(Subscript[e, {2}])

GetIndex retrieves all indices appearing in an arbitrary multivector.  It’s useful when factoring blades and versors.

GetIndex[3(Subscript[e, {1,3}])-14(Subscript[e, {2,5,7}])]