Answer the question
In order to leave comments, you need to log in
Why does nan ind pop up when expanding the Fourier series?
I began to learn the pluses, such a task, to expand the function using the Fourier series, the accuracy is 0.0001.
The value of the function is found, but the row does not work
#include <iostream>
#include <cmath>
using namespace std;
void main() {
setlocale(LC_ALL, "Russian");
cout << "Введите значение аргумента: ";
double x;
cin >> x;
const double pi = atan(1) * 4;
double function = (pi - x) / 2;
cout << "Значение функции: " << function << endl;
double sum = 0;
double i = 0;
do {
sum += sin(i * x) / i;
i++;
} while (abs(function - sum) > 0.0001);
cout << "Значение суммы ряда по функции: " << sum;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question