nag_1d_pade (e02rac) calculates the coefficients in a Padé approximant to a function from its usersupplied Maclaurin expansion.
Given a power series
nag_1d_pade (e02rac) uses the coefficients
${c}_{i}$, for
$\mathit{i}=0,1,\dots ,l+m$, to form the
$\left[l/m\right]$ Padé approximant of the form
with
${b}_{0}$ defined to be unity. The two sets of coefficients
${a}_{j}$, for
$\mathit{j}=0,1,\dots ,l$, and
${b}_{k}$, for
$\mathit{k}=0,1,\dots ,m$, in the numerator and denominator are calculated by direct solution of the Padé equations (see
Graves–Morris (1979)); these values are returned through the argument list unless the approximant is degenerate.
Padé approximation is a useful technique when values of a function are to be obtained from its Maclaurin expansion but convergence of the series is unacceptably slow or even nonexistent. It is based on the hypothesis of the existence of a sequence of convergent rational approximations, as described in
Baker and Graves–Morris (1981) and
Graves–Morris (1979).
Unless there are reasons to the contrary (as discussed in Chapter 4, Section 2, Chapters 5 and 6 of
Baker and Graves–Morris (1981)), one normally uses the diagonal sequence of Padé approximants, namely
Subsequent evaluation of the approximant at a given value of
$x$ may be carried out using
nag_1d_pade_eval (e02rbc).
Baker G A Jr and Graves–Morris P R (1981) Padé approximants, Part 1: Basic theory encyclopaedia of Mathematics and its Applications Addison–Wesley
 1:
ia – IntegerInput
 2:
ib – IntegerInput
On entry:
ia must specify
$l+1$ and
ib must specify
$m+1$, where
$l$ and
$m$ are the degrees of the numerator and denominator of the approximant, respectively.
Constraint:
${\mathbf{ia}}\ge 1$ and ${\mathbf{ib}}\ge 1$.
 3:
c[$\left({\mathbf{ia}}+{\mathbf{ib}}1\right)$] – const doubleInput
On entry: ${\mathbf{c}}\left[\mathit{i}1\right]$ must specify, for $\mathit{i}=1,2,\dots ,l+m+1$, the coefficient of ${x}^{\mathit{i}1}$ in the given power series.
 4:
a[ia] – doubleOutput
On exit: ${\mathbf{a}}\left[\mathit{j}\right]$, for $\mathit{j}=1,2,\dots ,l+1$, contains the coefficient ${a}_{\mathit{j}}$ in the numerator of the approximant.
 5:
b[ib] – doubleOutput
On exit: ${\mathbf{b}}\left[\mathit{k}\right]$, for $\mathit{k}=1,2,\dots ,m+1$, contains the coefficient ${b}_{\mathit{k}}$ in the denominator of the approximant.
 6:
fail – NagError *Input/Output

The NAG error argument (see
Section 3.6 in the Essential Introduction).
The solution should be the best possible to the extent to which the solution is determined by the input coefficients. It is recommended that you determine the locations of the zeros of the numerator and denominator polynomials, both to examine compatibility with the analytic structure of the given function and to detect defects. (Defects are nearby polezero pairs; defects close to
$x=0.0$ characterise illconditioning in the construction of the approximant.) Defects occur in regions where the approximation is necessarily inaccurate. The example program calls
nag_zeros_real_poly (c02agc) to determine the above zeros.
It is easy to test the stability of the computed numerator and denominator coefficients by making small perturbations of the original Maclaurin series coefficients (e.g.,
${c}_{l}$ or
${c}_{l+m}$). These questions of intrinsic error of the approximants and computational error in their calculation are discussed in Chapter 2 of
Baker and Graves–Morris (1981).
This example calculates the
$\left[4/4\right]$ Padé approximant of
${e}^{x}$ (whose powerseries coefficients are first stored in the array
c). The poles and zeros are then calculated to check the character of the
$\left[4/4\right]$ Padé approximant.
None.