Is Schrödinger's Cat
Object-Oriented? - Chapter 3




III. The Object Model
and
Quantum Physics

Objects, the basic units in OO design, have state, behavior and identity. Methods or member functions are operations that act upon objects and may modify their states. These concepts are introduced in this section using analogies with QP. Since linear algebra is the mathematical language of quantum mechanics, these analogies between OM and QP are also expressible in the linear algebra language.

In QP[5]], the description of the state of a system (say, a particle) at a given time is defined by specifying its state vector. This vector belongs to the state space E (which comprises all possible states of the system). The set of distinct states of a system can either be finite or infinite (countable or continuous). [Of course, the computer representation of the state space is always finite]. The description of the state of an object in the OM follows from the above by just replacing "system" (or "particle") by "object". Examples:

1) Consider an Ising spin or Boolean variable. This object can only take two values: up (on or 1) and down (off or -1). These two distinct states can be represented by the vectors

We have used the so-called Dirac notation | > to denote a state vector. This example is easily generalizable for objects with 3, 4,... states.

Given the two states up and down, in QP a state vector could be any linear combination of these two basis vector. The only constraint is that vectors are normalized (i.e., the norm of the vector should be unity). Hence, a more general state vector |s> for the two-state system has the form

The interpretation is the following: the spin is in a state with probability cos^2 (theta) to be |up>, and sin^2 (theta) to be |down>. Conservation of probability (i.e., cos^2 (theta) + sin^2 (theta) = 1) constrains the state vectors to be normalized.

In our C++ design, an object of the type Ising spin is denoted anIsingSpin . This object encapsulates data, i.e., the value of the spin +1 or -1, and methods such as Flip() , discussed later. In the OO literature usually one assigns either state |up> or |down> to the object, but not some linear combination of these two vectors. An object, in the common OM usage, resembles more a "classical" entity than "quantum" one. This is not a limitation of the OM. In fact, the OM is equally suited to model quantum mechanics by assigning a "probabilistic" interpretation to the states of an object.

2) Consider a "classical" three dimensional real vector object. In this case there is a continuum of states. Once a coordinate system is chosen, say, Cartesian, states are labeled by the x, y and z coordinates of the vector. Our vector object can be represented in the Dirac notation as |x, y, z>. In our C++ model, we just call it aVector3D and model it as a 3-dimensional array. The coordinates x, y and z are the data that the object encapsulates. There are methods such as RotateZ(theta) discussed later which act on the object's data and produce a rotated vector.

3) Consider a spinless particle. It is described by its state vector |k> with k = (kx, ky, kz) the linear momentum coordinates. The quantities ki, i =x, y and z are real numbers. An alternative description of the same particle might be in terms of the position state vector |x> with x a three dimensional vector, i. e., x = (x, y, z). The particle state vector is related to the probability of finding the particle in a particular spacial region (or with a particular value of linear momentum). In our design, we denote the particle aParticle. It encapsulates data (say the value k of the momentum) and methods such as MomentumTransfer() given below.

Identity [1,2] is the property that distinguishes an object from all other objects. For example, this proton, now in my mouth, is not the same as (but it is identical to) that proton now at a distant galaxy. In QP each object defines its own vector space spanned by a complete set of linearly independent vectors associated with all its possible states. In the OM common usage, identity of objects is always preserved even when states are completely changed. A proton object is still the same object even if its momentum and spin changes because of interaction with other objects. In other words, identity means that there is a unique state vector space associated with each object. Although in classical physics identity is always preserved, in quantum physics and Nature, sometimes an object could either have a "non-sharp" identity, or even completely lose its identity. This could, but usually is not, be modelled in the OM,[3] and it is further discussed in the following sections.

Behavior[1,2] is how an object acts or reacts in the presence of other objects, i.e., how it interacts with the external world. Behavior could also be defined as response to actions (i.e., response function). Operations that affect the object and possibly modify its state are called methods or, in the C++ terminology, member functions. In QP, methods correspond to operators, that is, the state of the system is modified by applying an operator (i.e., a matrix) O on the state vector |s1>, producing a new vector | s2> as a result, i.e.,

| s2> = O | s1> ;

The above operation might be written in the OM language (employing C++ notation) as

myObject.SetState(s2);

where myObject is an object whose initial state is s1, and that makes a transition to s2 after applying the method SetState() . This is an oversimplified representation as the SetState() method is independent of the initial state s1. A better design might be

myObject.ChangeState(r);

where r = s2 -s1 is the "distance" between the states s1 and s2.

In QP, operators are linear (i.e., represented by matrices) acting on linear vector spaces. On the other hand, in real life OO design, operators often are not linear. OO designs commonly employ operations that either change the state of objects (for example, set-methods) or access their state (get-methods). Get-methods measure some object's observables (or in the OO language, read the data encapsulated by the object). Besides these, there are two very important methods called constructor and destructor, which create and annihilate objects. As it could be guessed, they are closely related to the creation and annihilation operators of second quantized quantum mechanics, and they are discussed in the following section. Now we provide some examples,

1) For anIsingSpin object, we might have the following methods (operators)

The method Flip() changes the state of the system, i.e., switches the state of the spin object (i.e., up <-> down). In our C++ design we write

anIsingSpin.Flip();

where anIsingSpin is an object of the type (class) TIsingSpin, initially in some state, say |up>. Application of the method Flip() , flips the spin so now anIsingSpin is in the state |down>. An alternative, matrix representation of this operation (assuming the initial state of anIsingSpin was up) is

The methods SetUp() and SetDown() (set-methods) set the state of the spin to up and down, irrespective of the previous state. Finally, the eigenvalues of GetSpin() provide the actual values of the spin (either up or down). In other words, |up> and |down> are eigenvectors of the GetSpin() operator with eigenvalues 1 and -1, respectively. In general, in the object model (and more general modeling) it might not be possible to define Get operators (as in QP) such that their eigenvalues provide the only possible results of measurements.

2) For the TVector3D object one can define, among others, the following method

which rotates any TVector3D object, given in Cartesian coordinates, counterclockwise an angle theta around the z axis. In C++ notation, this operation can be written as

aVector3D.RotateZ(theta);

where the object aVector3D is of type TVector3D (that is, is a real three dimensional vector). After applying the method RotateZ(theta) to aVector3D, it changes state, rotating an amount (theta) around the z axis.

3) The linear momentum operator P [denoted GetMomentum() in our design] accesses the state of the proton (say, aProton) and reads its data,

P | p> = p |p > ,

in C++ this reads,

aProton.GetMomentum();

Usually one also defines a momentum transfer operator, MomentumTransfer(), which when acting on aProton, changes the value of its momentum from p1 to p2 (alternatively, in a simpler model we might have defined a SetMomentum() method). In this note, and for simplicity we do not provide any mathematical representation of the momentum state vectors and operators, and just use the more general (basis independent) Dirac notation [6].

Here we summarize the correspondence between OM, QP and linear algebra :

TABLE 1. The Object Model, Quantum Mechanics and Linear Algebra


Object Model Quantum Mechanics Linear Algebra
an object a quantum particle  
state state vector vector
method/member function observable/operator matrix
behavior response function  
encapsulation state vector space vector space




JavaTM is a trademark of Sun Microsystems, Inc.

Microsoft, Windows and Windows NT are registered trademarks of Microsoft Corporation.

Other companies, products, and service names may be trademarks or service marks of others.

Copyright    Trademark



  Java Education Java Home  
IBM HomeOrderEmployment