E01 Chapter Contents
E01 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentE01RBF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

E01RBF evaluates continued fractions of the form produced by E01RAF.

## 2  Specification

 SUBROUTINE E01RBF ( M, A, U, X, F, IFAIL)
 INTEGER M, IFAIL REAL (KIND=nag_wp) A(M), U(M), X, F

## 3  Description

E01RBF 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$. E01RBF is intended to be used to evaluate the continued fraction representation (of an interpolatory rational function) produced by E01RAF.

## 4  References

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

## 5  Parameters

1:     M – INTEGERInput
On entry: $m$, the number of terms in the continued fraction.
Constraint: ${\mathbf{M}}\ge 1$.
2:     A(M) – REAL (KIND=nag_wp) arrayInput
On entry: ${\mathbf{A}}\left(\mathit{j}\right)$ must be set to the value of the parameter ${a}_{\mathit{j}}$ in the continued fraction, for $\mathit{j}=1,2,\dots ,m$.
3:     U(M) – REAL (KIND=nag_wp) arrayInput
On entry: ${\mathbf{U}}\left(\mathit{j}\right)$ must be set to the value of the parameter ${u}_{\mathit{j}}$ in the continued fraction, for $\mathit{j}=1,2,\dots ,m-1$. (The element ${\mathbf{U}}\left(m\right)$ is not used).
4:     X – REAL (KIND=nag_wp)Input
On entry: the value of $x$ at which the continued fraction is to be evaluated.
5:     F – REAL (KIND=nag_wp)Output
On exit: the value of the continued fraction corresponding to the value of $x$.
6:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=1$
The value of X corresponds to a pole of $R\left(x\right)$ or is so close that an overflow is likely to ensue.

## 7  Accuracy

See Section 7 in E01RAF.

The time taken by E01RBF is approximately proportional to $m$.

## 9  Example

This example reads in the parameters ${a}_{j}$ and ${u}_{j}$ of a continued fraction (as determined by the example for E01RAF) and evaluates the continued fraction at a point $x$.

### 9.1  Program Text

Program Text (e01rbfe.f90)

### 9.2  Program Data

Program Data (e01rbfe.d)

### 9.3  Program Results

Program Results (e01rbfe.r)