Antkeeper  0.0.1
Functions
math::quadrature Namespace Reference

Numerical integration functions. More...

Functions

template<class UnaryOp , class InputIt >
std::invoke_result< UnaryOp, typename std::iterator_traits< InputIt >::value_type >::type simpson (UnaryOp f, InputIt first, InputIt last)
 Approximates the definite integral of a function using Simpson's 1/3 rule. More...
 
template<class UnaryOp , class InputIt >
std::invoke_result< UnaryOp, typename std::iterator_traits< InputIt >::value_type >::type trapezoid (UnaryOp f, InputIt first, InputIt last)
 Approximates the definite integral of a function using the trapezoidal rule. More...
 

Detailed Description

Numerical integration functions.

Function Documentation

◆ simpson()

template<class UnaryOp , class InputIt >
std::invoke_result<UnaryOp, typename std::iterator_traits<InputIt>::value_type>::type math::quadrature::simpson ( UnaryOp  f,
InputIt  first,
InputIt  last 
)

Approximates the definite integral of a function using Simpson's 1/3 rule.

Parameters
fUnary function object to integrate.
first,lastRange of sample points on [first, last).
Returns
Approximated integral of f.
See also
https://en.wikipedia.org/wiki/Simpson%27s_rule

Definition at line 43 of file quadrature.hpp.

◆ trapezoid()

template<class UnaryOp , class InputIt >
std::invoke_result<UnaryOp, typename std::iterator_traits<InputIt>::value_type>::type math::quadrature::trapezoid ( UnaryOp  f,
InputIt  first,
InputIt  last 
)

Approximates the definite integral of a function using the trapezoidal rule.

Parameters
fUnary function object to integrate.
first,lastRange of sample points on [first, last).
Returns
Approximated integral of f.
See also
https://en.wikipedia.org/wiki/Trapezoidal_rule

Definition at line 92 of file quadrature.hpp.