SHARE
TWEET

4 lqwo

a guest Nov 19th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  #include <math.h>
  2. #include <iostream>
  3. #include <conio.h>
  4. #include<stdio.h>
  5. #include <iomanip>
  6.  
  7. using namespace std;
  8.  
  9. double f1(double x) {
  10.  
  11.     return (1 + x * x) / 2 * atan(x) - (x / 2);
  12. }
  13.  
  14.  
  15. int main() {
  16.     system("chcp 1251>nul");
  17.     double a, b, n, h,E;
  18.     double S;
  19.     double x;
  20.     cout << "Введите a,b,h,n\n";
  21.     cin >> a >> b >> h >> n;
  22.     cout << setw(30) << "Y" << setw(15) << "S" << setw(15) << "|S-Y|" << endl;
  23.     for (x = a; x <= b; x += h)
  24.     {
  25.         S = 0;
  26.         E = -1;
  27.         f1(x);
  28.         for (int k = 1; k <= n; k++)
  29.         {
  30.             E *= (-1) * x * x;
  31.             S = S + E * x / (4 * k * k - 1);
  32.         }
  33.    
  34.         cout << setw(30) << f1(x) << setw(15) << S << setw(15) << fabs(S - f1(x)) << endl;
  35.     }
  36.     system("pause>nul");
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top