Advertisement
cacodemon665

Лаба 3 Вариант 13

Oct 11th, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include "pch.h" //для версий вижлы старше последних версий 2017 здесь должно быть #include "stdafx.h"
  2. #include <iostream>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     double a = -2, b = -0.1;
  10.     int n = 160;
  11.  
  12.     double step = (b - a) / 10;
  13.  
  14.     cout << "Y(x)         S(x)" << endl;
  15.  
  16.     for (double x = a; x <= b; x += step)
  17.     {
  18.         cout << log(1 / (2 + 2 * x + x * x)) << "  ";
  19.         double sum = 0, u = 1, d = 0;
  20.  
  21.         for (int i = 0; i < n; i++)
  22.         {
  23.             u *= -pow(1 + x, 2);
  24.             d += 1;
  25.  
  26.             sum += u / d;
  27.         }
  28.  
  29.         cout << sum << endl;
  30.     }
  31.  
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement