Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KTKadyshev
KadyshevKT
Commits
5398c815
Commit
5398c815
authored
Jun 18, 2022
by
KTKadyshev
Browse files
Upload New File
parent
3e326733
Changes
1
Hide whitespace changes
Inline
Side-by-side
functions.cpp
0 → 100644
View file @
5398c815
#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\t
i="
<<
i
<<
"
\t
G="
<<
g
<<
"
\t
F="
<<
result
;
}
return
result
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment