Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define _USE_MATH_DEFINES
- #include <math.h>
- using namespace std;
- long double pow_f(long double a, long double b)
- {
- return exp(log(a) * b);
- }
- int n;
- long double s_f(long double x)
- {
- long double sum = 1;
- long double last = sum;
- n=0;
- while(last>0.0000001)
- {
- sum += x * x * (2 * n + 3) / (2 * n + 1) / (n + 1) * last;
- last *= x * x * (2 * n + 3) / (2 * n + 1) / (n + 1);
- n++;
- }
- return sum;
- }
- long double y_f(long double x)
- {
- return (1 + 2 * x * x)*exp(pow_f(x, 2.0));
- }
- int main_f()
- {
- for(long double i = 0.0; i <= 1.1; i += 0.2)
- {
- cout<<i<<" "<<y_f(i)<<" "<<s_f(i)<<" "<<n<<endl;
- }
- }
- int main()
- {
- system(" chcp 1251 > nul");
- cout<<"x "<<"Y(x) "<<"S(x) "<<'N'<<endl;
- main_f();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement