(* CliffMath10Examples.nb *)
(* Clifford algbebra computations in Mathematica *)
(* May 2011 G. Stacey Staples *)
 
(* Use CircleDot for Clifford multiplication *)
(* x⊙y is entered by typing x[ESC]c.[ESC]y *)

(* Use Wedge for exterior product *)
(* x⋀y is entered by typing x[ESC]^[ESC]y *)

Load the package

<<CliffMath10`

(* Initialize the algebra *)

SetSignature[2,5]

(* Verify the algebra's signature *)

GetSignature

(* A simple calculation *)

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

Involutions

Reversion[w]

GradeInvolution[w]

CliffordConjugate[w]

(* Alternate notation for conjugate *)

(OverBar[w])

(* Alternate notation for grade involution *)

(OverHat[w])

(* Alternate notation for reversion *)

(OverTilde[w])

(* List full basis *)

SetSignature[2,1];
ClBasis

(* Basis for grade-2 part *)

ClKVectors[2]

(* More calculations *)
(* Note the use of parentheses.  ⊙acts on nearest factors only! *)

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

(* For example, this doesn't work properly! *)

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

(* Wedge product *)

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 same elements*)

CircleDot[x,y]//ClExpand

(x+3y)⊙y//ClExpand

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

(* Clifford powers *)

CliffordPower[z,3]//ClExpand

Expand[%]

SetSignature[4,3]

f=z⊙z//ClExpand

(* Left contraction *)

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

(* Right Contraction *)

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

(* Clifford 2-norm *)

CliffordNorm[f,2]

(* Infinity norm *)

CliffordNorm[f,∞]

(* Extract grade-3 part *)

GradeKPart[f,3]

SetSignature[15,0]

(* Form the Clifford adjacency matrix associated with 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]

(* Compute trace of 5th Clifford power of the matrix *)

(* Output suppressed *)

(* It's a BIG computation in the Clifford algebra. *)

Tr[CliffordMatrixPower[A,5]];

(* Count the 5-cycles in the graph by taking the 1-norm of the trace.  *)
(*Divide by 10 to correct for multiple choices of base point and two orientations. *)

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

(* Considering the wedge product, only the 5 cycles survive in the trace. *)
(* This makes computation is faster *)

Tr[WedgeMatrixPower[A,5]];

CliffordNorm[%,1]/10