','..','$myPermit') ?>
SYLLABUS Previous: 2.5.1 Advection-diffusion equation
Up: 2.5 Implicit Crank-Nicholson
Next: 2.6 Computer quiz
In quantum mechanics, the evolution of a particle is generally modelled
with a complex wave function
. If the particle does't
decay with time, the total probability of finding this particle somewhere
in space of course remains exactly unity at all times
.
Solving the Schrödinger equation normalized to have Planck's constant
, the particle mass
and the static potential
BandMatrixC a = new BandMatrixC(3, h.length); //Complex objects
BandMatrixC b = new BandMatrixC(3, h.length);
Complex[] c = new Complex[h.length];
Complex z = new Complex();
double[] V = physData.getPotential(); //Heavyside(x-L/2) times
double scale = 10.*velocity; // an arb. scaling factor
double dtodx2 = timeStep/(dx[0]*dx[0]);
Complex pih = new Complex(0., 0.5*dtodx2);
Complex mih = new Complex(0.,-0.5*dtodx2);
Complex pip1 = new Complex(1., dtodx2);
Complex mip1 = new Complex(1., -dtodx2);
for (int j=0; j<=n; j++) {
z = new Complex(0.,0.5*scale*timeStep*V[j]);
a.setL(j,mih); //Matrix elements
a.setD(j,pip1.add(z));
a.setR(j,mih);
b.setL(j,pih); //Right hand side
b.setD(j,mip1.sub(z));
b.setR(j,pih);
}
c=b.dot(h); //Right hand side with
c[0]=c[0].add(b.getL(0).mul(h[n])); // with periodicity
c[n]=c[n].add(b.getR(n).mul(h[0]));
hp=a.solve3(c); //Solve linear problem
for (int j=0; j<=n; j++){ //Plot norm & real part
fp[j]=hp[j].norm();
gp[j]=hp[j].re();
}
The code again relies on the complex
BandMatrixC.solve3()
method to solve the linear system efficiently with
The applet below illustrates the scheme with a calculation of the scattering of a wave packet on a square potential barrier.
SYLLABUS Previous: 2.5.1 Advection-diffusion equation Up: 2.5 Implicit Crank-Nicholson Next: 2.6 Computer quiz