Input := <<Quantum`QuickReIm` <<Algebra`Trigonometry` <<Graphics`Animation`
Definition of constants
Input := m=1; k=1; hbar=1; beta=Sqrt[m*k/hbar^2]; y=Sqrt[beta]x;
Wave functions and energy of a harmonic oscilator
Input := psi[n_,x_] := Sqrt[(1/(2^n*n!))*Sqrt[beta/Pi]] * HermiteH[n, y] * Exp[- y^2 /2] e[n_]:=(n + 1/2)*hbar*Sqrt[k/m]
Now we can choose two quantum states, n1 and n2:
Input := n1=0; n2=1;
Definition of a time-dependent wave function
Input := PSI[x_,t_] := a(Exp[-I e[n1] t/hbar] psi[n1,x] + Exp[-I e[n2] t/hbar] psi[n2,x])
Absolute square root of the time-dependent wave function
Input := AbsSqrPsi[x_,t_]=Conjugate[PSI[x,t]]*PSI[x,t]\ //ComplexToTrig//TrigReduce//Simplify
Output =
2 2
a (1 + 2 x + 2 Sqrt[2] x Cos[t])
----------------------------------
2
x
E Sqrt[Pi]
Normalization
Input :=
norm=Integrate[AbsSqrPsi[x,t], {x, -Infinity, Infinity}]
General::intinit: Loading integration packages -- please wait.
Output = 2 2 a
Input := a=a/.Solve[norm == 1, a]
Output =
1 1
{-(-------), -------}
Sqrt[2] Sqrt[2]
Input := a=a[[2]]
Output = 1 ------- Sqrt[2]
Input :=
Plot[AbsSqrPsi[x,2Pi], {x,-3,3}]

Output = -Graphics-
Animation:
The next command will generate a set of plots. To do actual animation select graphics and go to the Graph menu and choose Animate Selected Graphics. To stop animation use control buttons which will appear at the bottom of the window.
Note: It may take some time before Mathematica will respond to pressing any of these buttons!
Input :=
Animate[Plot[AbsSqrPsi[x,t], {x,-3,3}, Axes->False],
{t,0,2 Pi,2 Pi/20}]





















