منبع : عمران
Regula falsi method
#include
#include
#include
double F (double x) {return 1.14-(2.0*log((e/d)+(9.55/r*sqrt(x))))-(1/sqrt(x)) ;}
main()
{ clrscr();
double eps,a,b,x,e,d,r;
int n;
cout<<”Enter a,b,eps,e,d,r”<
cin>>a>>b>>eps>>e>>d>>r;
n=1;
x=(a*F(b)-b*F(a))/(F(b)-F(a))
while(fabs(F(x))>=eps)
{if(F(x)*F(a)>0)
a=x;
else
b=x;
x=(a*F(b)-b*F(a))/(F(b)-F(a));
n++; }
cout<<”Root=”<
cout<<”n=”<
getch();
}
بازگشت به صفحه اصلی وبلاگ مهندسی عمران راه و ساختمان(مهندس حسن فراهانی)
مهندسی عمران راه و ساختمان