54template <
typename Signature>
64template <
typename Result, base::concepts::real_scalar Variable>
89 template <base::concepts::invocable_as<result_type(variable_type)> Function>
100 const variable_type center_weight = width * center_weight_rate;
102 sum += function(center) * center_weight;
113 function(var_plus) + function(var_minus);
116 "A function value was not a finite value. "
117 "Stopped numerical integration.");
120 sum += function_values * weight;
140 template <base::concepts::invocable_as<result_type(variable_type)>
141 LeftBoundaryFunction,
142 base::concepts::invocable_as<result_type(variable_type)>
143 RightBoundaryFunction>
145 const LeftBoundaryFunction& left_boundary_function,
146 const RightBoundaryFunction& right_boundary_function,
152 const variable_type half_width = half<variable_type> * width;
156 const variable_type center_weight = width * center_weight_rate;
158 sum += left_boundary_function(half_width) * center_weight;
167 left_boundary_function(variable_distance) +
168 right_boundary_function(-variable_distance);
171 "A function value was not a finite value. "
172 "Stopped numerical integration.");
175 sum += function_values * weight;
190 template <base::concepts::invocable_as<result_type(variable_type)> Function>
210 template <base::concepts::invocable_as<result_type(variable_type)>
211 LeftBoundaryFunction,
212 base::concepts::invocable_as<result_type(variable_type)>
213 RightBoundaryFunction>
215 const LeftBoundaryFunction& left_boundary_function,
216 const RightBoundaryFunction& right_boundary_function,
219 left_boundary_function, right_boundary_function, left, right);
230 this->
logger(),
"Maximum point must be a positive value.");
244 "Number of points must be a positive integer.");
267 half_width * std::cosh(changed_var) * exp_value /
268 (exp_value_p1 * exp_value_p1);
290 std::exp(-pi<variable_type> * std::sinh(changed_variable));
291 const variable_type denominator = one<variable_type> + exp_value;
294 std::cosh(changed_variable) * exp_value /
295 (denominator * denominator));
auto points(index_type val) -> de_finite_integrator &
Set number of points.
std::vector< variable_type > weight_rate_list_
List of rates of weights of points.
variable_type max_point_
Maximum point in changed variable.
variable_type interval_
Interval of changed variable.
std::vector< variable_type > variable_rate_list_
List of rates of distances of points from the upper bound.
static constexpr index_type default_points
Default number of points.
de_finite_integrator()
Constructor.
void calculate_coefficients()
Calculate coefficients for integration.
index_type points_
Number of points.
static auto diff_coeff(variable_type changed_var, variable_type half_width) -> variable_type
Calculate differential coefficient for change of variable.
auto operator()(const LeftBoundaryFunction &left_boundary_function, const RightBoundaryFunction &right_boundary_function, variable_type left, variable_type right) const -> result_type
Integrate a function.
auto max_point(variable_type val) -> de_finite_integrator &
Set maximum point in changed variable.
auto operator()(const Function &function, variable_type left, variable_type right) const -> result_type
Integrate a function.
static constexpr auto default_max_point
Default maximum point in changed variable.
auto integrate(const LeftBoundaryFunction &left_boundary_function, const RightBoundaryFunction &right_boundary_function, variable_type left, variable_type right) const -> result_type
Integrate a function.
std::decay_t< Variable > variable_type
Type of variables.
auto integrate(const Function &function, variable_type left, variable_type right) const -> result_type
Integrate a function.
std::decay_t< Result > result_type
Type of results.
Class to perform numerical integration on finite range using double exponential rule.
Class of tags of logs without memory management.
Class to incorporate logging in algorithms.
logging_mixin(log_tag_view tag)
Constructor.
auto logger() const noexcept -> const num_collect::logging::logger &
Access to the logger.
Class to add numbers using Kahan summation kahan1965.
auto sum() const noexcept -> const T &
Get sum.
Definition of index_type type.
Definition of invocable_as concept.
Definition of isfinite function.
Definition of kahan_adder class.
Definition of log_tag_view class.
Definition of macros for logging.
#define NUM_COLLECT_LOG_WARNING(LOGGER,...)
Write a warning log.
Definition of logging_mixin class.
std::ptrdiff_t index_type
Type of indices in this library.
auto isfinite(const T &val) -> bool
Check whether a number is finite.
constexpr T pi
Value of pi, .
constexpr T half
Value 0.5.
Namespace of numerical integration.
constexpr auto de_finite_integrator_tag
Tag of de_finite_integrator.
Definition of NUM_COLLECT_PRECONDITION macro.
#define NUM_COLLECT_PRECONDITION(CONDITION,...)
Check whether a precondition is satisfied and throw an exception if not.
Definition of real_scalar concept.