e02 Chapter Contents
e02 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_1d_pade_eval (e02rbc)

## 1  Purpose

nag_1d_pade_eval (e02rbc) evaluates a rational function at a user-supplied point, given the numerator and denominator coefficients.

## 2  Specification

 #include #include
 void nag_1d_pade_eval (const double a[], Integer ia, const double b[], Integer ib, double x, double *ans, NagError *fail)

## 3  Description

Given a real value $x$ and the coefficients ${a}_{j}$, for $\mathit{j}=0,1,\dots ,l$ and ${b}_{k}$, for $\mathit{k}=0,1,\dots ,m$, nag_1d_pade_eval (e02rbc) evaluates the rational function
 $∑j=0lajxj ∑k=0mbkxk .$
using nested multiplication (see Conte and de Boor (1965)).
A particular use of nag_1d_pade_eval (e02rbc) is to compute values of the Padé approximants determined by nag_1d_pade (e02rac).

## 4  References

Conte S D and de Boor C (1965) Elementary Numerical Analysis McGraw–Hill
Peters G and Wilkinson J H (1971) Practical problems arising in the solution of polynomial equations J. Inst. Maths. Applics. 8 16–35

## 5  Arguments

1:     a[ia]const doubleInput
On entry: ${\mathbf{a}}\left[\mathit{j}\right]$, for $\mathit{j}=1,2,\dots ,l+1$, must contain the value of the coefficient ${a}_{\mathit{j}}$ in the numerator of the rational function.
2:     iaIntegerInput
On entry: the value of $l+1$, where $l$ is the degree of the numerator.
Constraint: ${\mathbf{ia}}\ge 1$.
3:     b[ib]const doubleInput
On entry: ${\mathbf{b}}\left[\mathit{k}\right]$, for $\mathit{k}=1,2,\dots ,m+1$, must contain the value of the coefficient ${b}_{k}$ in the denominator of the rational function.
Constraint: if ${\mathbf{ib}}=1$, ${\mathbf{b}}\left[0\right]\ne 0.0$.
4:     ibIntegerInput
On entry: the value of $m+1$, where $m$ is the degree of the denominator.
Constraint: ${\mathbf{ib}}\ge 1$.
5:     xdoubleInput
On entry: the point $x$ at which the rational function is to be evaluated.
6:     ansdouble *Output
On exit: the result of evaluating the rational function at the given point $x$.
7:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{ia}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ia}}\ge 1$.
On entry, ${\mathbf{ib}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ib}}\ge 1$.
NE_INT_ARRAY
The first ib entries in b are zero: ${\mathbf{ib}}=〈\mathit{\text{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.
NE_POLE_PRESENT
Evaluation at or near a pole.

## 7  Accuracy

A running error analysis for polynomial evaluation by nested multiplication using the recurrence suggested by Kahan (see Peters and Wilkinson (1971)) is used to detect whether you are attempting to evaluate the approximant at or near a pole.

## 8  Further Comments

The time taken is approximately proportional to $l+m$.

## 9  Example

This example first calls nag_1d_pade (e02rac) to calculate the $4/4$ Padé approximant to ${e}^{x}$, and then uses nag_1d_pade_eval (e02rbc) to evaluate the approximant at $x=0.1,0.2,\dots ,1.0$.

### 9.1  Program Text

Program Text (e02rbce.c)

None.

### 9.3  Program Results

Program Results (e02rbce.r)