The Mathematica Journal
Departments
Feature Articles
Columns
New Products
New Publications
Classifieds
Calendar
News Bulletins
Mailbox
Letters
Write Us
About the Journal
Staff and Contributors
Submissions
Subscriptions
Advertising
Back Issues
Home
Download this Issue

Object-Oriented Quantum Mechanics

Frank J. Kampas
fkampas@msn.com

One of the fundamental principles of object-oriented programming is that the internal structures of objects are private (hidden). The response of the objects to "messages" passed to them is independent of their internal structures. This is similar to the fact that measurements upon quantum mechanical states give definite results independent of the various ways in which the states may be represented (e.g., wave functions, vectors in a Hilbert space). This similarity is illustrated here by constructing objects which represent both the states of a quantum mechanical harmonic oscillator and the operators associated with measurements on those states.

Object-oriented programming can be implemented in Mathematica using Roman Maeder's package Classes.m (available from www.mathsource.com/Content/0205-186), which is described in [1, p. 60] and [2, p. 293]. First we load the package.

[Graphics:../Images/index_gr_22.gif]

Now we can construct the simple harmonic oscillator class, sho. The class members are states of definite energy, described by two instance variables: a complex amplitude a and a nonnegative integer quantum number n.

· new is the constructor.
· amp and num return the amplitude and quantum number of the object.
· mult multiplies the amplitude of the state by a constant.
· raise and lower increase and decrease the quantum number, respectively.
· The energy function corresponds to measuring the energy of the state and returns the state multiplied by its energy. [Graphics:../Images/index_gr_23.gif] is Planck's constant divided by [Graphics:../Images/index_gr_24.gif], and [Graphics:../Images/index_gr_25.gif] is the radial frequency of the corresponding classical harmonic oscillator.
· inprd returns the inner product of two states. The inner product of states [Graphics:../Images/index_gr_26.gif] and [Graphics:../Images/index_gr_27.gif] is designated by [Graphics:../Images/index_gr_28.gif] in Dirac bracket notation [3, p. 19].

Note that the raising and lowering operators do not correspond to physical variables, but will be useful for defining other functions. Also note that the states are not normalized unless the magnitude of a is 1.

[Graphics:../Images/index_gr_29.gif]

We use a simple trick for computing the complex conjugate of complex expressions involving real variables using a replacement rule.

[Graphics:../Images/index_gr_30.gif]

The Dirac bracket notation can be implemented using the Notation package.

[Graphics:../Images/index_gr_31.gif]
[Graphics:../Images/index_gr_32.gif]
[Graphics:../Images/index_gr_33.gif]
[Graphics:../Images/index_gr_34.gif]
[Graphics:../Images/index_gr_35.gif]

It is also useful to have a notation for mult.

[Graphics:../Images/index_gr_36.gif]

The following steps illustrate the construction of a state s with an amplitude of 1 and a quantum number of 2, and the determination of the expectation value of its energy, which is [Graphics:../Images/index_gr_37.gif] in Dirac notation.

[Graphics:../Images/index_gr_38.gif]
[Graphics:../Images/index_gr_39.gif]
[Graphics:../Images/index_gr_40.gif]

The next step is the construction of a class whose members are linear combinations of states with definite energy. Members of class lincom are sequences of objects of type sho.

· new is the constructor.
· states returns a list of the sho components making up a variable of type lincom.
· mult and inprd are similar to the functions in class sho and are based upon them.
· The functions x and p are the position and momentum operators, respectively.
[Graphics:../Images/index_gr_41.gif]

Using the two classes, it is possible to calculate the matrix elements of the x and p operators, which are defined as [Graphics:../Images/index_gr_42.gif] and [Graphics:../Images/index_gr_43.gif], where [Graphics:../Images/index_gr_44.gif] and [Graphics:../Images/index_gr_45.gif] are states with amplitude 1 and quantum numbers [Graphics:../Images/index_gr_46.gif] and [Graphics:../Images/index_gr_47.gif], respectively.

Single energy state members of the class lincom are constructed first.

[Graphics:../Images/index_gr_48.gif]

The following are scaled matrix representations of x and p (see [4, p. 103]).

[Graphics:../Images/index_gr_49.gif]
[Graphics:../Images/index_gr_50.gif]
[Graphics:../Images/index_gr_51.gif]
[Graphics:../Images/index_gr_52.gif]

It is also possible to construct time-dependent states s(i, t) after constructing a function [Graphics:../Images/index_gr_53.gif] which gives the energy of a state with quantum number i.

[Graphics:../Images/index_gr_54.gif]
[Graphics:../Images/index_gr_55.gif]

Constructing an equal mixture of the two states s(0, t) and s(1, t),

[Graphics:../Images/index_gr_56.gif]

we compute the expectation value of the position operator, [Graphics:../Images/index_gr_57.gif].

[Graphics:../Images/index_gr_58.gif]
[Graphics:../Images/index_gr_59.gif]

We see that [Graphics:../Images/index_gr_60.gif] oscillates back and forth at frequency [Graphics:../Images/index_gr_61.gif].


Converted by Mathematica      

[Article Index] [Prev Page][Next Page]