Question

Compute the first 8 terms x(1), x(2), …, x(8) with newton’s method sequence{x(k)} for minimizing ...

Compute the first 8 terms x(1), x(2), …, x(8) with newton’s method sequence{x(k)} for minimizing the function f(x1, x2)=2x1^4+x2^2-4x1x2+5x2 with initial point x(0)=(0,0).

please give values of eight terms (eager for...)

please give codes of Matlab (please give the code)

thanks!

0 0
Add a comment Improve this question Transcribed image text
Answer #1


%Matlab code for Newton method clear all close all syms x1 x2 %functions for which intersection have to find f (x1,x2) 2 (x1)x1-0.72033898 and x 2--1.05932203 After 3 iteration x1--0.90260633 and X2--4.30521267 After 4 iteration x1=-1.88402029 and x2

%Matlab code for Newton method
clear all
close all

syms x1 x2
%functions for which intersection have to find
f(x1,x2)=2*(x1)^4+(x2)^2-4*x1*x2+5*x2;

%Displaying the equation
fprintf('Function for which optimization have to do \n')
disp(f)

%creating gradient and Hessian matrix
f_x1(x1,x2)=diff(f,x1);
f_x2(x1,x2)=diff(f,x2);
h_x1(x1,x2)=diff(f_x1,x1);
h_x2(x1,x2)=diff(f_x2,x2);
h_x12(x1,x2)=diff(f_x1,x2);
h_x21(x1,x2)=diff(f_x2,x1);

%Initial guess
x11=0;x21=0;

    %loop for Newton iterations
    fprintf('\nFor initial condition x1=%f and x2=%f \n',x11,x21)
    cnt=0;
    %Loop for 10 iterations
    for i=1:10
        cnt=cnt+1;
        gradf=double([f_x1(x11,x21);f_x2(x11,x21)]);
        Hf=double([h_x1(x11,x21) h_x12(x11,x21);h_x21(x11,x21) h_x2(x11,x21)]);
      
        y=[x11;x21]-Hf\gradf;
        x11=y(1); x21=y(2);
        fprintf('\nAfter %d iteration \n',cnt)
        fprintf('\tX1=%.8f and X2=%.8f \n',x11,x21)
    end

%%%%%%%%%%%%%%%%%%%%%%end of code %%%%%%%%%%%%%%%%%%%%%%%%%%%

Add a comment
Know the answer?
Add Answer to:
Compute the first 8 terms x(1), x(2), …, x(8) with newton’s method sequence{x(k)} for minimizing ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT