Theory.
Suppose you have a complex-valued function with the prototype
complex F(complex);and you want to solve the complex equation
F(z)=0
with the help of gsl_multiroots package. What will
be your gsl_multiroot_function?
Practice.
Introduction:
The s-wave radial Schrödinger equation for the Hydrogen atom reads (in units "Bohr radius" and "Hartree"),
-(1/2)f'' -(1/r)f = εf ,
where f(r) is the radial wave-function, ε is the energy, and primes denote the derivative over r.The bound s-state wave-function satisfies this equation and the two boundary conditions,
f(r → 0) = r-r², (prove this)
f(r → ∞) = 0 .
These two boundary conditions can only be satisfied for certain discrete values of the energy.
Since one cannot integrate numerically to ∞ one substitutes ∞ with a reasonably large number, rmax, such that it is much larger than the typical size of the hydrogen atom but still managable for the numerical inregrator (say, rmax = 10 Bohr radii),
f(rmax)=0 .
Let Fε(r) be the solution (to be found numericall
via gsl_odeiv) to our differential equation with energy
ε and initial condition Fε(r → 0)=r-r².
Generally, for a random negative ε, this solution will not satisfy the
boundary condition at rmax. It will only be satisfied when
ε is equal one of the bound state energies of the system.
Now define an auxiliary function
M(ε) ≡ Fε(rmax) .
The shooting method is then equivalent to finding the root of the equation
M(ε) = 0 .
(Optional) Try also to use a more precise boundary condition for bound states (which have ε<0),
f(r → ∞) = r e-kr , (prove this)
where k=√(-2ε). This should allow you to use a smaller rmax.