hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_interp_1d_ratnl_eval (e01rb)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_interp_1d_ratnl_eval (e01rb) evaluates continued fractions of the form produced by nag_interp_1d_ratnl (e01ra).

Syntax

[f, ifail] = e01rb(a, u, x, 'm', m)
[f, ifail] = nag_interp_1d_ratnl_eval(a, u, x, 'm', m)

Description

nag_interp_1d_ratnl_eval (e01rb) evaluates the continued fraction
Rx=a1+Rmx  
where
Rix=am-i+ 2x-um-i+ 1 1+Ri- 1x ,   for ​ i=m,m- 1,,2.  
and
R1x=0  
for a prescribed value of x. nag_interp_1d_ratnl_eval (e01rb) is intended to be used to evaluate the continued fraction representation (of an interpolatory rational function) produced by nag_interp_1d_ratnl (e01ra).

References

Graves–Morris P R and Hopkins T R (1981) Reliable rational interpolation Numer. Math. 36 111–128

Parameters

Compulsory Input Parameters

1:     am – double array
aj must be set to the value of the parameter aj in the continued fraction, for j=1,2,,m.
2:     um – double array
uj must be set to the value of the parameter uj in the continued fraction, for j=1,2,,m-1. (The element um is not used).
3:     x – double scalar
The value of x at which the continued fraction is to be evaluated.

Optional Input Parameters

1:     m int64int32nag_int scalar
Default: the dimension of the arrays a, u. (An error is raised if these dimensions are not equal.)
m, the number of terms in the continued fraction.
Constraint: m1.

Output Parameters

1:     f – double scalar
The value of the continued fraction corresponding to the value of x.
2:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
The value of x corresponds to a pole of Rx or is so close that an overflow is likely to ensue.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

See Accuracy in nag_interp_1d_ratnl (e01ra).

Further Comments

The time taken by nag_interp_1d_ratnl_eval (e01rb) is approximately proportional to m.

Example

This example reads in the arguments aj and uj of a continued fraction (as determined by the example for nag_interp_1d_ratnl (e01ra)) and evaluates the continued fraction at a point x.
function e01rb_example


fprintf('e01rb example results\n\n');

% Calculate rational approximation coefficients
x = [0:4];
f = [4   2   4   7   10.4];

[m, a, u, ifail] = e01ra( ...
                          x, f);

% Evaluate at single point
x = 6;
[f, ifail] = e01rb( ...
                    a, u, x, 'm', m);

fprintf('x    = %12.4e\n',x);
fprintf('R(x) = %12.4e\n',f);


e01rb example results

x    =   6.0000e+00
R(x) =   1.7714e+01

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015