Excercise sheet 9 -- solutions
Schrödinger equation
1. Try to find the first excited state of the hydrogen atom and the corresponding wavefunction.
2. When solving the eigenvalue E we do not necessarily need to write a loop ourselves. We are only looking for a root of the function Δ(E), so, if we can write Δ as a Mathematica function, we can use the FindRoot command to locate the energies E. Try to do this. You can use the Module command to wrap the commands for calculating Δ into a function. Module command takes two arguments, first a list of local variables (that is, variables that you only use inside the function) and second, the commands separated by semicolons (;). Inside the Module command, you can use the Return -command to return the value for delta. Your function Δ in Mathematica could look something like this:
Delta[e_] := Module[
{sol0, sol1, …},
sol0=NDSolve[{eq, …];
…
diff = ...
Return[diff]];
You can now plot the function Delta, and use FindRoot to get the energy eigenvalues!
| Created by Mathematica (April 10, 2007) |