Advertisement
Khristina

В процессе

Apr 3rd, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.17 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <conio.h>
  4. #include <string>
  5. #include <cstring>
  6. #include <math.h>
  7. #include <cstdlib>
  8. #include <ctime>
  9. #include <cmath>
  10. using namespace std;
  11.  
  12. int main()
  13. {
  14.     int M=100, N=100;
  15.     long double V0, K0 = 0, S0 = 0;
  16.     const double pi = 3.14159265358979;
  17.     double x1, x2, x3, x, y1, y2, y3, y11, y21, y31, h = 2.0 * pi / N, H = pi / (1.0 * M), etta, xminusy, R;
  18.     double A = N * h, B = M * H;
  19.     double tetta, betta, y1pr, y2pr, y3pr;
  20.     double uq = pi / (1.0 * N), vl = pi / (2.0 * M);
  21.     for (int i = 1; i < 6; i++)
  22.     {
  23.         R = 1 - pow(10, (-1)*i);
  24.         cout << "R=" << R << endl;
  25.         y11 = sin(vl)*cos(uq);
  26.         y21 = sin(vl)*sin(uq);
  27.         y31 = cos(vl);
  28.         x1 = y11 * R;
  29.         x2 = y21 * R;
  30.         x3 = y31 * R;
  31.         cout << "x1=" << x1 << endl;
  32.         cout << "x2=" << x2 << endl;
  33.         cout << "x3=" << x3 << endl;
  34.         x = pow(pow(x1, 2) + pow(x2, 2) + pow(x3, 2), 0.5);
  35.         cout << "x=" << x << endl;
  36.             // Вычисление K0
  37.         /*  for (int m = 0; m < M; m++)
  38.             {
  39.                 double vm = (m + 0.5)*H;
  40.                 for (int n = 0; n < N; n++)
  41.                 {
  42.                     double un = (n + 0.5)*h;
  43.                     y1 = sin(vm)*cos(un);
  44.                     y2 = sin(vm)*sin(un);
  45.                     y3 = cos(vm);
  46.                     etta = sin(vm);
  47.                     xminusy = pow(pow(x1 - y1, 2) + pow(x2 - y2, 2) + pow(x3 - y3, 2), 0.5);
  48.                     K0 = K0 + (h * H * etta * 1.0 / xminusy);
  49.                 }
  50.             } */
  51.             // Вычисление S0
  52.             for (int m = 0; m < M; m++)
  53.             {
  54.                 double vm = (m + 0.5)*H;
  55.                 for (int n = 0; n < N; n++)
  56.                 {
  57.                     double un = (n + 0.5)*h;
  58.                     y1pr = cos(un) * cos(vm);
  59.                     y2pr = sin(un) * cos(vm);
  60.                     y3pr = (-1)*sin(vm);
  61.                     betta = sqrt(pow(y1pr, 2) + pow(y2pr, 2) + pow(y3pr, 2));
  62.  
  63.                     // Вычисление I(H)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                     tetta = 1.0 / betta;
  71.                     y1 = sin(vm)*cos(un);
  72.                     y2 = sin(vm)*sin(un);
  73.                     y3 = cos(vm);
  74.                     etta = sin(vm);
  75.                     xminusy = pow(pow(x1 - y1, 2) + pow(x2 - y2, 2) + pow(x3 - y3, 2), 0.5);
  76.                     S0 = S0 + (etta * tetta);
  77.                 }
  78.             }
  79.              
  80.             cout << "K0=" << K0 << endl;
  81.             if (abs(x) < 1)
  82.             {
  83.                 V0 = 4 * pi;
  84.             }
  85.             else if (abs(x) > 1)
  86.             {
  87.                 V0 = 4.0 * pi / abs(x);
  88.             }
  89.  
  90.             cout << "V0=" << V0 << endl;
  91.             cout << "______________________" << endl;
  92.     }
  93.    
  94.     return 0;
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement