Mullers mothod Hun Hee Lee Mullers method for

  • Slides: 8
Download presentation
Muller‘s mothod Hun Hee Lee

Muller‘s mothod Hun Hee Lee

Muller’s method for solving an equation of one variable f(x)=0. Muller’s method is an

Muller’s method for solving an equation of one variable f(x)=0. Muller’s method is an iterative method that requires three starting values (xi, f(xi)), (x i-1, f(x i-1)), (x i-2, f(x i-2)). A parabola is constructed that passes though the three point; then the quadratic formula is use to fine of the quadratic equation for the next approximation

g(X)=ax 2+bx+c y=g(x) y=f(x)=0 h x 1 x 2 h x 3

g(X)=ax 2+bx+c y=g(x) y=f(x)=0 h x 1 x 2 h x 3

Algorithm: Muller’s method to sovle an quation of one variable Input: intial values x

Algorithm: Muller’s method to sovle an quation of one variable Input: intial values x 0, x 1, x 2, Error bound Calculate: Approximate solution x I+1 compute f(x 0), f(x 1), f(x 2) compute h 2=x 2 -x 1, h 1=x 1 -x 0 Eliminating c of g(x)

set i=2 Do { a of g(x) Let G=ci if if Set x i+1=x

set i=2 Do { a of g(x) Let G=ci if if Set x i+1=x i+h i+1 Comute f(x i+1)and Set i= i+1 }WHILE ( |h| ) Output : x i+1 END

g(X)=ax 2+bx+c S>0, G<0 hi+1 S>0, G>0 hi+1 y=g(x) x= G-S x x i

g(X)=ax 2+bx+c S>0, G<0 hi+1 S>0, G>0 hi+1 y=g(x) x= G-S x x i S<0 h i+1 i x= G+s

Program source #include<stdio. h> #include<math. h> #include<conio. h> #include<stdlib. h> double M(double x 1)

Program source #include<stdio. h> #include<math. h> #include<conio. h> #include<stdlib. h> double M(double x 1) { double xr, xl, xc, h, hi, fc, fr, fl, DLR, f 1, f 2, f 3, G, S, DEN; hi=1. 0 e-8; h=hi; xr=x 1+h; fr=F(xr); xl=x 1 -h; fl=F(xl); f 1=(fr-fc)/h; xc=x 1; fc=F(xc); X=xc; double f, X, err; double F(double X); double M(double x 1); void main() { int loop_index; double x 1; err=1. 0 e-12; printf("type initial vaule: "); scanf("%lf", &x 1); X=M(x 1); printf("root=%f", X); getch(); do { f 2=(fc-fl)/h; f 3=(f 2 -f 1)/(2*h); f 1=f 2; G=f 2+f 3*h; S=G*G-4. 0*fc*f 3; if(S>=0) S=sqrt(S); if (G>=0) DEN=G+S; else DEN=G-S; h=-2. 0*fc/DEN; fl=fc; X=X+h; fc=F(X); f 2=(fc-fl)/h; printf("%20. 16 lf", h); getch(); } while(fabs(h)>=err); return (X); } }

double F(double X) { } f=pow(X, 5)-2*pow(X, 4)+4*pow(X, 3)-8*X*X+4*X-8; return f;

double F(double X) { } f=pow(X, 5)-2*pow(X, 4)+4*pow(X, 3)-8*X*X+4*X-8; return f;