5 #include <boost/math/distributions/gamma.hpp> 6 #include <boost/math/quadrature/gauss.hpp> 15 double gammaValue = boost::math::gamma_p_derivative(shape, t / scale) / scale;
24 int main(
int argc,
char **argv)
26 double gammaMean = 15.0;
27 double gammaVariance = 50.0;
35 for (
unsigned int i = 1;i < 11;++i)
37 double minValue = std::max(0.0,gammaMean - i * std::sqrt(gammaVariance));
38 double theoreticalMinValue = gammaMean - i * std::sqrt(gammaVariance);
39 double maxValue = gammaMean + i * std::sqrt(gammaVariance);
40 if (theoreticalMinValue < 0.0)
41 maxValue -= theoreticalMinValue;
42 std::cout <<
"Interest zone " << i <<
" [" << minValue <<
"," << maxValue <<
"]" << std::endl;
46 std::cout <<
"Gauss Laguerre value: " << integralValue << std::endl;
48 integralValue = boost::math::quadrature::gauss <double, 15>::integrate(integrand, minValue, maxValue);
49 std::cout <<
"Gauss Legendre value: " << integralValue << std::endl;
double GetIntegralValue(FunctionType integrand)
Computes the Gauss Laguerre quadrature of a function defined from R^+ into R. Recenters the function ...
int main(int argc, char **argv)
void SetInterestZone(double minVal, double maxVal)
Specifies region on which the main part of the function is to be seen. If not specified, R^+ is the region.
double operator()(const double t)