The solvers in the previous problem set require your input to provide the initial bounds E1 and E2 for each state. This is impractical when we wish to find all of the states for many different atoms. This process, fortunately, can be automated by exploiting a mathematical fact about the number of nodes in the solutions.
The lowest energy state is always guaranteed to have zero nodes (never
cross the x axis), and each subsequent state is guaranteed to have one
additional node (cross the x axis one more time than the previous
solution). This implies that if the energy E1 gives
nodes and
energy E2 gives
nodes, then only one state, the one with
nodes, lies between E1 and E2. A call to zriddrp480() then is
guaranteed to find the state with
nodes.
Thus, if we can find a method to always find states with a given number of nodes, we can use this to systematically generate all of the solutions. Our strategy for doing this is to first define a function which returns the difference between number of nodes at energy E and the desired number of nodes. Then, we simply find the value of E which makes this function zero by calling rtbisp480()!