Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. double tn(int,double);
  6. int main(){
  7. double eps, x1 = 1.1, x2 = 3.1, dx;
  8.  
  9.  
  10. cout << "Enter eps, dx:";
  11. cin >> eps >> dx;
  12. for (double x = x1; x <= x2; x = x + dx){
  13. double f = 1.57;int n = 0;
  14. while (abs(tn(n,x))>=eps) {
  15. f += tn(n,x);
  16. n++;
  17. }
  18. cout << x << "\t" << atan(x) << "\t" << "F(" << x << ")=" << f<< endl;
  19. }
  20. system("pause");
  21. return 0;
  22. }
  23.  
  24. double tn(int n1,double x1){
  25. return pow((-1.0),(n1+1))/((2*n1+1)*pow(x1,2*n1+1));
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement