#NEWLINE# def __iter__( self ) : #NEWLINE# #INDENT# method = self . method #NEWLINE# f = self . f #NEWLINE# a = self . a #NEWLINE# b = self . b #NEWLINE# fa = f ( a ) #NEWLINE# fb = f ( b ) #NEWLINE# m = None #NEWLINE# while True : #NEWLINE# #INDENT# l = ( b - a ) #NEWLINE# if ( l == 0 ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# s = ( ( fb - fa ) / l ) #NEWLINE# z = ( a - ( fa / s ) ) #NEWLINE# fz = f ( z ) #NEWLINE# if ( abs ( fz ) < self . tol ) : #NEWLINE# #INDENT# if self . verbose : #NEWLINE# #INDENT# print_ ( 'canceled with z =' , z ) #NEWLINE# #UNINDENT# ( yield ( z , l ) ) #NEWLINE# break #NEWLINE# #UNINDENT# if ( ( fz * fb ) < 0 ) : #NEWLINE# #INDENT# a = b #NEWLINE# fa = fb #NEWLINE# b = z #NEWLINE# fb = fz #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# m = self . getm ( fz , fb ) #NEWLINE# b = z #NEWLINE# fb = fz #NEWLINE# fa = ( m * fa ) #NEWLINE# #UNINDENT# if ( self . verbose and m and ( not ( method == 'illinois' ) ) ) : #NEWLINE# #INDENT# print_ ( 'm:' , m ) #NEWLINE# #UNINDENT# ( yield ( ( ( a + b ) / 2 ) , abs ( l ) ) )