#include <qx/recursive_lambda.h>
#include <random>
#include <glm/glm.hpp>
#include <qx/math/integration.inl>
Go to the source code of this file.
|
template<class function_2d_t > |
double | qx::integrate_rectangle_rule (const function_2d_t &func, double x0, double x1, size_t nIntervalsPer1=10) |
| Integrate using rectangle rule. More...
|
|
template<class function_2d_t > |
double | qx::integrate_trapezoid_rule (const function_2d_t &func, double x0, double x1, size_t nIntervalsPer1=10) |
| Integrate using trapezoid rule. More...
|
|
template<class function_2d_t > |
double | qx::integrate_adaptive_midpoint (const function_2d_t &func, double x0, double x1, double fMaxSliceError, size_t nIntervalsPer1=10, size_t nMaxRecursion=300) |
| Integrate using adaptive midpoint. More...
|
|
template<class function_2d_t > |
double | qx::integrate_monte_carlo (const function_2d_t &funcIsInside, glm::dvec2 pos0, glm::dvec2 pos1, size_t nPointsPerOneSquare=1000) |
| Integrate using probabilistic algorithm Monte Carlo. More...
|
|
- Author
- Khrapov
- Date
- 6.08.2022
- Copyright
- © Nick Khrapov, 2022. All right reserved.
Definition in file integration.h.
◆ integrate_adaptive_midpoint()
template<class function_2d_t >
double qx::integrate_adaptive_midpoint |
( |
const function_2d_t & |
func, |
|
|
double |
x0, |
|
|
double |
x1, |
|
|
double |
fMaxSliceError, |
|
|
size_t |
nIntervalsPer1 = 10 , |
|
|
size_t |
nMaxRecursion = 300 |
|
) |
| |
|
inline |
Integrate using adaptive midpoint.
- Parameters
-
func | - target function |
x0 | - left border |
x1 | - right border |
fMaxSliceError | - max error per one slice |
nIntervalsPer1 | - number of intervals per dx = 1 |
nMaxRecursion | - max recursion depth |
- Template Parameters
-
function_2d_t | - function that takes double and returns double |
- Return values
-
Definition at line 50 of file integration.inl.
◆ integrate_monte_carlo()
template<class function_2d_t >
double qx::integrate_monte_carlo |
( |
const function_2d_t & |
funcIsInside, |
|
|
glm::dvec2 |
pos0, |
|
|
glm::dvec2 |
pos1, |
|
|
size_t |
nPointsPerOneSquare = 1000 |
|
) |
| |
|
inline |
Integrate using probabilistic algorithm Monte Carlo.
- Parameters
-
funcIsInside | - func that returns 1 if point is inside shape with positive value 0 if point is not inside shape -1 if point is inside shape with negative value |
pos0 | - left down corner coordinates |
pos1 | - right up corner coordinates |
nPointsPerOneSquare | - points per 1 square (more is better) |
- Template Parameters
-
function_2d_t | - function that takes double and returns double |
- Return values
-
Definition at line 107 of file integration.inl.
◆ integrate_rectangle_rule()
template<class function_2d_t >
double qx::integrate_rectangle_rule |
( |
const function_2d_t & |
func, |
|
|
double |
x0, |
|
|
double |
x1, |
|
|
size_t |
nIntervalsPer1 = 10 |
|
) |
| |
|
inline |
Integrate using rectangle rule.
- Parameters
-
func | - target function |
x0 | - left border |
x1 | - right border |
nIntervalsPer1 | - number of intervals per dx = 1 |
- Template Parameters
-
function_2d_t | - function that takes double and returns double |
- Return values
-
Definition at line 14 of file integration.inl.
◆ integrate_trapezoid_rule()
template<class function_2d_t >
double qx::integrate_trapezoid_rule |
( |
const function_2d_t & |
func, |
|
|
double |
x0, |
|
|
double |
x1, |
|
|
size_t |
nIntervalsPer1 = 10 |
|
) |
| |
|
inline |
Integrate using trapezoid rule.
- Parameters
-
func | - target function |
x0 | - left border |
x1 | - right border |
nIntervalsPer1 | - number of intervals per dx = 1 |
- Template Parameters
-
function_2d_t | - function that takes double and returns double |
- Return values
-
Definition at line 32 of file integration.inl.