The function may be called by the names: e01rac, nag_interp_dim1_ratnl or nag_1d_ratnl_interp.
e01rac produces the parameters of a rational function which assumes prescribed values at prescribed values of the independent variable , for . More specifically, e01rac determines the parameters , for and , for , in the continued fraction
such that , for . The value of in (1) is determined by the function; normally . The values of form a reordered subset of the values of and their ordering is designed to ensure that a representation of the form (1) is determined whenever one exists.
The subsequent evaluation of (1) for given values of can be carried out using e01rbc.
Graves–Morris P R and Hopkins T R (1981) Reliable rational interpolation Numer. Math.36 111–128
1: – IntegerInput
On entry: , the number of data points.
2: – const doubleInput
On entry: must be set to the value of the th data abscissa, , for .
the must be distinct.
3: – const doubleInput
On entry: must be set to the value of the data ordinate, , corresponding to , for .
4: – Integer *Output
On exit: , the number of terms in the continued fraction representation of .
5: – doubleOutput
On exit: contains the value of the parameter in , for . The remaining elements of a, if any, are set to zero.
6: – doubleOutput
On exit: contains the value of the parameter in , for . The are a permuted subset of the elements of x. The remaining locations contain a permutation of the remaining , which can be ignored.
7: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument had an illegal value.
A continued fraction of the required form does not exist.
On entry, .
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
On entry, is very close to : , , and .
Usually, it is not the accuracy of the coefficients produced by this function which is of prime interest, but rather the accuracy of the value of that is produced by the associated function e01rbc when subsequently it evaluates the continued fraction (1) for a given value of . This final accuracy will depend mainly on the nature of the interpolation being performed. If interpolation of a ‘well-behaved smooth’ function is attempted (and provided the data adequately represents the function), high accuracy will normally ensue, but, if the function is not so ‘smooth’ or extrapolation is being attempted, high accuracy is much less likely. Indeed, in extreme cases, results can be highly inaccurate.
There is no built-in test of accuracy but several courses are open to you to prevent the production or the acceptance of inaccurate results.
1.If the origin of a variable is well outside the range of its data values, the origin should be shifted to correct this; and, if the new data values are still excessively large or small, scaling to make the largest value of the order of unity is recommended. Thus, normalization to the range to is ideal. This applies particularly to the independent variable; for the dependent variable, the removal of leading figures which are common to all the data values will usually suffice.
2.To check the effect of rounding errors engendered in the functions themselves, e01rac should be re-entered with interchanged with and with , . This will produce a completely different vector and a reordered vector , but any change in the value of subsequently produced by e01rbc will be due solely to rounding error.
3.Even if the data consist of calculated values of a formal mathematical function, it is only in exceptional circumstances that bounds for the interpolation error (the difference between the true value of the function underlying the data and the value which would be produced by the two functions if exact arithmetic were used) can be derived that are sufficiently precise to be of practical use. Consequently, you are recommended to rely on comparison checks: if extra data points are available, the calculation may be repeated with one or more data pairs added or exchanged, or alternatively, one of the original data pairs may be omitted. If the algorithms are being used for extrapolation, the calculations should be performed repeatedly with the nearest points until, hopefully, successive values of for the given agree to the required accuracy.
8Parallelism and Performance
e01rac is not threaded in any implementation.
The time taken by e01rac is approximately proportional to .
The continued fraction (1) when expanded produces a rational function in , the degree of whose numerator is either equal to or exceeds by unity that of the denominator. Only if this rather special form of interpolatory rational function is needed explicitly, would this function be used without subsequent entry (or entries) to e01rbc.
This example reads in the abscissae and ordinates of data points and prints the arguments and of a rational function which interpolates them.