1
$\begingroup$

I need help with my project. I have three nonlinear systems and I need to write a code for Newton methods and Armijo-Goldstein and see the differences.

f[x1, x2, x3] = {x1^5 + x2^3*x3^4 + 1, x1^2*x2*x3, x3^4 - 1};

x02 = {.1, .1, .1};

x01 = {-.01, -0.01, -0.01};

tolerance =10^-9;

(J = Table[
Table[D[f[x1, x2, x3][[i]], xi], {xi, {x1, x2, x3}}], {i, 1, 
 3}]) // MatrixForm

Jac[{xa_, xb_, xc_}] := J /. {x1 -> xa, x2 -> xb, x3 -> xc} ;

Jac[{x1, x2, x3}];

Inverse[Jac[{x1, x2, x3}]] // MatrixForm     

How to write a code for the Newton method and Armijo-Goldstein to see and compare the results?

Thanks a lot!

$\endgroup$
1
  • $\begingroup$ Note that your J can be defined more simply as J = D[f[x1, x2, x3], {{x1, x2, x3}}] $\endgroup$
    – Bob Hanlon
    Aug 20, 2022 at 19:19

1 Answer 1

1
$\begingroup$

Armijo-Goldstein is a stopping criteria for the backtracking line search implemented in FindMinimum and can be used as follows

f = {x1^5 + x2^3*x3^4 + 1, x1^2*x2*x3, x3^4 - 1};

x02 = {.1, .1, .1};

x01 = {-.01, -0.01, -0.01};

tolerance = 10^-9;

sol1 = FindMinimum[f . f, Table[{x[[i]], x01[[i]]}, {i, 3}], 
  Method -> {"Newton", 
    "StepControl" -> {"LineSearch", Method -> "Backtracking"}}, 
  AccuracyGoal -> 10] 
{3.83291*10^-33, {x1 -> 7.86832*10^-9, x2 -> -1., x3 -> -1.}}

If we use directly FindRoot with Newton then we have

sol01=FindRoot[f, Table[{x[[i]], x01[[i]]}, {i, 3}], 
 Method -> "Newton"]

During evaluation of In[15]:= FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances.

Out[15]= {x1 -> -0.462688, x2 -> 0.901034, x3 -> -0.0156579}

Therefore, Newton's iterative method not working in this case without step control. We can check residuals for Armijo-Goldstein

f /. sol1[[2]]

Out[]= {0., 6.19105*10^-17, 0.} 

and for the Newton's iterative method

f /. sol01

Out[]= {0.978795, -0.00302031, -1.}

To improve Newton's method we can use sol1 as starting point

sol01n=FindRoot[f, Table[{x[[i]], x[[i]] /. sol1[[2]]}, {i, 3}]]

Out[]= {x1 -> 3.93416*10^-9, x2 -> -1., x3 -> -1.}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.