(* CliffSymNil08 Examples.nb *)
(* May 2008 G. Stacey Staples *)
 
(* Use CirclePlus for commutative Clifford multiplication (over ((Subscript[Cl, n])^sym)). *)
(* x⊕y is entered by typing x[ESC]c+[ESC]y *)

(* Use CircleMinus for commutative null-square product  (over ((Subscript[Cl, n])^nil))    
(* x⊖y is entered by typing x[ESC]c-[ESC]y *)

Quit[]

<<CliffMath08`
<<CliffSymNil08`

(* Examples follow *)

SetSignature[0,16]

GetSignature

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

(* The Clifford multiplication operator is ⊙ *)

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

(* The symmetric Clifford multiplication operator is ⊕ *)

u=(2(Subscript[e, {1}])+3(Subscript[e, {3}]))⊕((Subscript[e, {2}])-(Subscript[e, {1}]))//ClSymExpand

(* The symmetric null square Clifford multiplication operator is ⊖ *)

v=(2(Subscript[e, {1}])+3(Subscript[e, {3}]))⊖((Subscript[e, {2}])-(Subscript[e, {1}]))//ClNilExpand

z=2u-w//ClSymExpand

(* The symmetric idempotent multiplication operator is \[Square] *)

r=(2(Subscript[e, {1}])+3(Subscript[e, {3}]))⋄((Subscript[e, {2}])-(Subscript[e, {1}]))//ClIdExpand

x=12(Subscript[e, {1}])
y=2(Subscript[e, {2,3}])+7(Subscript[e, {1,7}])

CirclePlus[x,y]//ClSymExpand

CircleMinus[x,y]//ClNilExpand

(x+3y)⊙y//ClExpand

(x+3y)⊕y//ClSymExpand

SetSignature[2,2]

x=(1/2)(1+(Subscript[e, {1,4}]));

x⊙x//ClExpand

y=(1/2)(1+(Subscript[e, {2,3}]))

y⊙y//ClExpand

z=ClExpand[(x⊙y)]

z⊙z//ClExpand

(* Commuting idempotents example *)
SetSignature[2,2];
x=(1/2)(1+(Subscript[e, {1,4}]));
y=(1/2)(1+(Subscript[e, {2,3}]));
z=x⊙y//ClExpand

(* x⊙y is idempotent *)
z⊙z//ClExpand

(* x and y commute *)
y⊙x//ClExpand

(x+3y)⊖y//ClNilExpand

z=x+y

CliffordPower[z,2]

ClSymPower[z,2]

ClNilPower[z,2]

ClIdPower[z,2]

GetSignature

w=(Subscript[e, {1}])+(Subscript[e, {2}])+(Subscript[e, {3}])+(Subscript[e, {4}])+(Subscript[e, {5}])+(Subscript[e, {6}])+(Subscript[e, {7}])

ClNilPower[w,5]

SetSignature[0,7]

f=z⊕z//ClSymExpand

GradeKPart[f,2]

f⊕z//ClSymExpand

ClSymPower[x+y,2]

%⊙(x+y)//ClExpand

CliffordNorm[%,2]

(3(Subscript[e, {1}])+4(Subscript[e, {3}]))⊖(5(Subscript[e, {1}])-3(Subscript[e, {3}]))//ClNilExpand

CliffordNorm[%,∞]

ClKVectors[3]

SetSignature[2,2]

((Subscript[e, {1}])+(Subscript[e, {3}]))⊕((Subscript[e, {1}])-(Subscript[e, {3}]))//ClSymExpand

(Subscript[e, {1}])⊕ (Subscript[e, {1}]) - (Subscript[e, {3}])⊕ (Subscript[e, {3}]) + (Subscript[e, {3}])⊕(Subscript[e, {1}])-(Subscript[e, {1}])⊕(Subscript[e, {3}])

SetSignature[7,0]

(A=(Table[1,{i,1,7},{j,1,7}]-IdentityMatrix[7]).DiagonalMatrix[Table[(Subscript[e, {i}]),{i,1,7}]])//MatrixForm

Tr[ClNilMatrixPower[A,4]]

Tr[ClSymMatrixPower[A,4]]

Tr[CliffordMatrixPower[A,4]]

Tr[ClIdMatrixPower[A,4]]

(* Generate adjacency matrix for random graph on n vertices *)
GenRandGraph[n_]:=Module[{i,j,A,rw,co},A=Table[0,{i,1,n},{j,1,n}];For[rw=1,rw≤n,rw++,For[co=1,co<rw,co++,If[RandomReal[]>0.5`,A[[rw,co]]=1;A[[co,rw]]=1;,Null];]];Return[A];];

vertices=8;
SetSignature[vertices,0];
m=GenRandGraph[vertices];
GraphPlot[m]

(A=m.DiagonalMatrix[Table[(Subscript[e, {i}]),{i,1,vertices}]])//MatrixForm

Tr[ClNilMatrixPower[A,5]]

ScalarSum[%]/10