Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- double s,r,n,eps,x,h,y;
- eps = 0.000001;
- locale::global(locale("rus"));
- s = 0; n = 1; x = 0; r = 1;
- h = 0.2; // Установка шага
- while (x <= 1)
- {
- while (abs(r) > eps)
- {
- r = r*((-1)/n)*x*x;
- s = s + r;
- n++;
- }
- cout << "x = " << x << "\n";
- cout << "Y(x) = " << exp(-x*x) << "\n";
- cout << "S(x) = " << s << "\n";
- cout << "N = " << n <<"\n\n";
- x+=h; s = 0; n = 1;
- r = 1;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment