How to generate a Quantum Harmonic Oscillator
creation and annihilation matrices in MATLAB
C.B.
May 19, 2007
A Small Introduction - The Harmonic Oscillator
The Hamiltonian for a 1-dimensional quantum harmonic oscillator is
H = Q2 + P 2
where
Q=
h
(a + a )
2m
hm
(a a)
P =
2
P and Q are the kinetic and potential energy operators for the harmonic
oscillator h, m and are constants. The symbols a and a represent the
creation and annihilation matrices.
If one wishes to create an anharmonic potential, the potential energy
operator will be different. A simple anharmonic potential is the double well
potential, in this case
Hdwp = Q4 Q2 + P 2
So if we can generate the P and Q matrices, the quantum oscillator
can be numerically solved for any potential by simply diagonalizing the
Hamiltonian matrix.
The a and a matrices look like the following.
0
0
0 0 ...
0
1 0
0 ...
0 0
1 0
0 0 ...
2 0 . . .
0
2
0
0
.
.
.
0
0
0
3
.
.
.
a=
a =
0 0
0
0
3
0
.
.
.
0
0
.
.
.
..
..
..
..
..
.. . .
..
.. . .
.
.
.
.
.
.
.
.
.
.
Because a is a real matrix its hermitian conjugate a , is just the transpose
of a. Thus in MATLAB if we generate a we can trivially generate a .
1
Generating a and a Matrices in MATLAB
It may look that the two matrices can be easily generated by a simple loop.
However we can avoid the use of loops to make the code run much faster,
especially if the dimension of the matrices is very large.
Firstly we create a temporary 1-dimensional sequential array named
tempvector up to the desired dimension of the matrix matdimension
tempvector =
0:1:matdimension;
Then we take the square root of each number in our temporary array
and store it back in the same variable
tempvector = sqrt(tempvector);
Then we generate a diagonal matrix with our temporary vector as the
diagonal
tempmatrix = diag(tempvector);
and finally we generate the creation matrix by simply performing a circular shift of the temporary matrix
creation = circshift(tempmatrix,-1);
and the annihilation matrix annihilation is just the transpose of creation
annihilation = creation;
All the above steps can be combined into one line of code to produce the
same result:
creation = circshift(diag(sqrt(0:1:mat_dim)),-1);