def f(x): return x**3-3*x-4 def balayage(f, p): x0 = 1 x1 = ... while ...: x0 = x1 x1 = ... return [x0, x1]