Given the
$2n+l$ moments of the weight function, nag_quad_1d_gauss_recm (d01tec) generates the recursion coefficients needed by
nag_quad_1d_gauss_wrec (d01tdc) to calculate a Gaussian quadrature rule.
nag_quad_1d_gauss_recm (d01tec) should only be used if the three-term recurrence cannot be determined analytically. A system of equations are formed, using the moments provided. This set of equations becomes ill-conditioned for moderate values of $n$, the number of abscissae and weights required. In most implementations quadruple precision calculation is used to maintain as much accuracy as possible.
Internally quadruple precision is used to minimize loss of accuracy as much as possible.
nag_quad_1d_gauss_recm (d01tec) is not threaded in any implementation.
Because the function cannot check the validity of all the data presented, the user is advised to independently check the result, perhaps by integrating a function whose integral is known, using nag_quad_1d_gauss_recm (d01tec) and subsequently
nag_quad_1d_gauss_wrec (d01tdc), to compare answers.
This example program uses nag_quad_1d_gauss_recm (d01tec) and moments to calculate a three-term recurrence relationship appropriate for Gauss–Legendre quadrature. It then uses the recurrence relationship to derive the weights and abscissae by calling
nag_quad_1d_gauss_wrec (d01tdc).
None.