3 Description

This subroutine evaluates a bivariate polynomial (represented in double Chebyshev form) of degree k in one variable, x-, and degree l in the other, y-. The range of both variables is -1 to +1. However, these normalized variables will usually have been derived (as when the polynomial has been computed by E02CAF, for example) from your original variables x and y by the transformations

x-=2x-xmax+xminxmax-xmin and y-=2y-ymax+yminymax-ymin.

(Here xmin and xmax are the ends of the range of x which has been transformed to the range -1 to +1 of x-. ymin and ymax are correspondingly for y. See Section 8). For this reason, the subroutine has been designed to accept values of x and y rather than x- and y-, and so requires values of xmin, 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 x, all associated with the same value of y.

The double Chebyshev series can be written as

∑i=0k∑j=0laijTix-Tjy-,

where Tix- is the Chebyshev polynomial of the first kind of degree i and argument x-, and Tjy- is similarly defined. However the standard convention, followed in this subroutine, is that coefficients in the above expression which have either i or j zero are written 12aij, instead of simply aij, and the coefficient with both i and j zero is written 14a0,0.

The subroutine first forms ci=∑j=0laijTjy-, with ai,0 replaced by 12ai,0, for each of i=0,1,…,k. The value of the double series is then obtained for each value of x, by summing ci×Tix-, with c0 replaced by 12c0, over i=0,1,…,k. The Clenshaw three term recurrence (see Clenshaw (1955)) with modifications due to Reinsch and Gentleman (1969) is used to form the sums.

On entry: the dimension of the array WORK as declared in the (sub)program from which E02CBF is called.

Constraint:
NWORK≥K+1.

16: IFAIL – INTEGERInput/Output

On entry: IFAIL must be set to 0, -1​ or ​1. 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 -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.

On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).

Errors or warnings detected by the routine:

IFAIL=1

On entry,

MFIRST>MLAST,

or

K<0,

or

L<0,

or

NA<K+1×L+1,

or

NWORK<K+1.

IFAIL=2

On entry,

YMIN≥YMAX,

or

Y<YMIN,

or

Y>YMAX.

IFAIL=3

On entry,

XMIN≥XMAX,

or

Xi<XMIN, or Xi>XMAX, for some i=MFIRST,MFIRST+1,…,MLAST.

7 Accuracy

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 k+1×m+l+1, where m=MLAST-MFIRST+1, 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
real
array A in the required form. For this use, the values of ymin and ymax supplied to the present subroutine must be the same as those supplied to E02CAF. The same applies to xmin and xmax if they are independent of y. If they vary with y, 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 y, when, for example, other segments of X are associated with other values of y. 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, YS, 1+∑i=1s-1Mi and ∑i=1sMi, the routine will compute values of the polynomial surface at all data points which have YS as their y coordinate (from which values the residuals of the fit may be derived).

9 Example

This example reads data in the following order, using the notation of the parameter list above: