For this exercise, you will time evolve the wavefunction Ψ(x,0) which is a mixture of the 1st, 2nd, and 3rd stationary states for the infinite potential well. First pick YOUR OWN values for the expansion coefficients (Subscript[c, 1]), (Subscript[c, 2]) and (Subscript[c, 3]). Remember that we must have ((Subscript[c, 1])^2)+((Subscript[c, 2])^2)+((Subscript[c, 3])^2)=1.

ψ[n_,x_]:=(Sqrt[(2/a)]) Sin[((n π x)/a)]
a=1;
c1=(Sqrt[(3/10)]);
c2=(Sqrt[(5/10)]);
c3=(Sqrt[(2/10)]);
Ψ[x_]:=c1 ψ[1,x]+c2 ψ[2,x]+c3 ψ[3,x]

Let’s plot the wavefunction to see what it looks like:

Plot[Ψ[x],{x,0,a}]

Now let’s plot the probability density to see where we are most likely to find the particle if we measure its position.

Plot[((Ψ[x])^2),{x,0,a}]

Check that your wavefunction is properly normalized (if you picked your (Subscript[c, n])’s correctly this should be one).

Integrate[((Ψ[x])^2),{x,0,a}]

Now let’s determine Ψ(x,t) by attaching the correct time dependent exponent to each stationary state term in the wavefunction’s expansion. First we’ll define the energy levels (Subscript[E, n]) that we learned for the infinite potential well.

En[n_]:=(((n^2)(π^2) (h^2))/(2 m (a^2)))
h=1;
m=1;
Ψ[x_,t_]:=c1 ψ[1,x] (E^((-I En[1] t)/h))+c2 ψ[2,x] (E^((-I En[2] t)/h))+c3 ψ[3,x] (E^((-I En[3] t)/h))

Now let’s create an animated plot of |Ψ(x,t)((|)^2) to see how the probability density changes over time (loosely speaking, the particle is bouncing around inside the potential well). Notice that I can’t simple square Ψ(x,t) in the Mathematica code - it now contains complex numbers! I must actually square its absolute value using ((Abs[Ψ(x,t)])^2). That will take care of everything for us.

When deciding on a duration over which to animate your wavefunction, recall that in an infinite potential well, every wavefunction will return to its original state after a time T called its revival time (problem #3 from homework #3). This makes a good duration for a repeating animation.

Note that the “AnimateRate” command slows the animation down. Make the animation rate a smaller number to slow it down more (or bigger to speed it up).

T=((4 m (a^2))/(π h));
Animate[Plot[((Abs[Ψ[x,t]])^2),{x,0,a},PlotRange->{0,5}],{t,0,T},AnimationRate->(1/10),AnimationRunning->False]

Look at it dance!

Now we can actually create a gif using the Mathematica Export command. This command takes a list of plots (generated by the Table command) and strings them together into a gif. Notice that t runs from 0 to 100 and thereby increases the time at which Ψ(x,t) is evaluated in uniform increments from zero to T. This means that the gif has 100 frames.

Export["Evolution.gif",Table[Plot[((Abs[Ψ[x,((t/100)) T]])^2),{x,0,a},PlotRange->{0,5}],{t,0,100}]]

Lastly, we just ask Mathematica to open the gif we created using the following command.

SystemOpen["Evolution.gif"]