Advertisement
Courbe_Impliquee

taylor1

Dec 13th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <iomanip>
  4. #include <math.h>
  5. using namespace std;
  6. int _tmain(int argc, _TCHAR* argv[])
  7. {
  8. float xn, xk, dx, e, s, sum=0, x, F;
  9. int n = 1, nf = 1;
  10. cout << "Vvedite xn, xk, dx, e: ";
  11. scanf_s ("%f%f%f%f", &xn, &xk, &dx, &e);
  12. cout << "------------------------------------------\n";
  13. cout << "| x | f | n | F |\n";
  14. cout << "------------------------------------------\n" << endl;
  15. n = 0;
  16. for (x = xn; x <= xk; x += dx){
  17. s = x/n+1;
  18. sum = -x;
  19. F = pow(2.71828, -1 * x);
  20. nf = 1;
  21. while (fabs(s)>e){
  22. for (int p = 1; p <= n; p++) {
  23. nf *= p;
  24. }
  25. s *= pow(-1,n)*pow(x,n)/n;
  26. sum += s;
  27. n++;
  28. }
  29. nf = 0;
  30. printf("|%10.2f | %8.2f | %3d | %3.2f | \n", x, sum, n, F);
  31. }
  32. cout << "------------------------------------------\n";
  33. system("pause");
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement