Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<math.h>
- #include<iostream>
- #define pi acos(-1.0)
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "RUS");
- double x, b, h, a, y, i, s, e, p;
- cout << "x="; cin >> x;
- e = 1.4e-1;
- b = pi;
- h = pi / 25;
- a = pi / 5;
- y = ((x * x) - ((pi * pi) / 3));
- i = 1;
- s = 0;
- for (i = a, i <= b, i=i+h)
- {
- p += (pow(-1, i) * cos(i * x)) / (i * i);
- if (i >= a + h + h)
- {
- if (fabs(p)-fabs(s)>e)
- {
- s += (pow(-1, i) * cos(i * x)) / (i * i);
- }
- }
- s += (pow(-1, i)* cos(i* x)) / (i * i);
- else
- {
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment