Steffensen's method: Difference between revisions

Content deleted Content added
inserted blank line
Line 119:
 
def steff(f: Func, x: float, tol: float) -> Iterator[float]:
"""SteffensonSteffensen algorithm for finding roots.
 
This recursive generator yields the x_{n+1} value first then, when the generator iterates,
Line 131:
 
while True:
 
if n > 1000:
print( "failed to converge in 1000 itterationsiterations" )
break
else:
Line 146 ⟶ 145:
x = x - fx / gx # Update to x_{n+1}
yield x # Yield value
 
</syntaxhighlight>