10 <<
"gauss_legendre_integral: numerical precision must be positive\n";
14 const unsigned int m = (samples + 1) / 2;
16 double z, zSqr,
pp,
p1,
p2, p3;
18 for (
unsigned int i = 0;
i <
m; ++
i) {
19 z =
std::cos(3.14159265358979323846 * (
i + 0.75) / (samples + 0.5));
24 for (
unsigned int j = 0;
j < samples; ++
j) {
27 p1 = ((2.0 *
j + 1.0) * z * p2 -
j * p3) / (
j + 1.0);
29 pp = samples * (z * p1 -
p2) / (zSqr - 1.0);
31 }
while (std::fabs(p1 / pp) > epsilon);
34 x[samples -
i - 1] = z;
35 w[
i] = 2.0 / ((1.0 - zSqr) * pp * pp);
36 w[samples -
i - 1] =
w[
i];
Cos< T >::type cos(const T &t)
GaussLegendreIntegrator()
static const double w[12]
static const double x[12]