Entrada: Una función continua f , las aproximaciones iniciales a y b, y maxItr
Resultado: Una aproximación xk del cero. 1 k = 0, x0 = a ; 2 repeat ′ ′ ′ 3 test1 = ( f (x0) > 0 ∧ (a − x0) f (x0) < −1 f (x0) ∧ (b − x0) f (x0) > −1 f (x0)); ′ ′ ′ 4 test2 = ( f (x0) < 0 ∧ (a − x0) f (x0) > −1 f (x0) ∧ (b − x0) f (x0) < −1 f (x0)); 5 if test1 Or test2 Or f (x0) = 0 then ′ 6 x1 = x0 − f (x0)/ f (x0); 7 dx = |x1 − x0|; 8 x0 = x1; 9 if Sgn( f (a)) <> Sgn( f (x1)) then 10 b = x1 11 else 12 a = x1 13 else 14 x1 = a + 0.5 ∗ (b − a); 15 dx = (b − a)/2; 16 x0 = x1; 17 if Sgn( f (a)) <> Sgn( f (x1)) then 18 b = x1 19 else 20 a = x1 21 k = k + 1; 22 until dx < delta Or k > maxItr ; 23 return x1