|
auto | successive_approximations_finding_root (double(*f_eq)(double), double x0, int n) -> double |
| Function for solving equations by the method of successive approximations. More...
|
|
auto | half_division_finding_root (double(*f_hd_eq)(double), double a, double b, double dx) -> double |
| Function for solving equations by the method of half division. More...
|
|
auto | f_hd_eq (double x) -> double |
| Function f for determining the right side of solved equations (half division) More...
|
|
auto | g_hd_eq (double x) -> double |
| Function g for determining the right side of solved equations (half division) More...
|
|
auto | h_hg_eq (double x) -> double |
| Function h for determining the right side of solved equations (half division) More...
|
|
auto | f_eq (double x) -> double |
| Function f for determining the right side of solved equations. More...
|
|
auto | g_eq (double x) -> double |
| Function g for determining the right side of solved equations. More...
|
|
auto | h_eq (double x) -> double |
| Function h for determining the right side of solved equations. More...
|
|
namespace for equation solving namespace
#include <cmath>
#include <iostream>
#include <string>
#include "libnumerixpp/core/common.hpp"
#include "libnumerixpp/libnumerixpp.hpp"
void test_eq_sa(
double (*
f_eq)(
double),
double x0,
const std::string &eq) {
int const iterations = 100;
double z = NAN;
std::cout << "Equation solution " << eq << ":\t";
std::cout << z << '\n';
std::cout << "Check finding solution:\t";
std::cout << z <<
" = " <<
f_eq(z) <<
'\n';
for (int i = 0; i <= 50; i++) {
std::cout << "-";
}
std::cout << '\n';
}
auto main() -> int {
println("LIBNUMERIXPP");
return 0;
}
void credits()
print credits
Definition: common.cpp:8
Mathematics utils for equations.
auto h_eq(double x) -> double
Function h for determining the right side of solved equations.
Definition: equations.cpp:59
auto successive_approximations_finding_root(double(*f_eq)(double), double x0, int n) -> double
Function for solving equations by the method of successive approximations.
Definition: equations.cpp:9
auto f_eq(double x) -> double
Function f for determining the right side of solved equations.
Definition: equations.cpp:55
auto g_eq(double x) -> double
Function g for determining the right side of solved equations.
Definition: equations.cpp:57
auto mathematics::equations::successive_approximations_finding_root |
( |
double(*)(double) |
f_eq, |
|
|
double |
x0, |
|
|
int |
n |
|
) |
| -> double |
Function for solving equations by the method of successive approximations.
When solving an equation ( \(x = \Phi(x)\)), under some additional conditions, the method of successive approximations can be used. Its essence boils down to the fact that the initial position x0 is specified for the root of the equation, after which, using an iterative procedure, each subsequent approximation is calculated based on the previous one in accordance with the formula \(x_{n + 1} = \Phi(x_{n})\). Example equations: \(x = 0,5 * *\cos(x)\); \(x = \exp(-x)\); \(x = (x^{2} + 6) / 5\).
- Parameters
-
[in] | f | The f |
[in] | x0 | The x 0 |
[in] | n | n value |
- Returns
- equation root