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}]

t[x_]= x - f[x]/D[f[x],x]

t[3.]

ln = Prepend[Table[Nest[t,3.,k],{k,6}],3.]

lv = Table[{ln[[k]],f[ln[[k]]]},{k,Length[ln]}]

lvv = Map[(Line[{#,{#[[1]],0}}]) &,lv]

lt = Table[Line[{lv[[k]],{lv[[k+1,1]],0}}],{k,Length[ln]-1}]

ptnlm = Show[pt2,Graphics[lvv],Graphics[{Blue,lt}],
Epilog -> {Text[Subscript["x",0],{3,-0.5}],Text["f((Subscript[x, 0]))",{3,61.}],
Text[Subscript["x",1],{1.75,-0.5}],Text["f((Subscript[x, 1]))",{1.75,17.8}],
Text[Subscript["x",2],{1.01,-0.5}],Text["f((Subscript[x, 2]))",{1.01,5.2}],
Text[Style["f(x)",Red,16],{2.1,31.}]},Ticks -> None,
AspectRatio -> 1.5, ImageSize -> 500]

ptnl = Show[pt2,Graphics[lvv],Graphics[{Blue,lt}],PlotLabel -> "Newton Iteration",
Epilog -> {Text[Subscript["x",0],{3,-1.}],Text["f((Subscript[x, 0]))",{3,61.}],
Text[Subscript["x",1],{1.75,-1.}],Text["f((Subscript[x, 1]))",{1.75,18.3}],
Text[Subscript["x",2],{1.01,-1.0}],Text["f((Subscript[x, 2]))",{1.01,5.7}],
Text[Style["f(x)",Red,16],{2.1,31.}]},Ticks -> None,
AspectRatio -> 1.5, ImageSize -> 500]

Show[ptnl,ImageSize -> 200]

Newton secant iteration

Newton secant iteration

a = 2.3

fs[x_]=  ArcTan [x - a ] + 0.25

b0 = 5.97;
a0 = .6;

ll[aa_,bb_] =Line[{{aa,fs[aa]},{bb,fs[bb]}}]

l0 = ll[a0,b0]

ps = Plot[fs[x],{x,-2,6},PlotStyle -> Red, AspectRatio -> 0.6]

Show[ps, Graphics[{l0}]]

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

ss[a0,b0]

fs[%]

b1 = %%
a1 = a0

l1 = ll[a1,b1]

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

ss[a1,b1]

fs[%]

a2 = %%
b2 = b1

l2 = ll[a2,b2]

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

ss[a2,b2]

fs[%]

a3 = %%
b3 = b2

ss[a3,b3]

fs[%]

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]