Question: Modify the gradient - descent code to implement Newton's method: x i + 1 = x i - [ 2 f ( x i )

Modify the gradient-descent code to implement Newton's method:
xi+1=xi-[2f(xi)]-1(gradf(xi))
where is the step-size (you may choose =1 for this assignment). Here, 2f is the Hessian (i.e.,
second derivative) and gradf is the gradient (i.e., first derivative) of f.
Make sure the parameters are set to the following in your code:
% define starting point
x0=6.5;
% termination tolerance
tol =1e-6;
% maximum number of allowed iterations
maxiter =1000;
% minimum allowed perturbation
dxmin =1e-6;
% step size
alpha =.02;
(a) Solve the optimization problem x2+32sin2x using your developed Newton method. Report the
solution x**. Comment whether the solution changes when you vary the initial guess x0.
(b) Compare the number of iterations taken by the Newton's method and the standard gradient descent
method.
Modify the gradient - descent code to implement

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!