59void qagi(std::function<
double(
double)> f,
double bound,
const int inf,
60 const double epsabs,
const double epsrel,
61 double& result,
double& abserr,
unsigned int& status);
74void qk15i(std::function<
double(
double)> f,
double bound,
const int inf,
75 const double a,
const double b,
double& result,
double& abserr,
76 double& resabs,
double& resasc);
79void qk15(std::function<
double(
double)> f,
const double a,
const double b,
80 double& result,
double& abserr,
double& resabs,
double& resasc);
92int deqn(
const int n, std::vector<std::vector<double> >& a,
93 std::vector<double>& b);
95int deqinv(
const int n, std::vector<std::vector<double> >& a,
96 std::vector<double>& b);
98void dfact(
const int n, std::vector<std::vector<double> >& a,
99 std::vector<int>& ir,
int& ifail,
double& det,
int& jfail);
100void dfeqn(
const int n, std::vector<std::vector<double> >& a,
101 std::vector<int>& ir, std::vector<double>& b);
102void dfinv(
const int n, std::vector<std::vector<double> >& a,
103 std::vector<int>& ir);
105int dinv(
const int n, std::vector<std::vector<double> >& a);
107void cfact(
const int n, std::vector<std::vector<std::complex<double> > >& a,
108 std::vector<int>& ir,
int& ifail, std::complex<double>& det,
110void cfinv(
const int n, std::vector<std::vector<std::complex<double> > >& a,
111 std::vector<int>& ir);
114int cinv(
const int n, std::vector<std::vector<std::complex<double> > >& a);
119inline double Legendre(
const unsigned int n,
const double x) {
121 if (std::abs(x) > 1.)
return 0.;
124 if (n == 0)
return p0;
125 if (n == 1)
return p1;
126 for (
unsigned int k = 1; k < n; ++k) {
127 p0 = ((2 * k + 1) * x * p1 - k * p0) / (k + 1);
136 const double y = xx / 3.75;
137 const double y2 = y * y;
138 return 1. + 3.5156229 * y2 + 3.0899424 * y2 * y2 +
139 1.2067492 * pow(y2, 3) + 0.2659732 * pow(y2, 4) +
140 0.0360768 * pow(y2, 5) + 0.0045813 * pow(y2, 6);
144 const double y = xx / 3.75;
145 const double y2 = y * y;
147 (0.5 + 0.87890594 * y2 + 0.51498869 * y2 * y2 +
148 0.15084934 * pow(y2, 3) + 0.02658733 * pow(y2, 4) +
149 0.00301532 * pow(y2, 5) + 0.00032411 * pow(y2, 6));
153 const double y = xx / 2.;
154 const double y2 = y * y;
155 return -log(y) *
BesselI0S(xx) - 0.57721566 +
156 0.42278420 * y2 + 0.23069756 * y2 * y2 +
157 0.03488590 * pow(y2, 3) + 0.00262698 * pow(y2, 4) +
158 0.00010750 * pow(y2, 5) + 0.00000740 * pow(y2, 6);
162 const double y = 2. / xx;
163 return (exp(-xx) / sqrt(xx)) *
164 (1.25331414 - 0.07832358 * y + 0.02189568 * y * y -
165 0.01062446 * pow(y, 3) + 0.00587872 * pow(y, 4) -
166 0.00251540 * pow(y, 5) + 0.00053208 * pow(y, 6));
170 const double y = xx / 2.;
171 const double y2 = y * y;
174 (1. + 0.15443144 * y2 - 0.67278579 * y2 * y2 -
175 0.18156897 * pow(y2, 3) - 0.01919402 * pow(y2, 4) -
176 0.00110404 * pow(y2, 5) - 0.00004686 * pow(y2, 6));
180 const double y = 2. / xx;
181 return (exp(-xx) / sqrt(xx)) *
182 (1.25331414 + 0.23498619 * y - 0.03655620 * y * y +
183 0.01504268 * pow(y, 3) - 0.00780353 * pow(y, 4) +
184 0.00325614 * pow(y, 5) - 0.00068245 * pow(y, 6));
189double Divdif(
const std::vector<double>& f,
const std::vector<double>& a,
190 int nn,
double x,
int mm);
194bool Boxin2(
const std::vector<std::vector<double> >& value,
195 const std::vector<double>& xAxis,
const std::vector<double>& yAxis,
196 const int nx,
const int ny,
const double xx,
const double yy,
197 double& f,
const int iOrder);
200bool Boxin3(
const std::vector<std::vector<std::vector<double> > >& value,
201 const std::vector<double>& xAxis,
const std::vector<double>& yAxis,
202 const std::vector<double>& zAxis,
const int nx,
const int ny,
203 const int nz,
const double xx,
const double yy,
const double zz,
204 double& f,
const int iOrder);
208 std::function<
double(
double,
const std::vector<double>&)> f,
209 std::vector<double>& par, std::vector<double>& epar,
210 const std::vector<double>& x,
const std::vector<double>& y,
211 const std::vector<double>& ey,
const unsigned int nMaxIter,
212 const double diff,
double& chi2,
const double eps,
213 const bool debug,
const bool verbose);
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)
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 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)
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)
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)
double BesselK0L(const double xx)
double BesselI0S(const double xx)
double BesselI1S(const double xx)
double Legendre(const unsigned int n, const double x)
Legendre polynomials.
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.
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)
double Divdif(const std::vector< double > &f, const std::vector< double > &a, int nn, double x, int mm)
double BesselK0S(const double xx)
double BesselK1L(const double xx)