X(MLAST), XMIN, XMAX, Y, YMIN, YMAX, FF(MLAST), A(NA), WORK(NWORK)
This subroutine evaluates a bivariate polynomial (represented in double Chebyshev form) of degree in one variable, , and degree in the other, . The range of both variables is to . However, these normalized variables will usually have been derived (as when the polynomial has been computed by E02CAF, for example) from your original variables and by the transformations
(Here and are the ends of the range of which has been transformed to the range to of . and are correspondingly for . See Section 8). For this reason, the subroutine has been designed to accept values of and rather than and , and so requires values of , etc. to be supplied by you. In fact, for the sake of efficiency in appropriate cases, the routine evaluates the polynomial for a sequence of values of , all associated with the same value of .
The double Chebyshev series can be written as
where is the Chebyshev polynomial of the first kind of degree and argument , and is similarly defined. However the standard convention, followed in this subroutine, is that coefficients in the above expression which have either or zero are written , instead of simply , and the coefficient with both and zero is written .
The subroutine first forms , with replaced by , for each of . The value of the double series is then obtained for each value of , by summing , with replaced by , over . The Clenshaw three term recurrence (see Clenshaw (1955)) with modifications due to Reinsch and Gentleman (1969) is used to form the sums.
Clenshaw C W (1955) A note on the summation of Chebyshev series Math. Tables Aids Comput.9 118–120
Gentleman W M (1969) An error analysis of Goertzel's (Watt's) method for computing Fourier coefficients Comput. J.12 160–165
1: MFIRST – INTEGERInput
2: MLAST – INTEGERInput
On entry: the index of the first and last value in the array at which the evaluation is required respectively (see Section 8).
3: K – INTEGERInput
4: L – INTEGERInput
On entry: the degree of and of , respectively, in the polynomial.
On entry: the Chebyshev coefficients of the polynomial. The coefficient defined according to the standard convention (see Section 3) must be in .
13: NA – INTEGERInput
On entry: the dimension of the array A as declared in the (sub)program from which E02CBF is called.
, the number of coefficients in a polynomial of the specified degree.
14: WORK(NWORK) – REAL (KIND=nag_wp) arrayWorkspace
15: NWORK – INTEGERInput
On entry: the dimension of the array WORK as declared in the (sub)program from which E02CBF is called.
16: IFAIL – INTEGERInput/Output
On entry: IFAIL 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.
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 or , explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
, or , for some .
The method is numerically stable in the sense that the computed values of the polynomial are exact for a set of coefficients which differ from those supplied by only a modest multiple of machine precision.
8 Further Comments
The time taken is approximately proportional to , where , the number of points at which the evaluation is required.
This subroutine is suitable for evaluating the polynomial surface fits produced by the subroutine E02CAF, which provides the
array A in the required form. For this use, the values of and supplied to the present subroutine must be the same as those supplied to E02CAF. The same applies to and if they are independent of . If they vary with , their values must be consistent with those supplied to E02CAF (see Section 8 in E02CAF).
The parameters MFIRST and MLAST are intended to permit the selection of a segment of the array X which is to be associated with a particular value of , when, for example, other segments of X are associated with other values of . Such a case arises when, after using E02CAF to fit a set of data, you wish to evaluate the resulting polynomial at all the data values. In this case, if the parameters X, Y, MFIRST and MLAST of the present routine are set respectively (in terms of parameters of E02CAF) to X, , and , the routine will compute values of the polynomial surface at all data points which have as their coordinate (from which values the residuals of the fit may be derived).
This example reads data in the following order, using the notation of the parameter list above:
For each line the polynomial is evaluated at equispaced points between and inclusive.