Using the Physics package (the newest updates for Maple 2016), I am trying to get a basic setup of fermions on a lattice. My lattice is indexed j=1,...,L for some length, L (I'm trying just for L=4 by hand). Using combinat and arraytools and lsit tools, I can generate my entire list of configurations from [0,0,0,..,0], [1,0,0,...,0], ..., [1,1,...,1]. I read through this https://www.mapleprimes.com/questions/151320-Creation-And-Annihilation-Operators# which should be even more general than my problem, but I'm not getting the anti-commutation relationships to work out properly. In that link, the original poster is putting the kets in by hand, I would like to generate them.

So I have this:

`restart`

with(Physics):

with(combinat):

with(LinearAlgebra):

with(ArrayTools):

with(ListTools):

`Setup(mathematicalnotation=true):`

Setup(quantumop={cre,ann}, algebrarules={%AntiCommutator(cre[j],ann[k])=I*KroneckerDelta[j,k],%AntiCommutator(cre[j],cre[k])=0, %AntiCommutator(ann[j],ann[k])=0})

and my algebra is defined. But if I try to compute AntiCommutator(ann[1],ann[1]) is doesn't evaluate it but computes AntiCommutator(cre[1],ann[2]) perfectly fine.

Okay. The algebra is defined, then I create my configurations by using a traingular array and then permutations (and some list/array tools to product vectors that look like [0,0,0,0],[0,0,0,1],...,[1,1,1,1])

`Config_Gen := proc(Length)`

global Configurations;

local fermionarray,n_n,V,Ln,i_i;

fermionarray:= Array(triangular[upper],1..Length+1,1..Length,fill=1);

for n_n from 1 to Length+1 do

V[n_n] := fermionarray(n_n,1..Length);

Ln[n_n] := permute(convert(V[n_n],list));

end do;

Configurations := Ln[1];

for i_i from 2 to Length+1 do

Configurations := [op( Configurations), op(Ln[i_i] ) ];

# Configurations := Reverse([op( Configurations), op(Ln[i_i] ) ]);

end do;

print("Table of configuratons is", fermionarray);

print("The table written as a set of vectors is", V);

print("Permutations of generators is", Ln);

print("Full list of Configurations is", Configurations);

end proc;

For Config_Gen(4) this makes the configurations perfectly fine. Then I need to translate these configurations into creation operators acting on the 0-particle vacuum:

`for i_i from 1 to 2^4 do`

Ket(psi,Configurations[i_i]):= product(cre[j_j]^Configurations[i_i][j_j],j_j = 1 .. 4)* Ket(psi,Vacuum);

nnn:= sum(Configurations[i_i][j_j],j_j=1..4) :

fff:=(-1)^(nnn*(nnn-1)/2):

Bra(psi,Configurations[i_i]):= fff* Bra(psi,Vacuum) * product(( ann[j_j] )^Configurations[i_i][j_j],j_j = 1 .. 4);

#[seq(ann,j=1..4)];

end do;

value(Simplify(Bra(psi,[1,1,0,1]) *Ket(psi,[1,1,0,1]) ));

Which generates the bras and kets. The factors of (-1) are chosen to give the correct bracket. A problem: For some reason, the product in Maple gives the same when I do `Configurations[i_i][(4+1)-j_j]`

.

Some other problems: When I go to evaluate `AntiCommutator(ann[1],ann[2]) `

or more explicitly` ann[1]*ann[2] + ann[2]*ann[1]`

, the worksheet doesn't simplify. Is there a nice way to use the built in Annihilation and Creation operators of the physics package into the tensorproduct space on which I'd like to do calculations?