![]() |
TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Functions | |
| void | forward_euler_step (const double dx, const double x, std::valarray< double > *y, std::valarray< double > *dy) |
| Compute next step approximation using the forward-Euler method. | |
| double | forward_euler (double dx, double x0, double x_max, std::valarray< double > *y, bool save_to_file=false) |
| Compute approximation using the forward-Euler method in the given limits. | |
| void | midpoint_euler_step (const double dx, const double &x, std::valarray< double > *y, std::valarray< double > *dy) |
| Compute next step approximation using the midpoint-Euler method. | |
| double | midpoint_euler (double dx, double x0, double x_max, std::valarray< double > *y, bool save_to_file=false) |
| Compute approximation using the midpoint-Euler method in the given limits. | |
| void | semi_implicit_euler_step (const double dx, const double &x, std::valarray< double > *y, std::valarray< double > *dy) |
| Compute next step approximation using the semi-implicit-Euler method. | |
| double | semi_implicit_euler (double dx, double x0, double x_max, std::valarray< double > *y, bool save_to_file=false) |
| Compute approximation using the semi-implicit-Euler method in the given limits. | |
Integration functions for implementations with solving ordinary differential equations (ODEs) of any order and and any number of independent variables.
| double forward_euler | ( | double | dx, |
| double | x0, | ||
| double | x_max, | ||
| std::valarray< double > * | y, | ||
| bool | save_to_file = false ) |
Compute approximation using the forward-Euler method in the given limits.
| [in] | dx | step size |
| [in] | x0 | initial value of independent variable |
| [in] | x_max | final value of independent variable |
| [in,out] | y | take \(y_n\) and compute \(y_{n+1}\) |
| [in] | save_to_file | flag to save results to a CSV file (1) or not (0) |
Definition at line 102 of file ode_forward_euler.cpp.
| void forward_euler_step | ( | const double | dx, |
| const double | x, | ||
| std::valarray< double > * | y, | ||
| std::valarray< double > * | dy ) |
Compute next step approximation using the forward-Euler method.
\[y_{n+1}=y_n + dx\cdot f\left(x_n,y_n\right)\]
| [in] | dx | step size |
| [in] | x | take \(x_n\) and compute \(x_{n+1}\) |
| [in,out] | y | take \(y_n\) and compute \(y_{n+1}\) |
| [in,out] | dy | compute \(f\left(x_n,y_n\right)\) |
Definition at line 86 of file ode_forward_euler.cpp.
| double midpoint_euler | ( | double | dx, |
| double | x0, | ||
| double | x_max, | ||
| std::valarray< double > * | y, | ||
| bool | save_to_file = false ) |
Compute approximation using the midpoint-Euler method in the given limits.
| [in] | dx | step size |
| [in] | x0 | initial value of independent variable |
| [in] | x_max | final value of independent variable |
| [in,out] | y | take \(y_n\) and compute \(y_{n+1}\) |
| [in] | save_to_file | flag to save results to a CSV file (1) or not (0) |
Definition at line 107 of file ode_midpoint_euler.cpp.
| void midpoint_euler_step | ( | const double | dx, |
| const double & | x, | ||
| std::valarray< double > * | y, | ||
| std::valarray< double > * | dy ) |
Compute next step approximation using the midpoint-Euler method.
\[y_{n+1} = y_n + dx\, f\left(x_n+\frac{1}{2}dx, y_n + \frac{1}{2}dx\,f\left(x_n,y_n\right)\right)\]
| [in] | dx | step size |
| [in] | x | take \(x_n\) and compute \(x_{n+1}\) |
| [in,out] | y | take \(y_n\) and compute \(y_{n+1}\) |
| [in,out] | dy | compute \(f\left(x_n,y_n\right)\) |
Definition at line 85 of file ode_midpoint_euler.cpp.
| double semi_implicit_euler | ( | double | dx, |
| double | x0, | ||
| double | x_max, | ||
| std::valarray< double > * | y, | ||
| bool | save_to_file = false ) |
Compute approximation using the semi-implicit-Euler method in the given limits.
| [in] | dx | step size |
| [in] | x0 | initial value of independent variable |
| [in] | x_max | final value of independent variable |
| [in,out] | y | take \(y_n\) and compute \(y_{n+1}\) |
| [in] | save_to_file | flag to save results to a CSV file (1) or not (0) |
Definition at line 103 of file ode_semi_implicit_euler.cpp.
| void semi_implicit_euler_step | ( | const double | dx, |
| const double & | x, | ||
| std::valarray< double > * | y, | ||
| std::valarray< double > * | dy ) |
Compute next step approximation using the semi-implicit-Euler method.
\[y_{n+1}=y_n + dx\cdot f\left(x_n,y_n\right)\]
| [in] | dx | step size |
| [in] | x | take \(x_n\) and compute \(x_{n+1}\) |
| [in,out] | y | take \(y_n\) and compute \(y_{n+1}\) |
| [in,out] | dy | compute \(f\left(x_n,y_n\right)\) |
Definition at line 82 of file ode_semi_implicit_euler.cpp.