Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ integrate_1d_gauss_kronrod() [2/2]

template<typename F , typename... Args, require_all_st_arithmetic< Args... > * = nullptr>
double stan::math::integrate_1d_gauss_kronrod ( const F &  f,
double  a,
double  b,
std::ostream *  msgs,
const Args &...  args 
)
inline

Compute the integral of the single variable function f from a to b using adaptive Gauss-Kronrod (G21,K21) quadrature.

a and b can be finite or infinite.

The signature for f should be: double f(double x, double xc, std::ostream* msgs, Args... args...)

It should return the value of the function evaluated at x. Any errors should be printed to the msgs stream. xc is unused (always NaN) here; see integrate_gk above for details.

The integration algorithm terminates when the Boost estimate of the quadrature error satisfies

\[ \text{error} \leq \max(\text{relative\_tolerance} \cdot |I|, \text{absolute\_tolerance}) \]

where \(|I|\) is the Boost estimate of the L1 norm of the integral.

Template Parameters
Ftype of function to integrate
Argstypes of additional arguments forwarded to f (all arithmetic)
Parameters
fthe function to be integrated
alower limit of integration
bupper limit of integration
[in,out]msgsthe print stream for warning messages
argsadditional arguments passed to f
Returns
numeric integral of function f

Definition at line 182 of file integrate_1d_gauss_kronrod.hpp.