80 likes | 428 Views
Muller ‘ s mothod. Hun Hee Lee. 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 )).
E N D
Muller‘s mothod Hun Hee Lee
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 (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)=ax2+bx+c y=g(x) y=f(x) h x1 x2 h x3 f(x)=0
Algorithm: Muller’s method to sovle an quation of one variable Input: intial values x0,x1,x2,Error bound Calculate: Approximate solution x I+1 compute f(x0), f(x1), f(x2) compute h2=x2-x1,h1=x1-x0 Eliminating c of g(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)=ax2+bx+c S>0,G<0 hi+1 y=g(x) S>0,G>0 hi+1 x=G-S x i x i x= G+s S<0 hi+1
#include<stdio.h>#include<math.h>#include<conio.h>#include<stdlib.h>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); }
double F(double X){ f=pow(X,5)-2*pow(X,4)+4*pow(X,3)-8*X*X+4*X-8; return f;}