The Newton-Raphson Method

Section 2.1 - Newton-Raphson Method for Three Equations in Three Unknowns

Example 2.2.1

F[x_,y_, z_] = (((x-5))^2)+(((y-9))^2)+(((z-4))^2)-49;

G[x_,y_, z_] = (((x-2))^2)+(((y-7))^2)+(((z-13))^2)-100;

H[x_,y_, z_] = (((x-6))^2)+(((y-11))^2)+(((z-10))^2)-64;

FGHPlot = ContourPlot3D[{F[x,y,z]==0,G[x,y,z]==0,H[x,y,z]==0},{x,-10,25},{y,-10,25},{z,-10,25},ContourStyle->{{Red,Thickness[0.01]},{Blue,Thickness[0.01]},{Yellow,Thickness[0.01]}},PlotRange->{{-10,25},{-10,25}, {-10,25}},Axes->True, AspectRatio->1, Mesh->None, AxesLabel->{"x","y","z"}]

(FGHMat = {{F[x,y,z]},{G[x,y,z]},{H[x,y,z]}})//MatrixForm

Flatten[N[FGHMat/.{{x->-2.,y->14., z-> 6.}}]]

(DFGHMat = {{D[F[x,y,z],x],D[F[x,y,z],y],D[F[x,y,z],z]},{D[G[x,y,z],x],D[G[x,y,z],y],D[G[x,y,z],z]},{D[H[x,y,z],x],D[H[x,y,z],y],D[H[x,y,z],z]}})//MatrixForm

(NewtIter = (Factor[Simplify[{{x},{y},{z}}-Inverse[DFGHMat].FGHMat]]))//MatrixForm

NewtIter/.{x->-2., y->14., z->6.}

(Subscript[x, 0]) = -2.; (Subscript[y, 0])=14.;(Subscript[z, 0])=6.;

(Seq1 = SetPrecision[NestList[Flatten[NewtIter]/.{x->#[[1]],y->#[[2]],z->#[[3]]}&,{(Subscript[x, 0]),(Subscript[y, 0]),(Subscript[z, 0])},5],12])//MatrixForm

root1 = Seq1[[5]]

FGHMat/.{x->root1[[1]],y->root1[[2]],z->root1[[3]]}

FindRoot[{F[x,y,z]==0,G[x,y,z]==0, H[x,y,z]==0},{{x,-2.},{y,14.}, {z,6.}},WorkingPrecision->15]

(Subscript[x, 0]) = 8.; (Subscript[y, 0])=5.;(Subscript[z, 0])=7.;

(Seq2 = SetPrecision[NestList[Flatten[NewtIter]/.{x->#[[1]],y->#[[2]],z->#[[3]]}&,{(Subscript[x, 0]),(Subscript[y, 0]),(Subscript[z, 0])},5],12])//MatrixForm

root2 = Seq2[[5]]

FGHMat/.{x->root2[[1]],y->root2[[2]],z->root2[[3]]}

FindRoot[{F[x,y,z]==0,G[x,y,z]==0, H[x,y,z]==0},{{x,8.},{y,5.}, {z,7.}},WorkingPrecision->15]

(Subscript[x, 0]) =15.-20. I; (Subscript[y, 0])=-14.+8. I;(Subscript[z, 0])=-50-9. I;

Seq3 = Chop[SetPrecision[NestList[Flatten[NewtIter]/.{x->#[[1]],y->#[[2]],z->#[[3]]}&,{(Subscript[x, 0]),(Subscript[y, 0]),(Subscript[z, 0])},11],12],(10^(-15))];

Part[Seq3[[All,1]]]//MatrixForm

Part[Seq3[[All,2]]]//MatrixForm

Part[Seq3[[All,3]]]//MatrixForm