Content deleted Content added
tidy up math typesetting |
order of operations for non-wasted last step |
||
Line 99:
Here is the source for an implementation of Steffensen's method in [[Python (programming language)|Python]].
:<syntaxhighlight lang="python">
from typing import Callable, Iterator
Func = Callable[[float], float, float]
Line 125:
while True:
fx = f(x)
gx = g(f, x, fx)(x)▼
if abs(fx) <= tol:
break
else:
▲ gx = g(f, x, fx)(x)
x = x - fx / gx # Update to x_{n+1}
yield x # Yield value
|