Newtons Method 1D

To approximate solutions of 
	f[x]=0
one can satrt with an initial guess
	(Subscript[x, 0])
linearize
	f[x]≈f[(Subscript[x, 0])]+f'[(Subscript[x, 0])](x-(Subscript[x, 0]))
and solve
	 f[(Subscript[x, 0])]+f'[(Subscript[x, 0])](x-(Subscript[x, 0]))=0
to get a (hopefully better) value
	(Subscript[x, 1])=(Subscript[x, 0])-f[(Subscript[x, 0])]/f'[(Subscript[x, 0])]
Repeating this process is Netwon's Method. Variants include using difference quotients etc. to estimate the derivative.

f[x_]:= Cos[x]Sin[(x^2)+ x];
x0=1.7;x=x0;
Table[
x-=f[x]/f'[x],
{12}]
Plot[f[x],{x, 1.5,2},
Epilog->Map[Point[{#,f[#]}]&,{x0,x}]
]

What can go wrong?

Newtons Method 2D

To approximate solutions of 
	(OverVector[f])[(OverVector[x])]=(OverVector[0])
in 2D one can satrt with an initial guess
	(Subscript[(OverVector[x]), 0])
linearize
	(OverVector[f])[(OverVector[x])]≈(OverVector[f])[(Subscript[(OverVector[x]), 0])]+Df[(Subscript[(OverVector[x]), 0])]((OverVector[x])-(Subscript[(OverVector[x]), 0]))
and solve
	 (OverVector[f])[(Subscript[(OverVector[x]), 0])]+Df[(Subscript[(OverVector[x]), 0])]((Subscript[(OverVector[x]), 1])-(Subscript[(OverVector[x]), 0]))=(OverVector[0])
to get a (hopefully better) value
	Df[(Subscript[(OverVector[x]), 0])]((Subscript[(OverVector[x]), 1])-(Subscript[(OverVector[x]), 0]))=-(OverVector[f])[(Subscript[(OverVector[x]), 0])]
Repeating this process is Netwon's Method. Variants include using difference quotients etc. to estimate the derivative.

f[{x1_,x2_}]:= {Cos[x1]Sin[(x1^2)+ x2], Sin[x1 x2]};
Df[{x1_,x2_}]= D[ f[{x1,x2}],{{x1,x2}}];
x0={1.7,1.2};x=x0;
Table[
x-=LinearSolve[Df[x],f[x]],
{12}]
ContourPlot[
{f[{x1,x2}][[1]]==0,f[{x1,x2}][[2]]==0} ,
{x1, 0,3},
{x2,0,3},
Epilog->Map[ Point, {x0,x}]
]

What can go wrong?   How much work is this?

Newtons Method ND

To approximate solutions of 
	(OverVector[f])[(OverVector[x])]=(OverVector[0])
to get a (hopefully better) value
	Df[(Subscript[(OverVector[x]), 0])]((Subscript[(OverVector[x]), 1])-(Subscript[(OverVector[x]), 0]))=-(OverVector[f])[(Subscript[(OverVector[x]), 0])]
Repeating this process is Newton's Method. What can go wrong?  How much work is this?  How can we use partial information on f and Df?

Randf[x_List,n_]:=Table[ 
{i,j,k}=RandomInteger[{1,n},3];
{α,β,γ}=RandomReal[{-1,1},3];
x[[j]]+α Cos[ x[[i]] x[[j]]+ β x[[k]]] - γ Sin[x[[k]] x[[i]]],
{n}] 
f[{x1_,x2_,x3_,x4_}]=Randf[{x1,x2,x3,x4},4]
Df[{x1_,x2_,x3_,x4_}] = D[ f[{x1,x2,x3,x4}],{{x1,x2,x3,x4}}]

Clear[x,x0]
x0=RandomReal[{-1,1},4]
xSol=x/.FindRoot[f[x],
{x,x0}]
Norm[f[xSol]]
x=x0;
MaxIter=23;
Table[
x-=LinearSolve[Df[x],f[x]],
{MaxIter}]//TableForm
Norm[f[x]]