MÉTODO DE NEWTON- EXEMPLOS

(*Método de Newton : NewtonPlot*)
\(\(NewtonPlot[x0_, fx_, {x_, xmin_, xmax_}, 
            thick__]\)\(:=\)\(Module[{xi = {x0}, p, l1, l2}, 
		p = 
              Plot[fx, {x, xmin, xmax}, DisplayFunction -> Identity, 
                PlotStyle -> {Thickness[
                      thick]}]; 
\ \ Continua = 
              Sim; 
		While[
              Continua == Sim, 
AppendTo[xi, 
                Last[xi] - \((fx /. x -> Last[xi])\)/\((D[fx, x] /. 
                        x -> Last[xi])\)]; 
		l1 = 
                Graphics[
                  Join[{RGBColor[1, 0, 0], Thickness[thick]}, 
                    Map[Line[{{#, 0}, {#, fx /. x -> #}}] &, 
                      xi]]]; 		
		l2 = 
                Graphics[
                  Join[{RGBColor[1, 0, 0], Thickness[thick]}, 
                    Map[Line[{{xi[\([#]\)], 
                              fx /. x -> xi[\([#]\)]}, {xi[\([# + 1]\)], 
                              0}}] &, Range[Length[xi] - 1]]]]; 
		Show[p, 
                l1, l2, 
			DisplayFunction -> $DisplayFunction]; 
Print["Iterada=", 
                Last[xi]]; 
Continua = 
                Input["Continuar?"];
]]\)\(
\)\)

Função em estudo : 
f[x] = 
      (e^(x - 2))  -  (x^2)/3

f[x_] = Exp[x - 2] - x^2/3;
Plot[f[x], {x, -1, 5}, 
      PlotStyle -> {Thickness[0.008]}]

Exemplo 1 :  (Subscript[x, 0]) = 4.0

NewtonPlot[4. , Exp[x - 2] - x^2/3, {x, 3, 5}, 0.008]

Exemplo 2 :  (Subscript[x, 0]) = 0.5

NewtonPlot[0.5, Exp[x - 2] - x^2/3, {x, 0, 2}, 0.008]

Exemplo 3 :  (Subscript[x, 0]) = 0.42

NewtonPlot[0.42, Exp[x - 2] - x^2/3, {x, -2, 3.5}, 
      0.008]

Exemplo 4 :  (Subscript[x, 0]) = -2

NewtonPlot[-2. , Exp[x - 2] - x^2/3, {x, -2, 3.5}, 
      0.008]