Newton tangent Iteration

Clear[f,x]
f[x_] = (x + 1)^3 -4

pt2 = Plot[f[x],{x,0,3},PlotStyle -> Red]

FindRoot[f[x],{x,3}]

x0 = 3. 
f0 = f[x0]

x1 = 2.
f1 = f[x1]

Newton secant iteration

Newton secant iteration

ss[aa_,bb_] = (aa f[bb] - bb f[aa])/(f[bb] - f[aa])

ss[x0,x1]

b1 = %
a1 = x0

l1 = ll[a1,b1]

Show[ps, Graphics[{l0,l1}]]

ss[a1,b1]

f[%]

a2 = %%
b2 = b1

l2 = ll[a2,b2]

Show[ps, Graphics[{Green,l0, l1,Hue[0.6],l2}], ImageSize ->  700]

ss[a2,b2]

f[%]

a3 = %%
b3 = b2

ss[a3,b3]

f[%]

a4 = %%
b4 = b3

ss[a4,b4]

f[%]

a5 = %%
b5 = b4

ss[a5,b5]

f[%]

a6 = %%
b6 = b5

ss[a6,b6]

f[%]

a6 = %%
b6 = a5

ss[a6,b6]

f[%]

va[aa_] = Line[{{aa,0},{aa,fs[aa]}}];
vb[bb_] = Line[{{bb,0},{bb,fs[bb]}}];

va0 = va[a0];
vb0 = vb[b0];
va1 = va[a1];
vb1 = vb[b1];
va2 = va[a2];
vb2 = vb[b2];

ttx = {Text["(Subscript[a, 0]) = (Subscript[a, 1])",{a0, 0.075}],Text["(Subscript[b, 0])",{b0, -0.075}],
Text["f((Subscript[b, 0]))",{b0,fs[b0]+0.075}],Text["f((Subscript[a, 0])) = f((Subscript[a, 1]))",{a0,fs[a0]-0.15}],
Text["(Subscript[b, 1])=(Subscript[b, 2])",{b1,-0.075}],Text["f((Subscript[b, 1]))=f((Subscript[b, 2]))",{b1,fs[b1]+0.15}],
Text["(Subscript[a, 2])",{a2, 0.075}],Text["f((Subscript[a, 2]))",{a2 + 0.02,fs[a2]-0.075}], Text[Style["f(x)",Red,16],{3.5,1.35}]};
Show[ps, Graphics[{va0,vb0,va1,vb1,va2,vb2,Green,l0, l1,Hue[0.6],l2}],
Epilog -> ttx, ImageSize ->  600, Ticks -> None]