Linear and Nonlinear Equations

Exercise 6.14:

Consider a square potential well of width w with walls of height V:

smallwell
Using Schroödinger’s equation, it can be shown that the allowed energies E of a single quantum particle of mass m trapped in the well are solutions of

\tan{\sqrt{w^2 m E / 2 \hbar^2}} = \sqrt{(V-E)/E}    for even numbered states
\tan{\sqrt{w^2 m E / 2 \hbar^2}} = \sqrt{E/(V-E)}    for odd numbered states

where the states are numbered starting from 0, with the ground state being state 0, the first
excited state being state 1, and so forth.

  1. For an electron (mass 9.1094×10−31 kg) in a well with V = 20eV and w = 1nm, write a Python program to plot the three quantities

    y_1 = \tan{\sqrt{w^2 m E / 2 \hbar^2}}, \,\,\,\, y_2 = \sqrt{V-E\over{E}}, \,\,\,\, y_3 = -\sqrt{E\over{V-E}}

    on the same graph, as a function of E from E = 0 to E = 20eV. From your plot make approximate estimates of the energies of the first six energy levels of the particle.

  2. Write a second program to calculate the values of the first six energy levels in electron volts to an accuracy of 0.001 eV using binary search.