Guest User

Untitled

a guest
Nov 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. #include<math.h>
  4. #include<iomanip>
  5. double calculateXr(double,double);
  6. double calculatefx(double);
  7. int main()
  8. {
  9. double xl,xu,xr;
  10. cout<<"enter xl and xu: ";
  11. cin>>xl>>xu;
  12. cout<<"f(xl)= "<<calculatefx(xl)<<endl;
  13. cout<<"f(xu)= "<<calculatefx(xu)<<endl;
  14. xr=calculateXr(xl,xu);
  15. cout<<"xr= "<<xr<<endl;
  16. cout<<"f(xr)= "<<calculatefx(xr)<<endl;
  17.  
  18. system("pause");
  19. return 0;
  20.  
  21. }
  22. double calculateXr(double xl,double xu)
  23. {
  24. return (xu-((calculatefx(xu)*(xl-xu))/(calculatefx(xl)-calculatefx(xu))));
  25. }
  26.  
  27. double calculatefx(double x)
  28. {
  29. double l=0.1;
  30. int k=240;
  31. int h=9;
  32. double efficiency=0.95;
  33. double A,P;
  34. A=x*x;
  35. P=4*x;
  36. double lamda,alpha;
  37. lamda=pow(((k*A)/(h*P)),0.5);
  38. alpha=pow((h*A)/(k*P),0.5);
  39. double a=sinh(l/lamda)+alpha*cosh(l/lamda);
  40. double b=cosh(l/lamda)+alpha*sinh(l/lamda);
  41. return(((a/b)*(lamda/(l+(A/P))))-0.95);
  42. }
Add Comment
Please, Sign In to add comment