Application Center - Maplesoft

App Preview:

PX: A package for multiplication and commutation of quantum operators

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Image 

Quantum Mechanics Worksheet 

SLAC and Stanford University Software Notices: 

Introduction 

PX is a Maple package designed to implement non-commutative multiplication and commutation of quantum operators.  In particular it is designed to deal with systems with several degree of freedom satisfying the commutation relations of operators and their conjugate momenta; i.e., operators such as   and  ,  or alternatively their associated annihilation and creation operators A and In what follows I will take A and Adag to be fundamental, satisfying the commutation relations  ([A, Adag]) = 1.Note that  I have implicitly adopted the particle physics convention of setting Planck's constant and the speed of light equal to 1. 

The usefulness of this package is that it enables one to explicitly study how one derives the Heisenberg equations of motion for any operator by taking commutators of the operator with the Hamiltonian.  In this example worksheet I show how to use the package to work out the equations of motion for several simple Hamiltonians.  To see all of the things which can be done with the package read the help files. 

> with(PX)
 

Warning, inserted missing semicolon at end of statement 

"running setup" 

[`&X`, Xcom, Xcom1, Xcom2, addcomm, addmomop, addposop, addqop, cancelu, checkforboseprod, checkforcnumber, checkformom, checkfornotbose, checkfornotqop, checkforpos, checkforqop, clearqops, com, delt...
[`&X`, Xcom, Xcom1, Xcom2, addcomm, addmomop, addposop, addqop, cancelu, checkforboseprod, checkforcnumber, checkformom, checkfornotbose, checkfornotqop, checkforpos, checkforqop, clearqops, com, delt...
[`&X`, Xcom, Xcom1, Xcom2, addcomm, addmomop, addposop, addqop, cancelu, checkforboseprod, checkforcnumber, checkformom, checkfornotbose, checkfornotqop, checkforpos, checkforqop, clearqops, com, delt...
[`&X`, Xcom, Xcom1, Xcom2, addcomm, addmomop, addposop, addqop, cancelu, checkforboseprod, checkforcnumber, checkformom, checkfornotbose, checkfornotqop, checkforpos, checkforqop, clearqops, com, delt...
 

As you can see, when PX is loaded, using the command  with(PX) many functions are made available. This is done so that userscan make use of them to create their own specialized routines which improve upon the functionality of this package.  However, for most users there are only a few workhorse functions which will be used to define: the set of quantum operators, in particular which ones are momentum type operators and which are position type operators; to define the commutators of these momentum operators with the position operators; to define non-commuting products of the quantum operators; to compute the  commutators of more complicated operators; and finally, to bring complicated products of operators into a standard form so that apparently different expressions can be compared with one another.

The list of all quantum operators known to
PX is kept in a private list which can only be supplemented using the functions: addmomop() and addposop()   These functions add the arguments to the appropriate list of operators.  They also add their arguments to the list of all quantum operators known to PX during the computation.  The contents of the various lists can be displayed at any time using the commands listqops(), listmomops() and listposops().  These lists and their associated commutation relations can be initialized to be empty using the function clearqops().  One should avoid using the function addqops() to add entries to the list of all quantum operators directly.  The reason for this is adding an operator to the list of momentum operators or position operators already accomplishes this feat.  

We divide the momentum operators and position operators into separate lists to avoid having to specify too many elementary commutation relations.  The algorithm implemented in the function
com() (which shouldn't be used directly) is that if both of its arguments are of type position operator, or both of its arguments are of type momentum operator, then their commutator vanishes.  Otherwise, their commutator is computed using the elementary user-defined commutation relations defined using the function addcom().  

The operator
&X() is used to take the non-commuting product of any number of operators.  Having defined generic operators using &X() the commutator of any two operators us computed using Xcom() .  Bringing a general product of operators into a standard form is accomplished using the function porder().  

Having made these general remarks let us see how to make use of these functions in practice.


 

Getting Started 

When PX first loads there are two quantum operators known to the system.   To see what these operators are type 

> listqops();
 

[A, Adag] 

To get a list of the momentum and position operators separately use the commands      

> mypositionops:=listposops();
mymomentumops:=listmomops();
 

[Adag] 

[A] 

To see what commutation relations have been defined for the basic operators just type 

> listcomms();
 

TABLE([(A, Adag) = 1, (x, p) = I, (Adag, A) = -1]) 

The basic commutation relations are stored in a Maple table.  Each entry in the table is and index pair and its value.
To store the table so as to refer to it in a more easily readable way simply type
 

> listcomms();
 

TABLE([(A, Adag) = 1, (x, p) = I, (Adag, A) = -1]) 

To clear the initially defined operators and begin defining your own quantum problems simply type 

> clearqops();
 

table[] 

Now check to see that everything has been properly reinitialized. 

> listqops();listmomops();listposops();
 

 

 

 

Let us now start to define a new set of quantum operators so that we can study the quantum Harmonic oscillator. 

> addposop(Adag);
 

[Adag] 

> addmomop(A);
 

[Adag, A] 

> listqops();
 

[Adag, A] 

> listmomops();
 

[A] 

> listposops();
 

[Adag] 

Now let us check to see if any commutation relations have been defined.  

> listcomms();
 

Note that if nothing is defined  listcomms() doesn't return anything.  To add a basic commutation relation type
 

> addcomm(A,Adag,1);
 

-1 

Now type 

> listcomms();
 

TABLE([(A, Adag) = 1, (Adag, A) = -1]) 

At this point I haven't set Planck's constant to unity just to show I don't have to do so.  Let us now go on to define
the Hamiltonian for the system.  

NOTE:  To define basic operators raised to a power it is best to explicitly multiply them together.  In this way
Xcom() will automatically know what to do with a power of an operator if the commutation relation with a single term is defined.  This is particularly useful for operators such as 1/x.
Thus, to define the Hamiltonian for a simple harmonic oscillator we type
 

 

> x := 1/sqrt(2*omega)*(&X(Adag)+&X(A));
p := I*sqrt(omega/2)*(&X(Adag)-&X(A));
 

1/2*2^(1/2)*(PX:-`&X`(Adag)+PX:-`&X`(A))/omega^(1/2) 

1/2*I*2^(1/2)*omega^(1/2)*(PX:-`&X`(Adag)-PX:-`&X`(A)) 

NOTE:  we can check that these operators satisfy the correct commutation relations by using Xcom() and invoking identify() to eliminate the rounding caused by the fact that I am working to ten significant digits; i.e., 

> Digits;
 

10 

> identify(Xcom(&X(x),&X(p)));
identify(Xcom(&X(p),&X(x)));
 

I 

-I 

The Hamiltonian of the oscillator is then define to be 

 

> H := &X(p,p)/2 + 1/2*omega^2*&X(x,x);
 

-1/4*omega*PX:-`&X`(Adag, Adag)+1/4*omega*PX:-`&X`(Adag, A)+1/4*omega*PX:-`&X`(A, Adag)-1/4*omega*PX:-`&X`(A, A)+1/2*omega^2*(1/2*PX:-`&X`(Adag, Adag)/omega+1/2*PX:-`&X`(Adag, A)/omega+1/2*PX:-`&X`(A,...
-1/4*omega*PX:-`&X`(Adag, Adag)+1/4*omega*PX:-`&X`(Adag, A)+1/4*omega*PX:-`&X`(A, Adag)-1/4*omega*PX:-`&X`(A, A)+1/2*omega^2*(1/2*PX:-`&X`(Adag, Adag)/omega+1/2*PX:-`&X`(Adag, A)/omega+1/2*PX:-`&X`(A,...
 

We can bring this Hamiltonian into the familiar normal ordered form using  

> H:=porder(H);
 

omega*PX:-`&X`(Adag, A)+1/2*omega 

In the Heisenberg representation of quantum mechanics the states of the system don't change, but the operators do change in time.  Since the time dependent for of an operator is obtained by applying the exponential of the Hamitonian; i.e.
                  
                        = e^(I*H*t)  e^(-I*H*t)
it follows that

                      = I [ , ]


i.e.
 

> dxdt:= I*Xcom(H,x);
 

I*(.7071067810*omega^(1/2)*PX:-`&X`(Adag)-.7071067810*omega^(1/2)*PX:-`&X`(A)) 

NOTE:  For technical reasons having to do with the way I use this package numerical factors get converted to floating point numbers.  To get expressions involving only integer factors into a prettier form it is convenient to convert it back using.   

> dxdt:=factor(map(identify,expand(dxdt)));
 

1/2*I*2^(1/2)*omega^(1/2)*(PX:-`&X`(Adag)-PX:-`&X`(A)) 

and then compare it to 

> p;
 

1/2*I*2^(1/2)*omega^(1/2)*(PX:-`&X`(Adag)-PX:-`&X`(A)) 

Taking the second derivative we obtain Hamilton's equation of motion 

> d2xdt2:=I*Xcom(H,dxdt);
 

I*(.7071067810*I*omega^(3/2)*PX:-`&X`(Adag)+.7071067810*I*omega^(3/2)*PX:-`&X`(A)) 

which we can make prettier by 

> factor(map(identify,expand(d2xdt2)));
 

-1/2*2^(1/2)*omega^(3/2)*(PX:-`&X`(Adag)+PX:-`&X`(A)) 

which we recognize as the equation of motion for a harmonic oscillator
 

> -omega^2*x;
 

-1/2*2^(1/2)*omega^(3/2)*(PX:-`&X`(Adag)+PX:-`&X`(A)) 

Now let us carry out the same manipulation for a more complicated Hamiltonian but without the annihilation and creation operators.  First let us get rid of all definitions 

 

> clearqops();
 

table[] 

> x:='x':p:='p':
 

Now let's define x and p to be two non-commution operators. 

> addposop(x);
 

[x] 

> addmomop(p);
 

[x, p] 

> addcomm(x,p,I);
 

-I 

Now define the potential 

 

> V:=&X(x,x,x,x)-2*f^2*&X(x,x) ;
 

PX:-`&X`(x, x, x, x)-2*f^2*PX:-`&X`(x, x) 

> H := &X(p,p)/2 + V;
 

1/2*PX:-`&X`(p, p)+PX:-`&X`(x, x, x, x)-2*f^2*PX:-`&X`(x, x) 

Note the use of &X(x) which is necessary to tell Xcom() that x is an operator, and not just the name of an operator.
 

> dxdt := expand(I*Xcom(H,&X(x)));
 

1.000000000*PX:-`&X`(p) 

> dxdt:=identify(dxdt);
 

PX:-`&X`(p) 

Which, as before, we see is just p.  Now let us get the second derivative of x. 

 

> d2xdt2:=expand(I*Xcom(H,dxdt));
 

-4*PX:-`&X`(x, x, x)+4.*f^2*PX:-`&X`(x) 

Finally, let us see how to bring a product of operators into a standard order with all momentum operators standing to the right of all position operators.  For example, consider the operator 

> O1 := &X(p,x);
 

PX:-`&X`(p, x) 

To bring this to standard order just 

> porder(O1);
 

-I+PX:-`&X`(x, p) 

Now consider something more complicated
 

> O2:=&X(p,x,p,x);
 

PX:-`&X`(p, x, p, x) 

> porder(O2);
 

-1-3*I*PX:-`&X`(x, p)+PX:-`&X`(x, x, p, p) 

> O3:=&X(p,x,x,p,x,x,p);
 

PX:-`&X`(p, x, x, p, x, x, p) 

> porder(O3);
 

-6*PX:-`&X`(x, x, p)-6*I*PX:-`&X`(x, x, x, p, p)+PX:-`&X`(x, x, x, x, p, p, p) 

>
 

 

 

Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities. 

 

Image