Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main(void)
- {
- long long unsigned int r;
- int n;
- double x0, xn, dx, x, chx, chxnorm;
- cout << "X0 Xn dX" << endl;
- cin >> x0 >> xn >> dx;
- for (x = x0; x <= xn; x += dx)
- {
- cout << "X = " << x << endl;
- chx = 1;
- n = 0;
- do
- {
- n++;
- r = 1;
- int i;
- for (i = 1; i <= n * 2; i++)
- r *= i;
- chx += pow(x, 2 * n) / r;
- } while (pow(x, 2 * n) / r >= pow(10, -6));
- cout << "Ch(x) Taylor = " << chx << " Ch(x) normal = " << cosh(x) << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement