NAG Library Routine Document

e02raf  (pade_app)

 Contents

    1  Purpose
    7  Accuracy

1
Purpose

e02raf calculates the coefficients in a Padé approximant to a function from its user-supplied Maclaurin expansion.

2
Specification

Fortran Interface
Subroutine e02raf ( ia, ib, c, ic, a, b, w, jw, ifail)
Integer, Intent (In):: ia, ib, ic, jw
Integer, Intent (Inout):: ifail
Real (Kind=nag_wp), Intent (In):: c(ic)
Real (Kind=nag_wp), Intent (Out):: a(ia), b(ib), w(jw)
C Header Interface
#include nagmk26.h
void  e02raf_ ( const Integer *ia, const Integer *ib, const double c[], const Integer *ic, double a[], double b[], double w[], const Integer *jw, Integer *ifail)

3
Description

Given a power series
c0+c1x+c2x2++cl+mxl+m+  
e02raf uses the coefficients ci, for i=0,1,,l+m, to form the l/m Padé approximant of the form
a0+a1x+a2x2++alxl b0+b1x+b2x2++bmxm  
with b0 defined to be unity. The two sets of coefficients aj, for j=0,1,,l, and bk, for k=0,1,,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
m/m,m=0,1,2,.  
Subsequent evaluation of the approximant at a given value of x may be carried out using e02rbf.

4
References

Baker G A Jr and Graves–Morris P R (1981) Padé approximants, Part 1: Basic theory encyclopaedia of Mathematics and its Applications Addison–Wesley
Graves–Morris P R (1979) The numerical calculation of Padé approximants Padé Approximation and its Applications. Lecture Notes in Mathematics (ed L Wuytack) 765 231–245 Adison–Wesley

5
Arguments

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: ia1 and ib1.
3:     cic – Real (Kind=nag_wp) arrayInput
On entry: ci must specify, for i=1,2,,l+m+1, the coefficient of xi-1 in the given power series.
4:     ic – IntegerInput
On entry: the dimension of the array c as declared in the (sub)program from which e02raf is called.
Constraint: icia+ib-1.
5:     aia – Real (Kind=nag_wp) arrayOutput
On exit: aj+1, for j=1,2,,l+1, contains the coefficient aj in the numerator of the approximant.
6:     bib – Real (Kind=nag_wp) arrayOutput
On exit: bk+1, for k=1,2,,m+1, contains the coefficient bk in the denominator of the approximant.
7:     wjw – Real (Kind=nag_wp) arrayWorkspace
8:     jw – IntegerInput
On entry: the dimension of the array w as declared in the (sub)program from which e02raf is called.
Constraint: jwib×2×ib+3.
9:     ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1​ or ​1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ 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 argument, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6
Error Indicators and Warnings

If on entry 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:
ifail=1
On entry,jw<ib×2×ib+3,
oria<1,
orib<1,
oric<ia+ib-1
(so there are insufficient coefficients in the given power series to calculate the desired approximant).
ifail=2
The Padé approximant is degenerate.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

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 pole-zero pairs; defects close to x=0.0 characterise ill-conditioning in the construction of the approximant.) Defects occur in regions where the approximation is necessarily inaccurate. The example program calls c02agf 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., cl or cl+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).

8
Parallelism and Performance

e02raf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
e02raf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9
Further Comments

The time taken is approximately proportional to m3.

10
Example

This example calculates the 4/4 Padé approximant of ex (whose power-series coefficients are first stored in the array c). The poles and zeros are then calculated to check the character of the 4/4 Padé approximant.

10.1
Program Text

Program Text (e02rafe.f90)

10.2
Program Data

None.

10.3
Program Results

Program Results (e02rafe.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017