Advertisement
Your_E-330

Untitled

Oct 23rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. setlocale(LC_ALL, "Russian");
  7. double n, x, Ep, delta, frac, ans;
  8. cout << "Введите точность: " << endl;
  9. cin >> Ep;
  10. n = 1;
  11. x = sin(rand());
  12. ans = x;
  13. frac = x;
  14. while (abs(frac) > Ep) {
  15. delta = ((2 * n - 1) * (2 * n - 1) * x * x) / (2 * n * (2 * n + 1));
  16. frac = -frac * delta;
  17. ans += frac;
  18. n++;
  19. }
  20. cout << "x = " << x << endl;
  21. cout << "Сумма: " << ans << endl;
  22. cout << "Встроенная функция: " << log(x + sqrt(1 + x * x)) << endl;
  23.  
  24.  
  25.  
  26.  
  27.  
  28. system("pause");
  29. return 0;
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement