9 <<
"gauss_legendre_integral: number of samples must be positive\n";
12 <<
"gauss_legendre_integral: numerical precision must be positive\n";
16 const unsigned int m = (samples + 1)/2;
20 for (
unsigned int i = 0;
i <
m; ++
i) {
21 z =
std::cos(3.14159265358979323846 * (
i + 0.75)/(samples + 0.5));
26 for (
unsigned int j = 0;
j < samples; ++
j) {
29 p1 = ((2.0*
j + 1.0)*z*p2 -
j*
p3)/(
j + 1.0);
31 pp = samples*(z*p1 -
p2)/(zSqr - 1.0);
33 }
while (std::fabs(p1/pp) > epsilon);
36 x[samples -
i - 1] =
z;
37 w[
i] = 2.0/((1.0 - zSqr)*pp*pp);
38 w[samples -
i -1] =
w[
i];
44 0.96028985649753623, 0.79666647741362674,
45 0.52553240991632899, 0.18343464249564980,
46 0.98940093499164993, 0.94457502307323258,
47 0.86563120238783174, 0.75540440835500303,
48 0.61787624440264375, 0.45801677765722739,
49 0.28160355077925891, 0.09501250983763744 };
52 0.10122853629037626, 0.22238103445337447,
53 0.31370664587788729, 0.36268378337836198,
54 0.02715245941175409, 0.06225352393864789,
55 0.09515851168249278, 0.12462897125553387,
56 0.14959598881657673, 0.16915651939500254,
57 0.18260341504492359, 0.18945061045506850 };
Cos< T >::type cos(const T &t)
GaussLegendreIntegrator()
static const double w[12]
static const double x[12]