def solve( self ) : return cpt.root_secant( self, self.delta, self.delta + self.dx )
def solve(self): return cpt.root_secant(self, self.delta, self.delta + self.dx)
while True: # loop over levels # estimate next E and dE dE = 0.5 * (schroedinger.E - E_old) E_old = schroedinger.E schroedinger.E += dE # use simple search to locate root with relatively low accuracy accuracy = 0.01 schroedinger.E = cpt.root_simple(schroedinger.F, schroedinger.E, dE, accuracy) #simple_steps = cpt.root_steps() # use secant search with relatively high accuracy accuracy = 1.0e-6 E1 = schroedinger.E + 100 * accuracy # guess second point required schroedinger.E = cpt.root_secant(schroedinger.F, schroedinger.E, E1, accuracy) #secant_steps = cpt.root_steps() #ans = " " + repr(level).rjust(3) + " "*5 + repr(E).ljust(20) + " "*6 #ans += repr(simple_steps).rjust(3) + " "*11 + repr(secant_steps).rjust(3) #print ans level += 1 accuracy = 0.001 x = cpt.root_simple(schroedinger.q, schroedinger.x_left, schroedinger.h, accuracy) swrite = '{0:12.6f} {1:12.6f}'.format( x, schroedinger.E ) print swrite x = cpt.root_simple(schroedinger.q, schroedinger.x_right, -schroedinger.h, accuracy) swrite = '{0:12.6f} {1:12.6f}'.format( x, schroedinger.E ) print swrite