#NEWLINE# def __iter__( self ) : #NEWLINE# #INDENT# f = self . f #NEWLINE# x0 = self . x0 #NEWLINE# x1 = self . x1 #NEWLINE# x2 = self . x2 #NEWLINE# fx0 = f ( x0 ) #NEWLINE# fx1 = f ( x1 ) #NEWLINE# fx2 = f ( x2 ) #NEWLINE# while True : #NEWLINE# #INDENT# fx2x1 = ( ( fx1 - fx2 ) / ( x1 - x2 ) ) #NEWLINE# fx2x0 = ( ( fx0 - fx2 ) / ( x0 - x2 ) ) #NEWLINE# fx1x0 = ( ( fx0 - fx1 ) / ( x0 - x1 ) ) #NEWLINE# w = ( ( fx2x1 + fx2x0 ) - fx1x0 ) #NEWLINE# fx2x1x0 = ( ( fx1x0 - fx2x1 ) / ( x0 - x2 ) ) #NEWLINE# if ( ( w == 0 ) and ( fx2x1x0 == 0 ) ) : #NEWLINE# #INDENT# if self . verbose : #NEWLINE# #INDENT# print_ ( 'canceled with' ) #NEWLINE# print_ ( 'x0 =' , x0 , ', x1 =' , x1 , 'and x2 =' , x2 ) #NEWLINE# #UNINDENT# break #NEWLINE# #UNINDENT# x0 = x1 #NEWLINE# fx0 = fx1 #NEWLINE# x1 = x2 #NEWLINE# fx1 = fx2 #NEWLINE# r = self . ctx . sqrt ( ( ( w ** 2 ) - ( ( 4 * fx2 ) * fx2x1x0 ) ) ) #NEWLINE# if ( abs ( ( w - r ) ) > abs ( ( w + r ) ) ) : #NEWLINE# #INDENT# r = ( - r ) #NEWLINE# #UNINDENT# x2 -= ( ( 2 * fx2 ) / ( w + r ) ) #NEWLINE# fx2 = f ( x2 ) #NEWLINE# error = abs ( ( x2 - x1 ) ) #NEWLINE# ( yield ( x2 , error ) )