How to Generate a Quantum Harmonic Oscillator in MATLAB

July 14, 2019 | Author: Hans | Category: N/A
Share Embed Donate


Short Description

How to generate a QHO in MATLAB platform....

Description

How to generate a Quantum Harmonic Oscillator creation and annihilation matrices in MATLAB C.B. May 19, 2007

1

A Smal Smalll Introdu Introducti ction on - The Harmon Harmonic ic Osci Oscilla llator tor

The Hamiltonian for a 1-dimensional quantum harmonic oscillator is H  =  Q 2 + P 2

where

 ¯h  (a + a ) Q = 2mω  −hmω  ¯hmω †

(a† a) 2 p otential tial energy operators for the harmonic harmonic P  and  Q  are the kinetic and poten † oscillator ¯h, m and ω   are are constants. constants. The symbols symbols a and a represent the creation creation and annihilation 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 P  =



4 H dwp dwp  =  Q

−Q

2

+ P 2

So if we can generate the P  and Q   matrices, matrices, the quantum quantum oscillator oscillator can be numer numerica ically lly solve solved d for any any potent potential ial by simply simply diagona diagonaliz lizing ing the Hamiltonian matrix. The a  and a† matrices look like the following.

0  0 a  =   00  .. .

√ 1 0 0 0 .. .

0 2 0 0 .. .

√ 

0 0 3 0 .. .

√ 

... ... ... ...

..

.

   

0  √ 1 a =  00  .. †

.

0 0 2 0 .. .

√ 

0 0 0 3 .. .

√ 

0 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

2

Generating

a

and

†   Matrices in MATLAB

a

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);

2

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF