Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <locale>
- #include <math.h>
- using namespace std;
- float f(float x)
- {
- return (1 / sqrt(3+pow(x,2)));
- }
- float f2(float x, float y)
- {
- return abs( (2 * pow(x, 2) - 3) /( pow(pow((pow(y, 2) + 3),5),0.5)));
- }
- int main()
- {int i, n; float G,h,I,S=0; float t[4]; float M; float a = 0.4, b=1.2;
- setlocale(LC_ALL, "rus");
- t[0] = f2(a, a);
- t[1] = f2(a, b);
- t[2] = f2(b, a);
- t[3] = f2(b, b);
- M = t[1];
- for (i = 0; i < 4; i++)
- {
- if (M < t[i]) M = t[i];
- };
- M = ceil(M);
- G = sqrt((pow((b-a),3)*M)/0.006);
- cout << "Введите n > " << round(G) << endl;
- cin >> n;
- cout << endl;
- float *x = new float[n+1];
- float *y = new float[n+1];
- h = (b - a) / n;
- for (i=0;i<n+1;i++)
- {
- x[i] = a + i * h;
- };
- for (i = 0; i < n+1; i++)
- {
- y[i] = f(x[i]);
- };
- for (i = 1; i < n; i++)
- {
- S = S + y[i];
- };
- I = h * (((y[0]+y[n]) / 2) + S);
- cout << I << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement