31.12.2013 Views

Numerical Methods in Quantum Mechanics - Dipartimento di Fisica

Numerical Methods in Quantum Mechanics - Dipartimento di Fisica

Numerical Methods in Quantum Mechanics - Dipartimento di Fisica

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

eigenvalue) to force the code to perform an <strong>in</strong>tegration at fixed energy and see<br />

the result<strong>in</strong>g wave function. It is useful for test<strong>in</strong>g purposes and to better understand<br />

how the eigenvalue search works (or doesn’t work). Note that <strong>in</strong> this<br />

case the required number of nodes will not be honored; however the <strong>in</strong>tegration<br />

will be <strong>di</strong>fferent for odd or even number of nodes, because the parity of n<br />

determ<strong>in</strong>es how the first two grid po<strong>in</strong>ts are chosen.<br />

The output file conta<strong>in</strong>s five columns: respectively, x, ψ(x), |ψ(x)| 2 , ρ cl (x)<br />

and V (x). ρ cl (x) is the classical probability density (normalized to 1) of the<br />

harmonic oscillator, given <strong>in</strong> Eq.(1.19). All these quantities can be plotted as a<br />

function of x us<strong>in</strong>g any plott<strong>in</strong>g program, such as gnuplot, shortly described <strong>in</strong><br />

the <strong>in</strong>troduction. Note that the code will prompt for a new value of the number<br />

of nodes after each calculation of the wave function: answer -1 to stop the code.<br />

If you perform more than one calculation, the output file will conta<strong>in</strong> the result<br />

for all of them <strong>in</strong> sequence. Also note that the wave function are written for<br />

the entire box, from −x max to x max .<br />

It will become quickly evident that the code “sort of” works: the results<br />

look good <strong>in</strong> the region where the wave function is not vanish<strong>in</strong>gly small, but<br />

<strong>in</strong>variably, the pathological behavior described <strong>in</strong> Sec.(1.2.2) sets up and wave<br />

functions <strong>di</strong>verge at large |x|. As a consequence, it is impossible to normalize<br />

the ψ(x). The code def<strong>in</strong>itely needs to be improved. The proper way to deal<br />

with such <strong>di</strong>fficulty is to f<strong>in</strong>d an <strong>in</strong>herently stable algorithm.<br />

1.3.2 Code: harmonic1<br />

Code harmonic1.f90 3 (or harmonic1.c 4 ) is the improved version of harmonic0<br />

that does not suffer from the problem of <strong>di</strong>vergence at large x.<br />

Two <strong>in</strong>tegrations are performed: a forward recursion, start<strong>in</strong>g from x = 0,<br />

and a backward one, start<strong>in</strong>g from x max . The eigenvalue is fixed by the con<strong>di</strong>tion<br />

that the two parts of the function match with cont<strong>in</strong>uous first derivative (as<br />

required for a physical wave function, if the potential is f<strong>in</strong>ite). The match<strong>in</strong>g<br />

po<strong>in</strong>t is chosen <strong>in</strong> correspondence of the classical <strong>in</strong>version po<strong>in</strong>t, x cl , i.e. where<br />

V (x cl ) = E. Such po<strong>in</strong>t depends upon the trial energy E. For a function<br />

def<strong>in</strong>ed on a f<strong>in</strong>ite grid, the match<strong>in</strong>g po<strong>in</strong>t is def<strong>in</strong>ed with an accuracy that is<br />

limited by the <strong>in</strong>terval between grid po<strong>in</strong>ts. In practice, one f<strong>in</strong>ds the <strong>in</strong>dex icl<br />

of the first grid po<strong>in</strong>t x c = icl∆x such that V (x c ) > E; the classical <strong>in</strong>version<br />

po<strong>in</strong>t will be located somewhere between x c − ∆x and x c .<br />

The outward <strong>in</strong>tegration is performed until grid po<strong>in</strong>t icl, yield<strong>in</strong>g a function<br />

ψ L (x) def<strong>in</strong>ed <strong>in</strong> [0, x c ]; the number n of changes of sign is counted <strong>in</strong> the<br />

same way as <strong>in</strong> harmonic0. If n is not correct the energy is adjusted (lowered<br />

if n too high, raised if n too low) as <strong>in</strong> harmonic0. We note that it is not<br />

needed to look for changes of sign beyond x c : <strong>in</strong> fact we know a priori that <strong>in</strong><br />

the classically forbidden region there cannot be any nodes (no oscillations, just<br />

decay<strong>in</strong>g solution).<br />

If the number of nodes is the expected one, the code starts to <strong>in</strong>tegrate<br />

<strong>in</strong>ward from the rightmost po<strong>in</strong>ts. Note the statement y(mesh) = dx: its only<br />

3 http://www.fisica.uniud.it/%7Egiannozz/Corsi/MQ/Software/F90/harmonic1.f90<br />

4 http://www.fisica.uniud.it/%7Egiannozz/Corsi/MQ/Software/C/harmonic1.c<br />

13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!