|
limes 3.1.0
Composable Calculus Expressions for C++20
|
Definite integral expression node. More...
#include <integral.hpp>
Public Types | |
| using | value_type = typename E::value_type |
| using | integrand_type = E |
| using | lower_bound_type = Lo |
| using | upper_bound_type = Hi |
Public Member Functions | |
| constexpr | Integral (E e, Lo lo, Hi hi, value_type tol=value_type(1e-10)) noexcept |
| algorithms::integration_result< value_type > | eval (std::span< value_type const > args) const |
| algorithms::integration_result< value_type > | eval () const |
| template<typename Method > requires methods::is_integration_method_v<Method> | |
| algorithms::integration_result< value_type > | eval (Method const &method, std::span< value_type const > args) const |
| Evaluate the integral using a specific integration method. | |
| template<typename Method > requires methods::is_integration_method_v<Method> | |
| algorithms::integration_result< value_type > | eval (Method const &method) const |
| Evaluate the integral using a specific method (no outer arguments) | |
| algorithms::integration_result< value_type > | evaluate (std::span< value_type const > args) const |
| algorithms::integration_result< value_type > | evaluate () const |
| template<std::size_t NewDim, typename NewLo , typename NewHi > | |
| constexpr auto | over (NewLo lo, NewHi hi) const |
| template<std::size_t NewDim> | |
| constexpr auto | over (value_type lo, value_type hi) const |
| std::string | to_string () const |
| template<std::size_t SplitDim = Dim> | |
| constexpr auto | split (value_type point) const |
| template<std::size_t D1, std::size_t D2> requires is_integral_v<E> | |
| constexpr auto | swap () const |
| template<typename Phi , typename Jacobian > | |
| constexpr auto | transform (Phi phi, Jacobian jacobian, value_type new_lower, value_type new_upper) const |
| constexpr auto | with_tolerance (value_type tol) const |
| Set new tolerance for this integral. | |
Public Attributes | |
| E | integrand |
| Lo | lower |
| Hi | upper |
| value_type | tolerance |
Static Public Attributes | |
| static constexpr std::size_t | dim_v = Dim |
| static constexpr std::size_t | arity_v = (E::arity_v > 0) ? (E::arity_v - 1) : 0 |
Definite integral expression node.
Represents the integral ∫ₐᵇ f(x₀,...,xₙ) dxₐᵢₘ where:
E is the integrand expressionDim is the dimension being integrated overLo and Hi are the bounds (constant or expression-valued)The arity of the result is one less than the integrand's arity, since dimension Dim is consumed by the integration.
| E | Integrand expression type |
| Dim | The variable dimension being integrated (0-indexed) |
| Lo | Lower bound type (ConstBound or ExprBound) |
| Hi | Upper bound type (ConstBound or ExprBound) |
split(point) — Split integral at a point: [a,b] → [a,c] + [c,b]swap<D1,D2>() — Swap integration order (Fubini's theorem)Definition at line 210 of file integral.hpp.
| using limes::expr::Integral< E, Dim, Lo, Hi >::integrand_type = E |
Definition at line 212 of file integral.hpp.
| using limes::expr::Integral< E, Dim, Lo, Hi >::lower_bound_type = Lo |
Definition at line 213 of file integral.hpp.
| using limes::expr::Integral< E, Dim, Lo, Hi >::upper_bound_type = Hi |
Definition at line 214 of file integral.hpp.
| using limes::expr::Integral< E, Dim, Lo, Hi >::value_type = typename E::value_type |
Definition at line 211 of file integral.hpp.
|
inlineconstexprnoexcept |
Definition at line 224 of file integral.hpp.
|
inline |
Definition at line 239 of file integral.hpp.
References limes::expr::Integral< E, Dim, Lo, Hi >::eval().
Referenced by limes::expr::Integral< E, Dim, Lo, Hi >::eval(), limes::expr::Integral< E, Dim, Lo, Hi >::eval(), limes::expr::Integral< E, Dim, Lo, Hi >::evaluate(), and limes::expr::Integral< E, Dim, Lo, Hi >::evaluate().
|
inline |
Evaluate the integral using a specific method (no outer arguments)
Definition at line 259 of file integral.hpp.
References limes::expr::Integral< E, Dim, Lo, Hi >::eval().
|
inline |
Evaluate the integral using a specific integration method.
Definition at line 247 of file integral.hpp.
References limes::expr::Integral< E, Dim, Lo, Hi >::integrand, limes::expr::Integral< E, Dim, Lo, Hi >::lower, and limes::expr::Integral< E, Dim, Lo, Hi >::upper.
|
inline |
Definition at line 229 of file integral.hpp.
References limes::expr::Integral< E, Dim, Lo, Hi >::integrand, limes::expr::Integral< E, Dim, Lo, Hi >::lower, limes::expr::Integral< E, Dim, Lo, Hi >::tolerance, and limes::expr::Integral< E, Dim, Lo, Hi >::upper.
|
inline |
Definition at line 271 of file integral.hpp.
References limes::expr::Integral< E, Dim, Lo, Hi >::eval().
|
inline |
Definition at line 265 of file integral.hpp.
References limes::expr::Integral< E, Dim, Lo, Hi >::eval().
|
inlineconstexpr |
Definition at line 277 of file integral.hpp.
References limes::expr::make_bound(), and limes::expr::Integral< E, Dim, Lo, Hi >::tolerance.
|
inlineconstexpr |
Definition at line 286 of file integral.hpp.
References limes::expr::Integral< E, Dim, Lo, Hi >::tolerance.
|
inlineconstexpr |
Split the integration domain at a given point
Returns a pair of integrals: [lower, point] and [point, upper] Invariant: left.evaluate() + right.evaluate() ≈ original.evaluate()
Example: auto I = integral(f).over<0>(0.0, 1.0); auto [left, right] = I.split(0.5); // left integrates from 0 to 0.5 // right integrates from 0.5 to 1
Definition at line 315 of file integral.hpp.
References limes::expr::Integral< E, Dim, Lo, Hi >::integrand, limes::expr::Integral< E, Dim, Lo, Hi >::lower, limes::expr::Integral< E, Dim, Lo, Hi >::tolerance, and limes::expr::Integral< E, Dim, Lo, Hi >::upper.
|
inlineconstexpr |
Swap integration order for nested integrals (Fubini's theorem)
For a double integral ∫∫ f(x,y) dx dy, swapping gives ∫∫ f(x,y) dy dx Only available when the integrand is itself an Integral
Example: auto I = integral(integral(x*y).over<0>(0,1)).over<1>(0,1); auto J = I.swap<0, 1>(); // Swap x and y integration order // I.evaluate() ≈ J.evaluate()
Definition at line 340 of file integral.hpp.
References limes::expr::Integral< E, Dim, Lo, Hi >::integrand, limes::expr::Integral< E, Dim, Lo, Hi >::lower, limes::expr::Integral< E, Dim, Lo, Hi >::tolerance, and limes::expr::Integral< E, Dim, Lo, Hi >::upper.
|
inline |
Definition at line 293 of file integral.hpp.
References limes::expr::Integral< E, Dim, Lo, Hi >::integrand, limes::expr::Integral< E, Dim, Lo, Hi >::lower, and limes::expr::Integral< E, Dim, Lo, Hi >::upper.
|
inlineconstexpr |
Apply a change of variables (substitution) to the integral
For ∫[a,b] f(x) dx, using x = φ(t) gives: ∫[c,d] f(φ(t)) |φ'(t)| dt
Example (removing sqrt singularity using x = t²): auto I = integral(1.0 / sqrt(x)).over<0>(0.0, 1.0); auto T = I.transform( [](double t) { return t*t; }, // φ: t → t² [](double t) { return 2*t; }, // φ': t → 2t 0.0, 1.0 // new bounds );
Definition at line 380 of file integral.hpp.
References limes::expr::Integral< E, Dim, Lo, Hi >::tolerance.
|
inlineconstexpr |
Set new tolerance for this integral.
Definition at line 392 of file integral.hpp.
References limes::expr::Integral< E, Dim, Lo, Hi >::integrand, limes::expr::Integral< E, Dim, Lo, Hi >::lower, and limes::expr::Integral< E, Dim, Lo, Hi >::upper.
|
staticconstexpr |
Definition at line 217 of file integral.hpp.
|
staticconstexpr |
Definition at line 216 of file integral.hpp.
| E limes::expr::Integral< E, Dim, Lo, Hi >::integrand |
Definition at line 219 of file integral.hpp.
Referenced by limes::expr::Integral< E, Dim, Lo, Hi >::eval(), limes::expr::Integral< E, Dim, Lo, Hi >::eval(), limes::expr::Integral< E, Dim, Lo, Hi >::split(), limes::expr::Integral< E, Dim, Lo, Hi >::swap(), limes::expr::Integral< E, Dim, Lo, Hi >::to_string(), and limes::expr::Integral< E, Dim, Lo, Hi >::with_tolerance().
| Lo limes::expr::Integral< E, Dim, Lo, Hi >::lower |
Definition at line 220 of file integral.hpp.
Referenced by limes::expr::Integral< E, Dim, Lo, Hi >::eval(), limes::expr::Integral< E, Dim, Lo, Hi >::eval(), limes::expr::Integral< E, Dim, Lo, Hi >::split(), limes::expr::Integral< E, Dim, Lo, Hi >::swap(), limes::expr::Integral< E, Dim, Lo, Hi >::to_string(), and limes::expr::Integral< E, Dim, Lo, Hi >::with_tolerance().
| value_type limes::expr::Integral< E, Dim, Lo, Hi >::tolerance |
Definition at line 222 of file integral.hpp.
Referenced by limes::expr::Integral< E, Dim, Lo, Hi >::eval(), limes::expr::Integral< E, Dim, Lo, Hi >::over(), limes::expr::Integral< E, Dim, Lo, Hi >::over(), limes::expr::Integral< E, Dim, Lo, Hi >::split(), limes::expr::Integral< E, Dim, Lo, Hi >::swap(), and limes::expr::Integral< E, Dim, Lo, Hi >::transform().
| Hi limes::expr::Integral< E, Dim, Lo, Hi >::upper |
Definition at line 221 of file integral.hpp.
Referenced by limes::expr::Integral< E, Dim, Lo, Hi >::eval(), limes::expr::Integral< E, Dim, Lo, Hi >::eval(), limes::expr::Integral< E, Dim, Lo, Hi >::split(), limes::expr::Integral< E, Dim, Lo, Hi >::swap(), limes::expr::Integral< E, Dim, Lo, Hi >::to_string(), and limes::expr::Integral< E, Dim, Lo, Hi >::with_tolerance().