SHOW:
|
|
- or go back to the newest paste.
| 1 | - | #include "stdio.h" |
| 1 | + | #include <iostream> |
| 2 | - | #include "cmath" |
| 2 | + | #include <conio.h> |
| 3 | #include <math.h> | |
| 4 | ||
| 5 | - | double x = 0.1; |
| 5 | + | using namespace std; |
| 6 | - | double h = 0.05; |
| 6 | + | |
| 7 | - | int n = 15; |
| 7 | + | |
| 8 | - | while (x < 1 + h) |
| 8 | + | double x = 0.1, h = 0.05; |
| 9 | int n = 20; | |
| 10 | - | double y = sin(x); |
| 10 | + | |
| 11 | - | double s = 1; |
| 11 | + | while (x < 0.8 + h) |
| 12 | {
| |
| 13 | - | {
|
| 13 | + | double y = log(1 - x * x), s = 0; |
| 14 | - | int k = 1; |
| 14 | + | |
| 15 | - | for (int j = 2; j <= i * 2; j++) |
| 15 | + | |
| 16 | - | k *= j; |
| 16 | + | s -= pow(x, i * 2) / i; |
| 17 | - | double slag = pow(x, 3) / k; |
| 17 | + | |
| 18 | - | if (i % 2 == 1) |
| 18 | + | cout.precision(4); |
| 19 | - | slag *= -1; |
| 19 | + | cout << "| " << x << "\t| " << y << "\t| " << s << "\t|" << endl; |
| 20 | - | s += slag; |
| 20 | + | |
| 21 | - | } |
| 21 | + | |
| 22 | - | printf("| %.4lf\t| %.4lf\t| %.4lf\t|\n", x, y, s);
|
| 22 | + | |
| 23 | return 0; | |
| 24 | } |