|
NAG[e02cbc] NAG[nag_2d_cheb_eval] - Evaluation of fitted polynomial in two variables
|
|
Calling Sequence
e02cbc(mfirst, k, l, x, xmin, xmax, y, ymin, ymax, ff, a, 'mlast'=mlast, 'fail'=fail)
nag_2d_cheb_eval(. . .)
Parameters
|
mfirst - integer;
'mlast'=mlast - integer; (optional)
|
|
|
On entry: the index of the first and last value in the array at which the evaluation is required respectively (see Section [Further Comments]).
|
|
Constraint: . .
|
|
|
k - integer;
l - integer;
|
|
|
Constraint: and . .
|
|
|
x - Vector(1..mlast, datatype=float[8]);
|
|
|
Constraint: , for all . .
|
|
|
xmin - float;
xmax - float;
|
|
|
Constraint: . .
|
|
|
y - float;
|
|
|
On entry: the value of the co-ordinate of all the points at which the evaluation is required.
|
|
Constraint: . .
|
|
|
ymin - float;
ymax - float;
|
|
|
Constraint: . .
|
|
|
ff - Vector(1..mlast, datatype=float[8]);
|
|
|
|
a - Vector(1.. , datatype=float[8]);
|
|
|
Note: the dimension, dim, of the array a must be at least .
|
|
On entry: the Chebyshev coefficients of the polynomial. The coefficient defined according to the standard convention (see Section [Description]) must be in .
|
|
|
mfirst - integer;
'mlast'=mlast - integer; (optional)
|
|
|
On entry: the index of the first and last value in the array at which the evaluation is required respectively (see Section [Further Comments]).
|
|
Constraint: . .
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_2d_cheb_eval (e02cbc) evaluates a bivariate polynomial from the rectangular array of coefficients in its double Chebyshev-series representation.
|
|
Description
|
|
This function 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 e02cac (nag_2d_cheb_fit_lines), 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 [Further Comments]). For this reason, the function 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 function 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 function, 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 function 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.
|
|
Error Indicators and Warnings
|
|
"NE_ALLOC_FAIL"
Dynamic memory allocation failed.
"NE_BAD_PARAM"
On entry, argument had an illegal value.
"NE_INT_2"
On entry, , . Constraint: and .
On entry, : , .
"NE_INTERNAL_ERROR"
Unexpected failure in internal call to e02aec (nag_1d_cheb_eval).
"NE_REAL_2"
On entry, : , .
On entry, : , .
On entry, : , .
On entry, : , .
"NE_REAL_ARRAY"
On entry, : , , .
On entry, : , , .
|
|
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.
|
|
Further Comments
|
|
The time taken is approximately proportional to , where , the number of points at which the evaluation is required.
This function is suitable for evaluating the polynomial surface fits produced by the function e02cac (nag_2d_cheb_fit_lines), which provides the array a in the required form. For this use, the values of and supplied to the present function must be the same as those supplied to e02cac (nag_2d_cheb_fit_lines). The same applies to and if they are independent of . If they vary with , their values must be consistent with those supplied to e02cac (nag_2d_cheb_fit_lines) (see Section [Further Comments] of the document for e02cac (nag_2d_cheb_fit_lines)).
The arguments 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 e02cac (nag_2d_cheb_fit_lines) to fit a set of data, you wish to evaluate the resulting polynomial at all the data values. In this case, if the arguments x, y, mfirst and mlast of the present function are set respectively (in terms of arguments of e02cac (nag_2d_cheb_fit_lines)) to x, , and , the function will compute values of the polynomial surface at all data points which have as their co-ordinate (from which values the residuals of the fit may be derived).
|
|
|
Examples
|
|
>
|
mfirst := 1:
mlast := 9:
k := 3:
l := 2:
xmin := 0.1:
xmax := 4.5:
y := 1:
ymin := 0:
ymax := 4:
x := Vector([0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5], datatype=float[8]):
ff := Vector(9, datatype=float[8]):
a := Vector([15.3482, 5.15073, 0.1014, 1.14719, 0.14419, -0.10464, 0.04901, -0.00314, -0.00699, 0.00153, -0.00033, -0.00022], datatype=float[8]):
NAG:-e02cbc(mfirst, k, l, x, xmin, xmax, y, ymin, ymax, ff, a, 'mlast' = mlast):
|
|
|
See Also
|
|
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
e02 Chapter Introduction.
NAG Toolbox Overview.
NAG Web Site.
|
|