title: ground state energy of a wavefcn with bisection method
body: <p>I am looking for the ground state energy of the wavefcn that can fit in a given potential:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import math
  ximin=-8
  ximax=-ximin
  Nsteps=1001
  nu0=4.0
  
  psi = np.linspace(ximin,ximax,Nsteps)
  h = psi[1] - psi[0]
  
  v = -nu0*np.exp(-psi**2) #potential
  
  Emin = -3.5 #first two guesses
  
  Emax = -2.0
  
  
  
  
  while ((Emin- Emax)/(Emin + Emax) &gt; 10**(-8)): #tolerance
  if abs(fi[-1]) &gt; abs(10**(-8)): #condition that the wavefcn doesnt blow up
      Eo = (Emin + Emax)/2.0
      if fi[-1] &lt; -10**(-8): #blows down
          Emax = Eo
      if fi[-1] &gt; 10**(-8): #blows up
          Emin = Eo
  else:
      break
  
  fi = np.zeros(Nsteps)
  fi[0]= 1
  k = (-Eo)**(0.5)
  fi[1] = np.exp(k*h)
  
  for i in range(2,len(psi)):
      fi[i]=(2+h**2 * (v[i-1]-Eo))*fi[i-1]-fi[i-2] #wavefcn
  
  
  
  plt.plot(psi, fi)
  </code></pre>
  
  <p>the idea is that when the energy that we plug in is wrong, the wavefcn either blows up or down. Then for example we take an energy that is in the middle between the previous two and if that one blows up, then we will look for a new value between this last one and the one that blows down and so on . I should get a good energy value but I dont. Can anyone help?</p>