naginterfaces.library.fit.dim2_​cheb_​lines

naginterfaces.library.fit.dim2_cheb_lines(m, k, l, x, y, f, w, na, xmin, xmax, nux, nuy)[source]

dim2_cheb_lines forms an approximation to the weighted, least squares Chebyshev series surface fit to data arbitrarily distributed on lines parallel to one independent coordinate axis.

For full information please refer to the NAG Library document for e02ca

https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/e02/e02caf.html

Parameters
mint, array-like, shape

must be set to , the number of data values on the line , for .

kint

, the required degree of in the fit.

lint

, the required degree of in the fit.

xfloat, array-like, shape

The values of the data points. The sequence must be

all points on , followed by

all points on , followed by

all points on .

yfloat, array-like, shape

must contain the value of line , for , on which data is given.

ffloat, array-like, shape

, the data values of the dependent variable in the same sequence as the values.

wfloat, array-like, shape

The weights to be assigned to the data points, in the same sequence as the values. These weights should be calculated from estimates of the absolute accuracies of the , expressed as standard deviations, probable errors or some other measure which is of the same dimensions as . Specifically, each should be inversely proportional to the accuracy estimate of . Often weights all equal to unity will be satisfactory. If a particular weight is zero, the corresponding data point is omitted from the fit.

naint

The dimension of the array .

xminfloat, array-like, shape

must contain , the lower end of the range of on the line , for . It must not be greater than the lowest data value of on the line. Each is scaled to in the fit. (See also Further Comments.)

xmaxfloat, array-like, shape

must contain , the upper end of the range of on the line , for . It must not be less than the highest data value of on the line. Each is scaled to in the fit. (See also Further Comments.)

nuxfloat, array-like, shape

must contain the coefficient of the Chebyshev polynomial of degree in , in the Chebyshev series representation of the polynomial factor in which you require the fit to contain, for . These coefficients are defined according to the standard convention of Notes.

nuyfloat, array-like, shape

must contain the coefficient of the Chebyshev polynomial of degree in , in the Chebyshev series representation of the polynomial factor which you require the fit to contain, for . These coefficients are defined according to the standard convention of Notes.

Returns
afloat, ndarray, shape

Contains the Chebyshev coefficients of the fit. is the coefficient of Notes defined according to the standard convention. These coefficients are used by dim2_cheb_eval() to calculate values of the fitted function.

Raises
NagValueError
(errno )

On entry, is too small. . Minimum possible dimension: .

(errno )

On entry, is too small. . Minimum possible dimension: .

(errno )

On entry, , , and .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and do not span the data values on : , , and .

(errno )

On entry, the data values are not nondecreasing for : and .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, the number of distinct values with nonzero weight on is less than : , , and .

(errno )

On entry, , , and .

Constraint: if , ; if , .

Notes

dim2_cheb_lines determines a bivariate polynomial approximation of degree in and in to the set of data points , with weights , for , for . That is, the data points are on lines , but the values may be different on each line. The values of and are prescribed by you (for guidance on their choice, see Further Comments). The function is based on the method described in Sections 5 and 6 of Clenshaw and Hayes (1965).

The polynomial is represented in double Chebyshev series form with arguments and . The arguments lie in the range to and are related to the original variables and by the transformations

Here and are set by the function to, respectively, the largest and smallest value of , but and are functions of prescribed by you (see Further Comments). For this function, only their values and at each are required. For each , must not be less than the largest on the line , and, similarly, must not be greater than the smallest .

The double Chebyshev series can be written as

where is the Chebyshev polynomial of the first kind of degree with 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 as , instead of simply , and the coefficient with both and equal to zero is written as . The series with coefficients output by the function should be summed using this convention. dim2_cheb_eval() is available to compute values of the fitted function from these coefficients.

The function first obtains Chebyshev series coefficients , for , of the weighted least squares polynomial curve fit of degree in to the data on each line , for , in turn, using an auxiliary function. The same function is then called times to fit , for , by a polynomial of degree in , for each . The resulting coefficients are the required .

You can force the fit to contain a given polynomial factor. This allows for the surface fit to be constrained to have specified values and derivatives along the boundaries , , and or indeed along any lines constant or constant (see Section 8 of Clenshaw and Hayes (1965)).

References

Clenshaw, C W and Hayes, J G, 1965, Curve and surface fitting, J. Inst. Math. Appl. (1), 164–183

Hayes, J G (ed.), 1970, Numerical Approximation to Functions and Data, Athlone Press, London