NAG C Library Function Document

nag_1d_ratnl_eval (e01rbc)

1
Purpose

nag_1d_ratnl_eval (e01rbc) evaluates continued fractions of the form produced by nag_1d_ratnl_interp (e01rac).

2
Specification

#include <nag.h>
#include <nage01.h>
void  nag_1d_ratnl_eval (Integer m, const double a[], const double u[], double x, double *f, NagError *fail)

3
Description

nag_1d_ratnl_eval (e01rbc) 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_1d_ratnl_eval (e01rbc) is intended to be used to evaluate the continued fraction representation (of an interpolatory rational function) produced by nag_1d_ratnl_interp (e01rac).

4
References

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

5
Arguments

1:     m IntegerInput
On entry: m, the number of terms in the continued fraction.
Constraint: m1.
2:     a[m] const doubleInput
On entry: a[j-1] must be set to the value of the parameter aj in the continued fraction, for j=1,2,,m.
3:     u[m] const doubleInput
On entry: u[j-1] must be set to the value of the parameter uj in the continued fraction, for j=1,2,,m-1. (The element u[m-1] is not used).
4:     x doubleInput
On entry: the value of x at which the continued fraction is to be evaluated.
5:     f double *Output
On exit: the value of the continued fraction corresponding to the value of x.
6:     fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

6
Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INTERNAL_ERROR
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 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_POLE_PRESENT
x corresponds to a pole of Rx, or is very close. x=value.

7
Accuracy

See Section 7 in nag_1d_ratnl_interp (e01rac).

8
Parallelism and Performance

nag_1d_ratnl_eval (e01rbc) is not threaded in any implementation.

9
Further Comments

The time taken by nag_1d_ratnl_eval (e01rbc) is approximately proportional to m.

10
Example

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

10.1
Program Text

Program Text (e01rbce.c)

10.2
Program Data

Program Data (e01rbce.d)

10.3
Program Results

Program Results (e01rbce.r)