Perturbation Theory in Mathematica
Hello,
I've wanted to implement perturbation theory in mathematica for some time now. Here, I've done so for a non-degenerate time independent case. Specifically for the one dimensional harmonic oscillator (not quantum because symbolic constants just make the computation take longer). I tested it on some problems from Shankar's quantum mechanics book and it works.
The things you'll need are:
1. Eigenvalues and eigenfunctions for a solved case (in our case the harmonic oscillator).
$$H0=\frac{\text{$\#$1} x^2}{2}-\frac{\nabla _{\{x\}}^{}\text{$\#$1}}{2}\&$$
\[ScriptCapitalH]0 = -(1/2) Laplacian[#1,{x}] + 1/2 (x^2) #1 &;
\[ScriptCapitalH]1 = x^2 #1 &;
\[ScriptCapitalH] = \[ScriptCapitalH]0[#1] + \[ScriptCapitalH]1[#1] &;
{eigList, wfnList} = DEigensystem[\[ScriptCapitalH]0[u[x]],u[x],{x}\[Element] FullRegion[1], nmax, Method -> "Normalize"];
where nmax is the maximum number of eigenvalues/eigenfunctions to compute. The above code stores the eigenvalues in eigList and the eigenfunctions in wfnList.
2. A perturbation
$$H1=\text{$\#$1} x^4\&;$$
Now let's get cooking! To make things easy we'll just use the notation found here Let's define a function, V, that computes the energy of an unperturbed state with the perturbation's hamiltonian: V[n_, m_] := FullSimplify[Integrate[ExpandAll[FullSimplify[Conjugate[wfnList[[n]]] \[ScriptCapitalH1[wfnList[[m]]]]], {x, -\[Infinity], \[Infinity]}]];
And now a function Ei that computes the difference in energy between two unperturbed states.
Ei[n_, m_] := \[ScriptCapitalE]0[n] - \[ScriptCapitalE]0[m];
Now the energy corrections up to fourth order are given by:
\[ScriptCapitalE]0[n_] := FullSimplify[Integrate[ExpandAll[FullSimplify[Conjugate[wfnList[[n]]]\[ScriptCapitalH]0[wfnList[[n]]]]], {x, -\[Infinity], \[Infinity]}]]
\[ScriptCapitalE]1[n_] := Total[Table[V[n, k2], {k2, DeleteCases[Range[nmax], n]}]]
\[ScriptCapitalE]2[n_] := Total[Table[Abs[V[n, k2]]^2/Ei[n, k2], {k2, DeleteCases[Range[nmax], n]}]]
\[ScriptCapitalE]3[n_] := Total[Flatten[ Table[((V[n, k3]*V[k3, k2]*V[k2, n])/(Ei[n, k2]* Ei[n, k3])) - ((V[n, n] (Abs[V[n, k3]])^2)/(Ei[n, k3]^2)), {k3, DeleteCases[DeleteCases[Range[nmax], n], k2]}, {k2, DeleteCases[Range[nmax], n]}]]]
\[ScriptCapitalE]4[n_] := Total[Flatten[ Table[(V[n, k4]*V[k4, k3]*V[k3, k2]*V[k2, n])/(Ei[n, k2]*Ei[n, k3]* Ei[n, k4]) - ((Abs[V[n, k4]]^2/(Ei[n, k4]^2)) (Abs[ V[n, k2]]^2/(Ei[n, k2]))) - (V[n, n] ((V[n, k4]*V[k4, k3]* V[k3, n])/((Ei[n, k3]^2) Ei[n, k4]))) - (V[n, n] ((V[n, k4]*V[k4, k2]* V[k2, n])/((Ei[n, k4]^2) Ei[n, k2]))) + ((V[n, n]^2) ((V[n, k4]^2)/((Ei[n, k4]^3)))), {k4, DeleteCases[DeleteCases[DeleteCases[Range[nmax], n], k2], k4]}, {k3, DeleteCases[DeleteCases[Range[nmax], n], k2]}, {k2, DeleteCases[Range[nmax], n]}]]]
\[ScriptCapitalE][ n_] := \[ScriptCapitalE]0[n] + \[ScriptCapitalE]1[ n] + \[ScriptCapitalE]2[n] + \[ScriptCapitalE]3[ n] + \[ScriptCapitalE]4[n]
Our ground stateto fourth order is then 0.828125. Pretty close.
In the interest of full disclosure I'm kind of over perturbation theory at this point because I figured out how to implement creation and annihilation operators in Mathematica. That may or may not be next. Tune in for more next time.
Thanks,
Alex Krotz
Comments
Post a Comment