NUMERICAL ANALYSIS FOR ENGINEERING TERM PAPER:

advertisement
NUMERICAL ANALYSIS FOR ENGINEERING
TERM PAPER:
Solving the Schrodinger Equation for a Particle in an Infinite
Potential Well
Eleanor Kaufman
December 9, 1999
CONTENTS:
1.
Introduction
2.
Discussion of Analytical Solution
3.
Discussion of Numerical Techniques
4.
Discussion of Numerical Normalization Techniques
5.
List of Symbols Used
6.
Appendix A: Algorithms to find Eigenvalues
7.
Appendix B: Algorithms to Solve Initial Value Problems
8.
Appendix C: Numerically Determined Eigenfunctions
9.
Appendix D: Selected Normalized Eigenfunctions
10. Appendix E: Error in Normalized Eigenfunctions for 1 st Energy Eigenvalue
11. Appendix F: Error in Normalized Eigenfunctions for 2 nd Energy Eigenvalue
INTRODUCTION
Consider a particle moving in a three dimensional potential field. The wave function, (r,t), is a
description of the probability that the particle will be within a given spatial volume at a given time. The
2
position probability density is given by: P ( r , t )   ( r , t ) dr . Introducing the concept of waveparticle duality, a particle of mass m, well defined momentum p and energy E is described by this wave
function
(r , t )  Ae i ( p.rEt )/  . The Schrödinger equation is a second order differential equation
describing the wave function  that can be derived by differentiating
(r , t )  Ae i ( p.rEt )/  first with
respect to time and then twice with respect to the spatial coordinates. Then the classical relation E 
p2
2m
can be used to equate the two results. (For a more complete description of this derivation, please see
Reference 2). Most generally, the Schrödinger equation involves a 3-dimensional time dependent wave
function (x,y,z,t)= (r,t):
i

2 2
 (r , t )  
  (r , t )
t
2m
The 1 dimensional, time-independent Schrödinger equation is

 2 d 2 ( x)
 V ( x) ( x)  E ( x)
2m dx 2
Since  depends only on x, the derivatives are no longer partial.
The objective of this paper is to explore the 1-dimensional time-independent Schrödinger equation
as it applies to a particle inside of an infinite square potential well. The potential inside of the well is zero,
while the potential outside of the well is infinite. For convenience, the well has been chosen to be centered
about x=0.
0, a  x  a
V 
 , x  a
For the given potential, we see that the wave function must vanish outside of the well, since the probability
that a particle will exist outside of the well is zero:
 ( x)  0, x  a .
Inside the well, the wave function must be determined by solving the Schrödinger equation:

 2 d 2 ( x)
 E ( x),a  x  a .
2m dx 2
There is zero potential inside the well, and infinite potential outside of the well. This infinite discontinuity
in potential allows a discontinuity in the first derivative of (x) at x=+-a. However, (x) itself must still be
continuous over the whole range of x=[-,]. This means that the wave function inside the well and the
wave function outside the well must be equal at the well boundaries:
 inside ( a )   outside ( a )
Since we know that
and  inside (a )   outside ( a ) .
 outside ( x )  0 , we find that  (a)   (a)  0
must be satisfied inside the well.
The wave function inside the well can be solved for analytically, and it can be shown that solutions only
exist for certain discrete values of E. The Schrödinger equation is sometimes written in terms of the
Hamiltonian operator, H. In this case, H= 
2 d 2
2m dx 2
, and the Schrödinger equation becomes H=E.
Using this notation, it can be observed that this is a parallel problem to the matrix eigenvalue problem
Ax=x. The energy E is the eigenvalue, and the wave function (x) is the corresponding eigenfunction.
One important distinction between the matrix eigenvalue problem and the problem of a particle in an
infinite potential well,, however, is that while there are a finite number of eigenvalues for a given matrix A,
there are an infinite number of energy eigenvalues for the given Hamiltonian operator.
The energy eigenvalues and their corresponding eigenfunctions can both be solved for analytically
and approximated numerically. It is helpful to define the problem in a way that is convenient for both
methods. Let the energy be expressed in terms of a constant , such that
equation then becomes
 (
2mE
) . The Schrödinger
2
d 2 ( x )
  ( x ) . A value for the well dimension ‘a’ can be arbitrarily
dx 2
assigned for the purposes of this exercise , and we will choose a=1. The boundary conditions then become
 (1)   (1)  0 .
ANALYTICAL SOLUTON
If we guess (x) is of the form =exp(ikx), and substitute this back into our differential equation,
we can solve for k:
k
2mE
  . The solution is then the linear combination:
2
 ( x )  C1exp(ik )  C2 exp(ik )
Alternatively, the exponential functions can be expressed as linear combinations of the real functions
sin(kx) and cos(kx), recalling the relation exp(i )  cos(i )  i sin(i ) . So, we write:
 ( x )  A cos( kx )  B sin( kx ) ,
where any imaginary part would be included in the constants A and B. Applying the boundary conditions,
we find that (-a)=(a)=0. Since cos(k*a) and sin(k*a) can never both be zero for the same a, either A or B
must be zero. If both A and B are zero we wind up with the physically uninteresting solution (x)=0 for all
x.
We are left with 2 classes of solutions. If B=0, we have solutions of the form (x)=Acos(k*x).
This first class of functions are symmetric about the y-axis, or even functions of x. If A=0, we have
solutions of the form (x)=Bcos(k*x). These functions are antisymmetric, or odd functions of x. Applying
the boundary conditions to the set of even solutions:
Acos(ka)=0
This can only be satisfied for k = n/2*a, where n=1,3,5...

The An are determined based on normalizing the eigenfunctions such that

*
n
( x) n ( x)dx  1 . In this

case the wave function disappears for x >a, so the bounds on the integral can be narrowed to [-a,a]. By
evaluating this integral, it may be determined that
corresponding to the eigenvalues k n are
An 
 n ( x) 
1
for all n. So, the even eigenfunctions
a
1
n
cos
x for positive, odd, integer values of n.
2a
a
The first two even eigenfunctions are plotted below:
The second set of solutions, (x)=Bsin(kx) satisfy the boundary conditions for k n =n/2a, n=2,4,6,...
The corresponding eigenfunctions are  n ( x )

first two odd eigenfunctions are plotted below:
1
n
sin
x , for positive, even, integer values of n. The
2a
a
The first set of eigenfunctions includes an even solution for every positive odd integer n. The
second set of functions includes an odd solution for every positive even integer n. Together, there is an
eigenvalue k n =n/2a and a corresponding solution for  for every positive integer values of n. In this way,
the values of k are discretized. Recalling that k=(constant*E)^(1/2), the energies are therefore also
discretized. The energy eigenvalues can be solved for:
En 
k n2  2  2  2 n 2
n=1,2,3. . .

2m
8ma 2
The lowest possible energy is
 22
8ma 2
. There is no solution for E=0.
For the purposes of comparing our numerical results to the analytical solution, a table is presented
of the first four energy eigenvalues in terms of
 (
2mE
) as defined earlier:
2
n

(x)
1
^2/4 = 2.4674011
cos(x/2)
2
^2 = 9.8696044
sin(x)
3
9^2/4 = 22.20661
cos(3x/2)
4
4^2 = 39.478418
sin(2x)
NUMERICAL SOLUTIONS
Numerical techniques can be employed to discover these energy eigenvalues and their
corresponding eigenfunctions. This is a linear boundary value problem, but the linear shooting technique
described in Reference 1 cannot be used directly because the value for E is unknown. Instead, a slight
variation on that technique was found to be useful. The differential equation for (x), |x|<a, can be written
in the form: ''(x)=-(x), where alpha is 2mE/hbar^2 as described earlier. Since  is not known to begin
with, various values for  are tested. At each value for alpha, a numerical technique is used to solve the
following initial value problem:
 ( x) 
y

 ' ( x ) 
  ' ( x )    ' ( x )   y ( 2) 
y'  



 ' ' ( x )    ( x )   y (1) 
for x=[-a,a], and y0= y(x=-a) ={0;1}.
The initial value chosen for '(x) will only affect the amplitude of the solution. The value of alpha for
which the boundary condition at x=+a is satisfied will not be affected by the choice of '(-1). Normalization
can later be used to correct any error in the eigenfunction. Because the position probability must integrate
2
to 1 over the interval [-,], P ( r , t )   ( r , t ) dr will not be satisfied until


*
n
( x) n ( x)dx  1 .

So, the eigenfunction will not really be a wave function until it has been normalized.
Since the potential is symmetric, the probability distribution will be symmetric, and the wave
functions will be either symmetric or antisymmetric. The even eigen states are distinguished by the fact that
'(0)=0. The odd eigen states are distinguished by the fact that (0)=0. The first energy eigenvalue, n=1,
corresponds to an even eigenfunction, and the slope of that eigenfunction will change sign only once over
the interval [-a,a]. These two pieces of information are used in designing the numerical technique for
finding the value of  that corresponds to the lowest energy eigenvalue.
Initially, a value for  is chosen to be 1, and an initial step size in  is also chosen to be one. At
each value for alpha, the slope at x=0 is determined. As alpha increases, the slope at zero will eventually
change sign from positive to negative (or vice-versa if a negative initial value for ’(-1) is chosen). To find
the first eigen state, alpha is increased until the slope of  at x=0 becomes negative. Then the algorithm
backs up to the previous value of , decreases the  step size, and proceeds to increase  in smaller
increments. This is continued until the slope at x=0 is within the selected tolerance of zero, or until a
maximum number of iterations has been exceeded. This value for alpha can then be compared to theoretical
values for the first energy level. The error will depend both on the error in the numerical method used to
solve the initial value problem and on the closeness of the approximated slope at x=0 to zero.
The second eigenstate, 2, is odd, and to find it the algorithm must be modified to zero in on
(0)=0 at x=0, rather than '(0)=0. To find the next even eigenvalue, 3, the algorithm must be modified
to allow the slope at x=0 to change sign once from positive to negative, and then approach '(0)=0 from the
negative side. To find the next odd eigenstate, the algorithm used to find 2 must be modified to allow  to
increase until (0) has passes through (0)=0 once, stopping the next time (0)=0. The MATLAB codes
for determining each of the first four eigenvalues is presented in Appendix A.
Three different numerical techniques for solving the initial value problem were compared. The
fourth-order Runge-Kutta, the Runge-Kutta Fehlberg, and the Fourth Order Adams Predictor Corrector
method. Each of these algorithms had to be modified slightly from the form presented in Reference 1 to
accommodate a linear system of equations. The MATLAB code is presented in Appendix B. Each
algorithm was run until the value for alpha was within 4 decimal places of the analytical value. The number
of iterations on alpha required in each case, “Count”, is tabulated below, along with the parameters
required by the IVP method to achieve the desired accuracy. The length of the resulting x vector is also
listed, because that is an indication of the number of subdivisions used in the IVP calculation. For
comparison, the results using MATLAB’s ODE23 function are also listed.
IVP method:
RKO4
RKF
ADAMS-P-C
ODE23 (matlab)
alpha1=2.4674
N=17
hmin=0.07
N=16
RelTol=10^-4
Count=31
hmax=0.11
Count=31
Count=33
Length(x)=18
Count=28
Length(x)=17
Length(x)=38
Length(x)=25
Tol=10^-6
alpha2=9.8696
N=47
hmin=0.03
N=61
RelTol=10^-5
Count=35
hmax=0.06
Count=35
Count=33
Length(x)=48
Count=38
Length(x)=62
Length(x)=139
Length(x)=54
Tol=10^-6
alpha3=22.2066
N=88
hmin=0.01
N=109
RelTol=10^-6
Count=48
hmax=0.02
Count=47
Count=49
Length(x)=89
Count=52
Length(x)=110
Length(x)=275
Length(x)=156
Tol=10^-7
alpha4=39.4784
N=132
hmin=0.004
N=212
RelTol=10^-6
Count=62
hmax=0.009
Count=62
Count=62
Length(x)=133
Count=72
Length(x)=213
Length(x)=363
Length(x)=392
Tol=10^-8
Each method was run until the slope at x=0 was within 10^-6 of ’(0)=0 for even states, and until
(0) was within 10^-6 of (0)=0 for odd states. In the case of the Runge-Kutta (RKO4) and the Adams-PC methods, I have also listed the number of subintervals, N, used for the IVP solution. The Runge-KuttaFehlberg method requires that, in addition to a required tolerance, a minimum and a maximum step size be
chosen. For each energy state, there is a maximum value for the minimum step size “hmin”, and a minimum
value for the maximum step size, “hmax”, that will provide a value for alpha with the desired accuracy. If
the “hmin” is chosen to be less than the maximum value, or if the “hmax” is chosen to be greater than the
minimum value, the results are unchanged. The values for “Count”, “Length(x)” and  are not affected. If
the minimum step size is chosen to be too large, the method will not run. If the maximum step size is
chosen to be too small, either the resulting value for alpha will not be within the desired tolerance, or the
length(x) will be larger than necessary, or both. For the RKF method, the maximum “hmin” and the
minimum “hmax” is listed. MATLAB’s ODE23 function requires only that a desired relative tolerance,
“RelTol” be input, and the value for that parameter needed to achieve the desired tolerance on alpha is
listed in the table above. The eigenfunctions for selected cases are plotted in Appendix C. An example of
the progession towards 1 is presented in Appendix G.
For the algorithm presented in this paper, a numerical technique is used to solve the initial value
problem for each iteration on alpha. The total number of operations required for the final approximation of
alpha is then equal to “Count”, (the number of iterations on alpha), times the number of iterations required
within the IVP solver with the given parameters. Each of the IVP methods examined is satisfactory for
calculating the energy eigenvalues. However, as we try to find the higher energy levels, the number of
computations required increases dramatically to get the desired tolerance. At higher energy level, the
eigenfunction is changing more and more “quickly” with x, so smaller step sizes in x are required for the
same tolerances within the IVP solver. As the step size in x decreases (and the value of “Length(x)”
increases), the number of computations within the numerical IVP solver increases. The number of total
calculations required for the final approximated  then increases dramatically.
NORMALIZATION
In order to compare the numerically determined eigenfunctions to the analytically derived
eigenfunctions, the numerically derived function must be normalized so that the integral of the probability
over x=[-,] is equal to 1. Because some of the methods used resulted in a varying step size, I opted to
use a piecewise numerical integration technique to determine the normalization constant. The code for this
function is presented in Appendix B. This added step introduces more error into our approximations for the
eigenvectors. This added error may artificially influence our decisions about the error associated with a
particular numerical initial value technique. The noramlized eigenfunctions for 2 cases are plotted in
Appendix D. The errors in the normalized 1(x) and 2(x) for the various IVP techniques examined in this
paper are plotted in Appendices E and F.
Since we can solve this problem analytically, and since the purpose of this exercise is to compare
the various methods for solving the Schrödinger equation and not to study the effect of step size on the error
in a numerical integration, it would have been judicious to choose our initial guess for yprime so as to equal
that of the exact solution. We found that the normalized eigenfunction for the first energy eigenvalue was:
 ( x) 
1

cos x .
2a
a
The first derivative is then
 ( x)  
1 

sin
x
2a
a 2a
at x=-a, this becomes:
 ( x)  
1 

1 
sin(  ) 
2
a 2a
a 2a
We have chosen a=1, so our preferred initial condition would have been '(- 1)=/2. To generalize this
result to the higher energy eigenvalues, n'(-1)= -(n/2)*sin(n/2)=+-n/2 for even states (n odd), and
n'(-1)= (n/2)*cos(n/2)=+-n/2 for odd states (n even).
CONCLUSION
One technique for discovering the energy eigenvalues and associated eigenvectors of a particle in
an infinite potential well, (a modified linear shooting algorithm) has been explored. A variety of initial
value methods can be used with this technique to satisfactorily determine the first few energy levels and
associated wave functions for the particle. However, if the objective is to find energy levels beyond the first
few, this method quickly becomes unwieldy, regardless of the IVP algorithm employed. Before the
technique is discarded, however, it would be worthwhile one way in which this algorithm might be
improved. As it stands, if a small step size in x is required, that same small step size is used for each
iteration on alpha. If the step size were allowed to remain large until successive iterations on alpha are
quite close to each other, and then the step size in x decreased, the number of computations within each
iteration would be greatly decreased. The number of computations within the IVP solver is directly
proportional to the step size. If the number of computations per iteration is reduced by 1/10 for 3/4 of the
iterations, the total number of computations would be reduced by 67.5%. Choosing a larger initial step size
for alpha will also reduce the number of required calculations, especially as the target energy level gets
larger and larger.
REFERENCES:
1.
2.
Burden, Richard L and J Douglas Faires. Numerical Analysis for Engineering, Brooks, Cole
Publishing Company. Boston, 1997.
Bransden, B.H. and Joachain, C.J. Introduction to Quantum Mechanics. Longman Scientific &
Technical Publishing, New York, 1989.
LIST OF SYMBOLS USED:

“Energy” Eigenvalue, =2mE/hbar^2
Count
Number of iterations on 
E
Energy

DEL Operator =
2
Laplacian Operator =
h
Step Size
H
Hamiltonian Operator
h
Planck’s Constant = 6.62618x10^(34) J s

h/2 = 1.05459x10^(34) J s
length(x)
Length of vectors representing numerical eigenfunctions
m
Mass
N
Number of Subdivisions
p
Momentum
(x)
One dimensional time-independent wave function
(
x
,
(
y
,
2
 x
2
z
,
)
2
 y
2
,
2
2 z
)
Download