NAG Library Routine Document
D02UYF obtains the weights for Clenshaw–Curtis quadrature at Chebyshev points. This allows for fast approximations of integrals for functions specified on Chebyshev Gauss–Lobatto points on .
D02UYF obtains the weights for Clenshaw–Curtis quadrature at Chebyshev points.
Given the (Clenshaw–Curtis) weights , for , and function values (where , for , are the Chebyshev Gauss–Lobatto points), then .
For a function discretized on a Chebyshev Gauss–Lobatto grid on the resultant summation must be multiplied by the factor .
Trefethen L N (2000) Spectral Methods in MATLAB SIAM
- 1: N – INTEGERInput
On entry: , where the number of grid points is .
- 2: W() – REAL (KIND=nag_wp) arrayOutput
On exit: the Clenshaw–Curtis quadrature weights,
, for .
- 3: IFAIL – INTEGERInput/Output
must be set to
. If you are unfamiliar with this parameter you should refer to Section 3.3
in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
. When the value is used it is essential to test the value of IFAIL on exit.
unless the routine detects an error or a warning has been flagged (see Section 6
6 Error Indicators and Warnings
If on entry
, explanatory error messages are output on the current error message unit (as defined by X04AAF
Errors or warnings detected by the routine:
|On entry,|| or N is odd.|
Internal memory allocation failed.
The accuracy should be close to machine precision.
A real array of length is internally allocated.
This example approximates the integral using Clenshaw–Curtis weights and a -point Chebyshev Gauss–Lobatto grid on .
9.1 Program Text
Program Text (d02uyfe.f90)
9.2 Program Data
Program Data (d02uyfe.d)
9.3 Program Results
Program Results (d02uyfe.r)