Skip to content
Snippets Groups Projects
Commit 5398c815 authored by KTKadyshev's avatar KTKadyshev
Browse files

Upload New File

parent 3e326733
No related branches found
No related tags found
No related merge requests found
#include <iostream>
#include <cmath>
#include "functions.h"
ldouble_t ld_power(ldouble_t x, int power)
{
ldouble_t result = x;
for(int i = 1; i < power; i++)
result *= x;
return result;
}
ldouble_t G(ldouble_t x, int i)
{
// ((-1)^(i!) * x^(2i - 1)) / (x^i + cos(ix))
return ld_power(x, 2 * i - 1) / (ld_power(x, i) + cos(i * x));
}
ldouble_t F(ldouble_t x, int N)
{
ldouble_t result = 1.0;
for(int i = 2; i <= N; i++)
{
ldouble_t g = G(x, i);
result += g;
std::cout << "\n\ti=" << i << "\tG=" << g << "\tF=" << result;
}
return result;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment