Commit 50b94ba4 authored by KTKadyshev's avatar KTKadyshev
Browse files

Delete functions.cpp

parent f5ebd1fd
#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;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment