# NAG FL Interfacee01rbf (dim1_​ratnl_​eval)

## 1Purpose

e01rbf evaluates continued fractions of the form produced by e01raf.

## 2Specification

Fortran Interface
 Subroutine e01rbf ( m, a, u, x, f,
 Integer, Intent (In) :: m Integer, Intent (Inout) :: ifail Real (Kind=nag_wp), Intent (In) :: a(m), u(m), x Real (Kind=nag_wp), Intent (Out) :: f
#include <nag.h>
 void e01rbf_ (const Integer *m, const double a[], const double u[], const double *x, double *f, Integer *ifail)
The routine may be called by the names e01rbf or nagf_interp_dim1_ratnl_eval.

## 3Description

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.

## 4References

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

## 5Arguments

1: $\mathbf{m}$Integer Input
On entry: $m$, the number of terms in the continued fraction.
Constraint: ${\mathbf{m}}\ge 1$.
2: $\mathbf{a}\left({\mathbf{m}}\right)$Real (Kind=nag_wp) array Input
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: $\mathbf{u}\left({\mathbf{m}}\right)$Real (Kind=nag_wp) array Input
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: $\mathbf{x}$Real (Kind=nag_wp) Input
On entry: the value of $x$ at which the continued fraction is to be evaluated.
5: $\mathbf{f}$Real (Kind=nag_wp) Output
On exit: the value of the continued fraction corresponding to the value of $x$.
6: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, . If you are unfamiliar with this argument you should refer to Section 4 in the Introduction to the NAG Library FL Interface for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this argument, the recommended value is $0$. When the value 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).

## 6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-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$
x corresponds to a pole of $R\left(x\right)$, or is very close. ${\mathbf{x}}=〈\mathit{\text{value}}〉$.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

## 7Accuracy

See Section 7 in e01raf.

## 8Parallelism and Performance

e01rbf is not threaded in any implementation.

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

## 10Example

This example reads in the arguments ${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$.

### 10.1Program Text

Program Text (e01rbfe.f90)

### 10.2Program Data

Program Data (e01rbfe.d)

### 10.3Program Results

Program Results (e01rbfe.r)