## `numeric::gldata` -- weights and abscissae of Gauss-Legendre quadrature

#### Introduction

`numeric::gldata``(n, ..)` returns the weights and the abscissae of the Gauss-Legendre quadrature rule with n nodes.

#### Call(s)

`numeric::gldata(n, digits)`

#### Parameters

`n` | - | the number of nodes: a positive integer
`digits` | - | the number of decimal digits: a positive integer

#### Returns

A list `[b,c]` is returned. The lists `b=[b[1],..,b[n]]` and `c=[c[1],..,c[n]]` are numerical approximations of the weights and abscissae with `digits` significant digits.

#### Side Effects

The function uses `option remember`. It is not sensitive to the environment variable `DIGITS`, because the numerical working precision is specified by the second argument `digits`.

#### Related Functions

`numeric::gtdata`, `numeric::ncdata`, `numeric::quadrature`

#### Details

- The Gauss-Legendre quadrature rule sum(b[i]*f(c[i]),i=1..n) produces the exact integral int(f(x),x=0..1) for all polynomial integrands f(x) through degree 2n-1. The weights b[i] and abscissae c[i] are related to the roots of the n-th Legendre polynomial.
- The weights and abscissae are computed by a straightforward numerical algorithm with a working precision set by the argument `digits`. The resulting floating point numbers are correct to `digits` decimal places.
- Typically, the argument `digits` should coincide with the actual value of `DIGITS`.
- The data for `n=20,40,80,160` with `digits`<=200 are stored internally. They are returned immediately without any computational costs.
- Due to the internal remember mechanism only the first call to `numeric::gldata` leads to computational costs. For any further call with the same arguments the data are returned immediately.
- For odd n the abscissa c[(n+1)/2]=1/2 and the corresponding weight b[(n-1)/2] are rational numbers.

#### Example 1

The following call computes the Gaussian data with the default precision of `DIGITS=10` decimal digits:

    >> numeric::gldata(4, DIGITS)

          [[0.1739274226, 0.3260725774, 0.3260725774, 0.1739274226],

             [0.0694318442, 0.3300094782, 0.6699905218, 0.9305681558]]

#### Example 2

For odd n exact rational data for c[(n+1)/2] and b[(n-1)/2] are returned:

    >> DIGITS := 4: numeric::gldata(5, DIGITS)

          [[0.1185, 0.2393, 64/225, 0.2393, 0.1185],

             [0.04691, 0.2308, 1/2, 0.7692, 0.9531]]

    >> delete DIGITS:

#### Background

- The numerical integrator `numeric::quadrature` calls `numeric::gldata` to provide the data for Gaussian quadrature.

#### Changes

- Efficiency was improved.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000