Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- #include <string>
- using namespace std;
- int fact(int arg)
- {
- if(arg < 0)
- return 0;
- if (arg == 0)
- return 1;
- else
- if (arg>2)
- {
- return arg * fact(arg - 1);
- }
- }
- double perv(int a, double x)
- {
- double zn = 0;
- double sum = 0;
- for (int i = 0; i < 5; i++)
- {
- zn = (pow(-1.0, i)/(fact(i)*fact(i + a)))*pow((x/2), 2*i + a);
- sum += zn;
- }
- return sum;
- }
- double vtor(int a,double x)
- {
- double b = 0;
- double cs = cos((a/(57.3))*(3.14159));
- double sn = sin((a/(57.3))*(3.14159));
- if (a % 2 == 0)
- b = (perv(a,x)*cs - perv(a,x))/sn;
- else
- b = (perv(a,x)*cs + perv(a,x))/sn;
- return b;
- }
- double itog(int a,double x)
- {
- return perv(a,x) + vtor(a,x);
- }
- int main()
- {
- cout << itog(4,3.0) << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement