naginterfaces.library.interp.dim1_​cheb

naginterfaces.library.interp.dim1_cheb(xmin, xmax, x, y, ip, lwrk, liwrk, itmin=0, itmax=0)[source]

dim1_cheb constructs the Chebyshev series representation of a polynomial interpolant to a set of data which may contain derivative values.

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

https://www.nag.com/numeric/nl/nagdoc_28.6/flhtml/e01/e01aef.html

Parameters
xminfloat

The lower and upper end points, respectively, of the interval . If they are not determined by your problem, it is recommended that they be set respectively to the smallest and largest values among the .

xmaxfloat

The lower and upper end points, respectively, of the interval . If they are not determined by your problem, it is recommended that they be set respectively to the smallest and largest values among the .

xfloat, array-like, shape

The value of , for . The need not be ordered.

yfloat, array-like, shape

The given values of the dependent variable, and derivatives, as follows:

The first elements contain in that order.

The next elements contain in that order.

The last elements contain in that order.

ipint, array-like, shape

, the order of the highest-order derivative whose value is given at , for . If the value of only is given for some then the corresponding value of must be zero.

lwrkint

The dimension of the array .

liwrkint

The dimension of the array .

itminint, optional

Respectively the minimum and maximum number of iterations to be performed by the function (for full details see Further Comments). Setting and/or negative or zero invokes default value(s) of and/or , respectively.

The default values will be satisfactory for most problems, but occasionally significant improvement will result from using higher values.

itmaxint, optional

Respectively the minimum and maximum number of iterations to be performed by the function (for full details see Further Comments). Setting and/or negative or zero invokes default value(s) of and/or , respectively.

The default values will be satisfactory for most problems, but occasionally significant improvement will result from using higher values.

Returns
afloat, ndarray, shape

contains the coefficient in the Chebyshev series representation of , for .

wrkfloat, ndarray, shape

Used as workspace, but see also Further Comments.

iwrkint, ndarray, shape

Used as workspace, but see also Further Comments.

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, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, , , and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

The computation has been terminated because the iterative process appears to be diverging.

Warns
NagAlgorithmicWarning
(errno )

Not all the performance indices are less than eight times the machine precision, although iterations have been performed. A more accurate solution may possibly be obtained by increasing and recalling the function.

Notes

Let distinct values of an independent variable be given, with , for . For each value , suppose that the value of the dependent variable together with the first derivatives of with respect to are given. Each must, therefore, be a non-negative integer, with the total number of interpolating conditions, , equal to .

dim1_cheb calculates the unique polynomial of degree (or less) which is such that , for , for . Here means . This polynomial is represented in Chebyshev series form in the normalized variable , as follows:

where

so that for in the interval to , and where is the Chebyshev polynomial of the first kind of degree with argument .

(The polynomial interpolant can subsequently be evaluated for any value of in the given range by using fit.dim1_cheb_eval2. Chebyshev series representations of the derivative(s) and integral(s) of may be obtained by (repeated) use of fit.dim1_cheb_deriv and fit.dim1_cheb_integ.)

The method used consists first of constructing a divided-difference table from the normalized values and the given values of and its derivatives with respect to . The Newton form of is then obtained from this table, as described in Huddleston (1974) and Krogh (1970), with the modification described in Further Comments. The Newton form of the polynomial is then converted to Chebyshev series form as described in Conversion to Chebyshev Form.

Since the errors incurred by these stages can be considerable, a form of iterative refinement is used to improve the solution. This refinement is particularly useful when derivatives of rather high order are given in the data. In reasonable examples, the refinement will usually terminate with a certain accuracy criterion satisfied by the polynomial (see Accuracy). In more difficult examples, the criterion may not be satisfied and refinement will continue until the maximum number of iterations (as specified by the input argument ) is reached.

In extreme examples, the iterative process may diverge (even though the accuracy criterion is satisfied): if a certain divergence criterion is satisfied, the process terminates at once. In all cases the function returns the ‘best’ polynomial achieved before termination. For the definition of ‘best’ and details of iterative refinement and termination criteria, see Further Comments.

References

Huddleston, R E, 1974, CDC 6600 routines for the interpolation of data and of data with derivatives, SLL-74-0214, Sandia Laboratories (Reprint)

Krogh, F T, 1970, Efficient algorithms for polynomial interpolation and numerical differentiation, Math. Comput. (24), 185–190