Download presentation
Presentation is loading. Please wait.
Published byMuhammad Want Modified over 9 years ago
1
Muller ‘ s mothod Hun Hee Lee
2
Muller ’ s method 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 (x i,f(x i )), (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
3
g(X)=ax 2 +bx+c y=g(x) y=f(x) h x1 x2 h x3 f(x)=0
4
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)
5
set i=2 Do { Let G=c i 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 a of g(x)
6
g(X)=ax 2 +bx+c y=g(x) x= G-S x i x i x= G+s S>0,G<0 h i+1 S>0,G>0 h i+1 S<0 h i+1
7
#include #include #include #include double f,X,err; double F(double X); double M(double x1); void main() {int loop_index; double x1; err=1.0e-12; printf("type initial vaule:"); scanf("%lf",&x1); X=M(x1); printf("root=%f",X); getch(); } Program source double M(double x1) { double xr,xl,xc,h,hi,fc,fr,fl,DLR,f1,f2,f3,G,S,DEN; hi=1.0e-8; h=hi; xr=x1+h;fr=F(xr); xl=x1-h;fl=F(xl); f1=(fr-fc)/h; xc=x1; fc=F(xc); X=xc; do { f2=(fc-fl)/h; f3=(f2-f1)/(2*h); f1=f2; G=f2+f3*h; S=G*G-4.0*fc*f3; 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);f2=(fc-fl)/h; printf("%20.16lf",h);getch(); } while(fabs(h)>=err); return (X); }
8
double F(double X) { f=pow(X,5)-2*pow(X,4)+4*pow(X,3)-8*X*X+4*X-8; return f; }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.