The routine may be called by the names e02ajf or nagf_fit_dim1_cheb_integ.
e02ajf forms the polynomial which is the indefinite integral of a given polynomial. Both the original polynomial and its integral are represented in Chebyshev series form. If supplied with the coefficients , for , of a polynomial of degree , where
the routine returns the coefficients , for , of the polynomial of degree , where
Here denotes the Chebyshev polynomial of the first kind of degree with argument . It is assumed that the normalized variable in the interval was obtained from your original variable in the interval by the linear transformation
and that you require the integral to be with respect to the variable . If the integral with respect to is required, set and .
Values of the integral can subsequently be computed, from the coefficients obtained, by using e02akf.
The method employed is that of Chebyshev series (see Chapter 8 of Modern Computing Methods (1961)), modified for integrating with respect to . Initially taking , the routine forms successively
The constant coefficient is chosen so that is equal to a specified value, qatm1, at the lower end point of the interval on which it is defined, i.e., , which corresponds to .
Modern Computing Methods (1961) Chebyshev-series NPL Notes on Applied Science16 (2nd Edition) HMSO
1: – IntegerInput
On entry: , where is the degree of the given polynomial . Thus np1 is the number of coefficients in this polynomial.
2: – Real (Kind=nag_wp)Input
3: – Real (Kind=nag_wp)Input
On entry: the lower and upper end points respectively of the interval . The Chebyshev series representation is in terms of the normalized variable , where
4: – Real (Kind=nag_wp) arrayInput
On entry: the Chebyshev coefficients of the polynomial . Specifically, element
of a must contain the coefficient , for . Only these elements will be accessed.
On entry: the index increment of a. Most frequently the Chebyshev coefficients are stored in adjacent elements of a, and ia1 must be set to . However, if for example, they are stored in , the value of ia1 must be . See also Section 9.
6: – IntegerInput
On entry: the dimension of the array a as declared in the (sub)program from which e02ajf is called.
7: – Real (Kind=nag_wp)Input
On entry: the value that the integrated polynomial is required to have at the lower end point of its interval of definition, i.e., at which corresponds to . Thus, qatm1 is a constant of integration and will normally be set to zero by you.
8: – Real (Kind=nag_wp) arrayOutput
On exit: the Chebyshev coefficients of the integral . (The integration is with respect to the variable , and the constant coefficient is chosen so that equals qatm1). Specifically, element of aintc contains the coefficient
, for . A call of the routine may have the array name aintc the same as a, provided that note is taken of the order in which elements are overwritten when choosing starting elements and increments ia1 and iaint1: i.e., the coefficients, must be intact after coefficient is stored. In particular it is possible to overwrite the entirely by having , and the actual array for a and aintc identical.
9: – IntegerInput
On entry: the index increment of aintc. Most frequently the Chebyshev coefficients are required in adjacent elements of aintc, and iaint1 must be set to . However, if, for example, they are to be stored in , the value of iaint1 must be . See also Section 9.
10: – IntegerInput
On entry: the dimension of the array aintc as declared in the (sub)program from which e02ajf is called.
11: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, .
On entry, .
On entry, , and . Constraint: .
On entry, , and . Constraint: .
On entry, . Constraint: .
On entry, and .
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
In general there is a gain in precision in numerical integration, in this case associated with the division by in the formula quoted in Section 3.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
e02ajf is not threaded in any implementation.
The time taken is approximately proportional to .
The increments ia1, iaint1 are included as arguments to give a degree of flexibility which, for example, allows a polynomial in two variables to be integrated with respect to either variable without rearranging the coefficients.
Suppose a polynomial has been computed in Chebyshev series form to fit data over the interval . The following program evaluates the integral of the polynomial from to . (For the purpose of this example, xmin, xmax and the Chebyshev coefficients are simply supplied
in DATA statements.
Normally a program would read in or generate data and compute the fitted polynomial).