Hi everyone, I am attempting to create creation and annihilation operator used in 2nd quantization of quantum mechanics. I want to do both numerically and symbolically. Those who are not familiar here is a simple math to illustrate idea:
n= (cd)(c)
where (cd) is the creation operator or c dagger and (c) is annihilation operator or c basic rules
[(cd),(c)] = (cd)(c)+(c)(cd) = 1
[(cd),(cd)] = (cd)(cd)+(cd)(cd) = 0
[(c),(c)] = (c)(c)+(c)(c) = 0
Below is my listing for numerical approach:
{clear all;close all;clc;matdimension = 3;tempvector = 0:1:matdimensiontempvector = sqrt(tempvector)tempmatrix = diag(tempvector);creation = circshift(tempmatrix,-1);annihilation = creation';% creation = circshift(diag(sqrt(0:1:mat_dim)),-1);
H1=creation*annihilation;H2=annihilation*creation;H3= H1 + H2H4= H2 + H1;H5= creation*creation + creation*creation;}
And the output is :
{tempvector = 0 1 2 3 tempvector = 0.00000 1.00000 1.41421 1.73205 H3 = 1.00000 0.00000 0.00000 0.00000 0.00000 3.00000 0.00000 0.00000 0.00000 0.00000 5.00000 0.00000 0.00000 0.00000 0.00000 3.00000}
1) Obviously something is wrong with my code since answer H3 should be equal to 1 which is not. What I am missing here?
2)Is it possible to create new math rules in matlab? ( I have commutation in mind [A,B]= ) I want to create the above code but do the symbolic calculation as well. If yes, is there a simple example to illustrate the method?
3)I managed to copy dagger symbol and paste it on matlab script, however the script will not compile. Is there a work around this?
Best Answer