matlab

profileA11113
ComputerAssignment3.pdf

Math 105LA Computer Assignment 3

1. Implement Mueller’s Method

Algorithm Pseudo-code INPUT p0, p1, p2; tol, Nmax OUTPUT p or error message

STEP 1 h1=p1-p0; h2=p2-p1; del1=(f(p1)-f(p0))/h1; del2=(f(p2)-f(p1))/h2; d=(del2-del1)/(h2+h1);

STEP 2 START FOR

STEP 3 b=del2+h2*d; D=(b2-4*f(p2)*d)1/2;

STEP 4 If then

E=b+D; else

E=b-D; STEP 5

h= -2*f(p2)/E; p=p2+h;

STEP 6 If |h|<tol then break;

STEP 7 p0=p1; %prepare for next iteration p1=p2; p2=p; h1=p1-p0; h2=p2-p1; del1=(f(p1)-f(p0))/h1;

del2=(f(p2)-f(p1))/h2; d=(del2-del1)/(h2+h1);

END FOR

STEP 8 If i<Nmax then Output(p); else Ouput(‘Method failed after Max Num Iterations’)

Output(p)

2. Use Mueller’s method to solve problem f(x) = x^3 - 2x^2 - 5

Hint: there are totally three 3 roots. Try different initial guess.