Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #include<math.h>
- #include<iomanip>
- double calculateXr(double,double);
- double calculatefx(double);
- int main()
- {
- double xl,xu,xr;
- cout<<"enter xl and xu: ";
- cin>>xl>>xu;
- cout<<"f(xl)= "<<calculatefx(xl)<<endl;
- cout<<"f(xu)= "<<calculatefx(xu)<<endl;
- xr=calculateXr(xl,xu);
- cout<<"xr= "<<xr<<endl;
- cout<<"f(xr)= "<<calculatefx(xr)<<endl;
- system("pause");
- return 0;
- }
- double calculateXr(double xl,double xu)
- {
- return (xu-((calculatefx(xu)*(xl-xu))/(calculatefx(xl)-calculatefx(xu))));
- }
- double calculatefx(double x)
- {
- double l=0.1;
- int k=240;
- int h=9;
- double efficiency=0.95;
- double A,P;
- A=x*x;
- P=4*x;
- double lamda,alpha;
- lamda=pow(((k*A)/(h*P)),0.5);
- alpha=pow((h*A)/(k*P),0.5);
- double a=sinh(l/lamda)+alpha*cosh(l/lamda);
- double b=cosh(l/lamda)+alpha*sinh(l/lamda);
- return(((a/b)*(lamda/(l+(A/P))))-0.95);
- }
Add Comment
Please, Sign In to add comment