Advertisement
Your_E-330

Blyadskaya_funcia

Oct 15th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 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. ans = 0;
  12. frac = 1;
  13. x = sin(rand());
  14. while (abs(frac) > Ep) {
  15. delta = (3 * (2 * n - 1) * (2 * n - 1)) / (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. system("pause");
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement