Question: apply while loop inside other while loop


iam trying to apply newton method on non liner system but i have a problem for apply while loop inside other while loop 
any help please

with(VectorCalculus):

NULL

f[1] := VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(x^2, VectorCalculus:-`-`(VectorCalculus:-`*`(z, exp(y)))), VectorCalculus:-`-`(VectorCalculus:-`*`(y, exp(z)))), 61):

f[2] := VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`*`(VectorCalculus:-`*`(x, y), z), VectorCalculus:-`-`(exp(x))), -3):

f[3] := VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(x^2, y^2), z^2), -14):

F := Matrix([[f[1]], [f[2]], [f[3]]]):

FF := eval(F, [x = x[k], y = y[k], z = z[k]]):

X := Matrix([[x], [y], [z]]):

XX := eval(X, [x = x[k], y = y[k], z = z[k]]):

J := Jacobian([f[1], f[2], f[3]], [x, y, z]):

JJ := eval(J, [x = x[k], y = y[k], z = z[k]])

JJ := Matrix(3, 3, {(1, 1) = 2*x[k], (1, 2) = -z[k]*exp(y[k])-exp(z[k]), (1, 3) = -exp(y[k])-y[k]*exp(z[k]), (2, 1) = y[k]*z[k]-exp(x[k]), (2, 2) = x[k]*z[k], (2, 3) = x[k]*y[k], (3, 1) = 2*x[k], (3, 2) = 2*y[k], (3, 3) = 2*z[k]})

(1)

``

k := 0:

xi := convert(exp(-10), float):

maxval := 10^4:

NULL

while convert(Norm(FF, 2), float) > xi do alpha[k] := min(1, alpha[k]/lambda); L := 1/JJ.FF; K := -L*alpha[k]+XX; x[k+1] := evalf(Determinant(K[1])); y[k+1] := evalf(Determinant(K[2])); z[k+1] := evalf(Determinant(K[3])); A := convert(Norm(FFF, 2), float)^2; B := convert(Norm(FF, 2), float)^2; while A > B do L := 1/JJ.FF; alpha[k+1] := lambda*alpha[k]; K := -L*alpha[k+1]+XX; x[k+1] := evalf(Determinant(K[1])); y[k+1] := evalf(Determinant(K[2])); z[k+1] := evalf(Determinant(K[3])) end do; k := k+1 end do

alpha[0] := 1

 

L := Matrix(3, 1, {(1, 1) = -(12900-300*exp(8)-1200*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)-(2*exp(8)+31*exp(2))*(77-exp(5))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)-(395/2)*(7*exp(8)-4*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500), (2, 1) = (84+exp(5))*(86-2*exp(8)-8*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)+(5/2)*(4+exp(8)+8*exp(2))*(77-exp(5))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)+(79/4)*(exp(8)*exp(5)+8*exp(2)*exp(5)-16*exp(8)-128*exp(2)-400)/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500), (3, 1) = -(-39+4*exp(5))*(86-2*exp(8)-8*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)-(5/2)*(16+2*exp(8)+exp(2))*(77-exp(5))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)-(79/4)*(2*exp(8)*exp(5)+exp(2)*exp(5)-32*exp(8)-16*exp(2)-100)/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)})

 

K := Matrix(3, 1, {(1, 1) = 5+(12900-300*exp(8)-1200*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)+(2*exp(8)+31*exp(2))*(77-exp(5))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)+(395/2)*(7*exp(8)-4*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500), (2, 1) = 8-(84+exp(5))*(86-2*exp(8)-8*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)-(5/2)*(4+exp(8)+8*exp(2))*(77-exp(5))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)-(79/4)*(exp(8)*exp(5)+8*exp(2)*exp(5)-16*exp(8)-128*exp(2)-400)/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500), (3, 1) = 2+(-39+4*exp(5))*(86-2*exp(8)-8*exp(2))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)+(5/2)*(16+2*exp(8)+exp(2))*(77-exp(5))/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)+(79/4)*(2*exp(8)*exp(5)+exp(2)*exp(5)-32*exp(8)-16*exp(2)-100)/(2*exp(8)*exp(5)+31*exp(2)*exp(5)-207*exp(8)-396*exp(2)-1500)})

 

14.35960152

 

-12.24471811

 

39.82986865

 

HFloat(5.911285325999999e36)

 

35235903.22

 

Warning,  computation interrupted

 

 

 

Please Wait...