Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 1: Compare performance of three algorithms: Newton\'s method, bisection

ID: 3168423 • Letter: P

Question

Problem 1: Compare performance of three algorithms: Newton's method, bisection method, and the fixed-point iteration methood . Write a code implementing Newton's method, the bisection method, and the fixed-point method. Keep the programing in such a way as to be able to compare performance of the three methods on a selected function. . Compare performance of each method on the following three root problems f(x) = 0, on [--09: 11, where f(r)-r2 sin x; g(z)=0, on [-0.9:1], where g(x)=z"sin!-x; h(z)=0, [-0.9:1], where h(x)-YE on .Write a report Include results of your calculations with some minor comments, and justify the choice of examples. Attach the code Problem 2: Compare performance of Newton's method and Muller's method on the problem of finding roots of a polynomial with real co- efficients by the method of deflation. . Write a code implemntig deflation method for finding all roots of a polynomial using (a) Newton's method, (b) Muller's method On the example of P(3+4x2 +4+3, show that Newton's method can not produce complex roots when starts from real . On the example of P(x) r3+4x2 + 4x + 3, show that Muller's . Show that Newton's method gives correct roots of P(z)+ initial approximation method is not sensitive to a real initial approximation 4r2 +4r +3, if the initial approximation has a nonzero complex component . Write a report. Include results of the calculations done in previ- ous items, add minor comments explaining the results. Attach the code.

Explanation / Answer

problem 2)

part 2)

p(x) = x^3+4x^2+4x+3;

actual roots of p(x) is   -3, -0.5-0.866j , -0.5+0.866j

newton method

x(n+1)=x(n)-f(x(n)) /f'(x(n))

as if we choose x(n) as initial guess to real number then f(xn) also real and f'(xn) ia also real

therfore xn+1 is always real till the iteration convergence to real number in this case -3

thus with the initial guess of real number we never going to find out the complex roots of polynomial

%%%% Matlab code %%%%

% Newton Raphson method
syms x
f= x^3+4*x^2+4*x+3;
tol=10^(-6);

x0=[-5,1,4]; %%% initial guess
for k=1:length(x0)
    s(1)=x0(k);
for n=1:100
    l1=subs(f,s(n));
    l2=subs(diff(f),s(n));
    s(n+1)=s(n)-(l1/l2);
    e=abs(s(n+1)-s(n));
    if (e < tol)
        break;
    end
  
end
fprintf('Initial guess x0= %f ', x0(k));
fprintf(' roots of equation is = %f ', s(end));
fprintf('Number of iteration required = %d ', n);
end


OUTPUT:

Initial guess x0= -5.000000
roots of equation is = -3.000000
Number of iteration required = 7
Initial guess x0= 1.000000
roots of equation is = -3.000000
Number of iteration required = 7
Initial guess x0= 4.000000
roots of equation is = -3.000000
Number of iteration required = 13