Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- setlocale(LC_ALL, "Russian");
- double temp2 = 0;
- double x = 0;
- int i = 0;
- double eps = 0 ;
- std::cout << "Данная программа позволяет вычислить значение функции y=sin(x) с точностью eps с помощью разложения функции в ряд Маклорена.." << endl;
- std::cout << "Введите чило X" << endl;
- cin >> x;
- std::cout << "Введите значение точности Eps" << endl;
- cin >> eps;
- double sum = x;
- double temp = -x * x * x / 6;
- double diff = x;
- while (diff > eps) {
- temp2 = sum;
- sum = sum + temp;
- diff = abs(sum - temp2);
- temp = temp * (-1) * x * x / (i + 3) / (i + 4);
- i++;
- }
- cout << "Значение функции Sin(x) равно : " << sum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement