17  return {-0.577350269189625765, 0.577350269189625765};
 
 
   21  return {-0.774596669241483377, 0., 0.774596669241483377};
 
 
   24  return {5. / 9., 8. / 9., 5. / 9.};
 
 
   27  return {-0.861136311594052575, -0.339981043584856265, 0.339981043584856265,
 
   28          0.861136311594052575};
 
 
   31  return {0.347854845137453857, 0.652145154862546143, 0.652145154862546143,
 
   32          0.347854845137453857};
 
 
   35  return {-0.906179845938663993, -0.538469310105683091, 0.,
 
   36          0.538469310105683091, 0.906179845938663993};
 
 
   39  return {0.236926885056189088, 0.478628670499366468, 128. / 225.,
 
   40          0.478628670499366468, 0.236926885056189088};
 
 
   43  return {-0.932469514203152028, -0.661209386466264514, -0.238619186083196909,
 
   44          0.238619186083196909,  0.661209386466264514,  0.932469514203152028};
 
 
   47  return {0.171324492379170345, 0.360761573048138608, 0.467913934572691047,
 
   48          0.467913934572691047, 0.360761573048138608, 0.171324492379170345};
 
 
   98void qagi(std::function<
double(
double)> f, 
double bound, 
const int inf,
 
   99          const double epsabs, 
const double epsrel, 
double& result,
 
  100          double& abserr, 
unsigned int& status);
 
  113void qk15i(std::function<
double(
double)> f, 
double bound, 
const int inf,
 
  114           const double a, 
const double b, 
double& result, 
double& abserr,
 
  115           double& resabs, 
double& resasc);
 
  118void qk15(std::function<
double(
double)> f, 
const double a, 
const double b,
 
  119          double& result, 
double& abserr, 
double& resabs, 
double& resasc);
 
 
  131int deqn(
const int n, std::vector<std::vector<double> >& a,
 
  132         std::vector<double>& b);
 
  134int deqinv(
const int n, std::vector<std::vector<double> >& a,
 
  135           std::vector<double>& b);
 
  137void dfact(
const int n, std::vector<std::vector<double> >& a,
 
  138           std::vector<int>& ir, 
int& ifail, 
double& det, 
int& jfail);
 
  139void dfeqn(
const int n, std::vector<std::vector<double> >& a,
 
  140           std::vector<int>& ir, std::vector<double>& b);
 
  141void dfinv(
const int n, std::vector<std::vector<double> >& a,
 
  142           std::vector<int>& ir);
 
  144int dinv(
const int n, std::vector<std::vector<double> >& a);
 
  146void cfact(
const int n, std::vector<std::vector<std::complex<double> > >& a,
 
  147           std::vector<int>& ir, 
int& ifail, std::complex<double>& det,
 
  149void cfinv(
const int n, std::vector<std::vector<std::complex<double> > >& a,
 
  150           std::vector<int>& ir);
 
  153int cinv(
const int n, std::vector<std::vector<std::complex<double> > >& a);
 
  155void cfft(std::vector<std::complex<double> >& a, 
const int msign);
 
 
  159inline double Legendre(
const unsigned int n, 
const double x) {
 
  160  if (std::abs(x) > 1.) 
return 0.;
 
  163  if (n == 0) 
return p0;
 
  164  if (n == 1) 
return p1;
 
  165  for (
unsigned int k = 1; k < n; ++k) {
 
  166    p0 = ((2 * k + 1) * x * p1 - k * p0) / (k + 1);
 
 
  175  const double y = xx / 3.75;
 
  176  const double y2 = y * y;
 
  177  return 1. + 3.5156229 * y2 + 3.0899424 * y2 * y2 + 1.2067492 * pow(y2, 3) +
 
  178         0.2659732 * pow(y2, 4) + 0.0360768 * pow(y2, 5) +
 
  179         0.0045813 * pow(y2, 6);
 
 
  183  const double y = xx / 3.75;
 
  184  const double y2 = y * y;
 
  185  return xx * (0.5 + 0.87890594 * y2 + 0.51498869 * y2 * y2 +
 
  186               0.15084934 * pow(y2, 3) + 0.02658733 * pow(y2, 4) +
 
  187               0.00301532 * pow(y2, 5) + 0.00032411 * pow(y2, 6));
 
 
  191  const double y = xx / 2.;
 
  192  const double y2 = y * y;
 
  193  return -log(y) * 
BesselI0S(xx) - Gamma + 0.42278420 * y2 +
 
  194         0.23069756 * y2 * y2 + 0.03488590 * pow(y2, 3) +
 
  195         0.00262698 * pow(y2, 4) + 0.00010750 * pow(y2, 5) +
 
  196         0.00000740 * pow(y2, 6);
 
 
  200  const double y = 2. / xx;
 
  201  return (exp(-xx) / sqrt(xx)) *
 
  202         (1.25331414 - 0.07832358 * y + 0.02189568 * y * y -
 
  203          0.01062446 * pow(y, 3) + 0.00587872 * pow(y, 4) -
 
  204          0.00251540 * pow(y, 5) + 0.00053208 * pow(y, 6));
 
 
  208  const double y = xx / 2.;
 
  209  const double y2 = y * y;
 
  211         (1. / xx) * (1. + 0.15443144 * y2 - 0.67278579 * y2 * y2 -
 
  212                      0.18156897 * pow(y2, 3) - 0.01919402 * pow(y2, 4) -
 
  213                      0.00110404 * pow(y2, 5) - 0.00004686 * pow(y2, 6));
 
 
  217  const double y = 2. / xx;
 
  218  return (exp(-xx) / sqrt(xx)) *
 
  219         (1.25331414 + 0.23498619 * y - 0.03655620 * y * y +
 
  220          0.01504268 * pow(y, 3) - 0.00780353 * pow(y, 4) +
 
  221          0.00325614 * pow(y, 5) - 0.00068245 * pow(y, 6));
 
 
  226double Divdif(
const std::vector<double>& f, 
const std::vector<double>& a,
 
  227              int nn, 
double x, 
int mm);
 
  230                           const std::vector<double>& xtab, 
const double x);
 
  234bool Boxin2(
const std::vector<std::vector<double> >& value,
 
  235            const std::vector<double>& xAxis, 
const std::vector<double>& yAxis,
 
  236            const int nx, 
const int ny, 
const double xx, 
const double yy,
 
  237            double& f, 
const int iOrder);
 
  240bool Boxin3(
const std::vector<std::vector<std::vector<double> > >& value,
 
  241            const std::vector<double>& xAxis, 
const std::vector<double>& yAxis,
 
  242            const std::vector<double>& zAxis, 
const int nx, 
const int ny,
 
  243            const int nz, 
const double xx, 
const double yy, 
const double zz,
 
  244            double& f, 
const int iOrder);
 
  248    std::function<
double(
double, 
const std::vector<double>&)> f,
 
  249    std::vector<double>& par, std::vector<double>& epar,
 
  250    const std::vector<double>& x, 
const std::vector<double>& y,
 
  251    const std::vector<double>& ey, 
const unsigned int nMaxIter,
 
  252    const double diff, 
double& chi2, 
const double eps, 
const bool debug,
 
 
Linear algebra routines from CERNLIB.
void dfinv(const int n, std::vector< std::vector< double > > &a, std::vector< int > &ir)
void cfact(const int n, std::vector< std::vector< std::complex< double > > > &a, std::vector< int > &ir, int &ifail, std::complex< double > &det, int &jfail)
int deqn(const int n, std::vector< std::vector< double > > &a, std::vector< double > &b)
Replaces b by the solution x of Ax = b, after which A is undefined.
void dfact(const int n, std::vector< std::vector< double > > &a, std::vector< int > &ir, int &ifail, double &det, int &jfail)
void cfinv(const int n, std::vector< std::vector< std::complex< double > > > &a, std::vector< int > &ir)
int dinv(const int n, std::vector< std::vector< double > > &a)
Replace square matrix A by its inverse.
void dfeqn(const int n, std::vector< std::vector< double > > &a, std::vector< int > &ir, std::vector< double > &b)
int cinv(const int n, std::vector< std::vector< std::complex< double > > > &a)
Replace square matrix A by its inverse.
int deqinv(const int n, std::vector< std::vector< double > > &a, std::vector< double > &b)
Replaces b by the solution x of Ax = b, and replace A by its inverse.
void cfft(std::vector< std::complex< double > > &a, const int msign)
Functions for performing numerical integration (quadrature).
void qk15(std::function< double(double)> f, const double a, const double b, double &result, double &abserr, double &resabs, double &resasc)
15-point Gauss-Kronrod integration with finite integration range.
void qagi(std::function< double(double)> f, double bound, const int inf, const double epsabs, const double epsrel, double &result, double &abserr, unsigned int &status)
Estimates an integral over a semi-infinite or infinite interval.
void qk15i(std::function< double(double)> f, double bound, const int inf, const double a, const double b, double &result, double &abserr, double &resabs, double &resasc)
15-point Gauss-Kronrod integration with (semi-)infinite integration range.
Collection of numerical routines.
constexpr std::array< double, 4 > GaussLegendreWeights4()
constexpr std::array< double, 2 > GaussLegendreNodes2()
bool Boxin3(const std::vector< std::vector< std::vector< double > > > &value, const std::vector< double > &xAxis, const std::vector< double > &yAxis, const std::vector< double > &zAxis, const int nx, const int ny, const int nz, const double xx, const double yy, const double zz, double &f, const int iOrder)
Interpolation of order 1 and 2 in an irregular rectangular three-dimensional grid.
double BesselK0L(const double xx)
double BesselI0S(const double xx)
Modified Bessel functions.
double BesselI1S(const double xx)
constexpr std::array< double, 5 > GaussLegendreWeights5()
double Legendre(const unsigned int n, const double x)
Legendre polynomials.
constexpr std::array< double, 6 > GaussLegendreWeights6()
double BesselK1S(const double xx)
bool LeastSquaresFit(std::function< double(double, const std::vector< double > &)> f, std::vector< double > &par, std::vector< double > &epar, const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &ey, const unsigned int nMaxIter, const double diff, double &chi2, const double eps, const bool debug, const bool verbose)
Least-squares minimisation.
constexpr std::array< double, 2 > GaussLegendreWeights2()
bool Boxin2(const std::vector< std::vector< double > > &value, const std::vector< double > &xAxis, const std::vector< double > &yAxis, const int nx, const int ny, const double xx, const double yy, double &f, const int iOrder)
Interpolation of order 1 and 2 in an irregular rectangular two-dimensional grid.
constexpr std::array< double, 3 > GaussLegendreNodes3()
double LinearInterpolation(const std::vector< double > &ytab, const std::vector< double > &xtab, const double x)
constexpr std::array< double, 4 > GaussLegendreNodes4()
double Divdif(const std::vector< double > &f, const std::vector< double > &a, int nn, double x, int mm)
C++ version of DIVDIF (CERN program library E105) which performs tabular interpolation using symmetri...
constexpr std::array< double, 5 > GaussLegendreNodes5()
constexpr std::array< double, 3 > GaussLegendreWeights3()
double BesselK0S(const double xx)
double BesselK1L(const double xx)
constexpr std::array< double, 6 > GaussLegendreNodes6()