PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_fit_pade_app (e02ra)
Purpose
nag_fit_pade_app (e02ra) calculates the coefficients in a Padé approximant to a function from its user-supplied Maclaurin expansion.
Syntax
Description
Given a power series
nag_fit_pade_app (e02ra) uses the coefficients
, for
, to form the
Padé approximant of the form
with
defined to be unity. The two sets of coefficients
, for
, and
, for
, 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
may be carried out using
nag_fit_pade_eval (e02rb).
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
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int scalar
- 2:
– int64int32nag_int scalar
-
ia must specify
and
ib must specify
, where
and
are the degrees of the numerator and denominator of the approximant, respectively.
Constraint:
and .
- 3:
– double array
-
ic, the dimension of the array, must satisfy the constraint
.
must specify, for , the coefficient of in the given power series.
Optional Input Parameters
None.
Output Parameters
- 1:
– double array
-
, for , contains the coefficient in the numerator of the approximant.
- 2:
– double array
-
, for , contains the coefficient in the denominator of the approximant.
- 3:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
On entry, | , |
or | , |
or | , |
or | |
(so there are insufficient coefficients in the given power series to calculate the desired approximant).
-
-
The Padé approximant is degenerate.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
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
characterise ill-conditioning in the construction of the approximant.) Defects occur in regions where the approximation is necessarily inaccurate. The example program calls
nag_zeros_poly_real (c02ag) 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.,
or
). 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).
Further Comments
The time taken is approximately proportional to .
Example
This example calculates the
Padé approximant of
(whose power-series coefficients are first stored in the array
c). The poles and zeros are then calculated to check the character of the
Padé approximant.
Open in the MATLAB editor:
e02ra_example
function e02ra_example
fprintf('e02ra example results\n\n');
ia = int64(5);
ib = int64(5);
ic = ia + ib - 1;
c = ones(ic,1);
for j = 3:ic
c(j) = c(j-1)/double(j-1);
end
[a, b, ifail] = e02ra(ia, ib, c);
fprintf('The given series coefficients are\n');
fmt = '%13.4e%13.4e%13.4e%13.4e%13.4e\n';
fprintf(fmt,c);
fprintf('\n\nNumerator coefficients\n');
fprintf(fmt,a);
fprintf('\nDenominator coefficients\n');
fprintf(fmt,b);
dd(ia:-1:1) = a(1:ia);
[z, ifail] = c02ag(dd,ia-1);
fprintf('\nZeros of approximant are at\n\n');
cz = z(1,:) + i*z(2,:);
disp(cz');
dd(ib:-1:1) = b(1:ib);
[z, ifail] = c02ag(dd,ib-1);
fprintf('\nPoles of approximant are at\n\n');
cz = z(1,:) + i*z(2,:);
disp(cz');
e02ra example results
The given series coefficients are
1.0000e+00 1.0000e+00 5.0000e-01 1.6667e-01 4.1667e-02
8.3333e-03 1.3889e-03 1.9841e-04 2.4802e-05
Numerator coefficients
1.0000e+00 5.0000e-01 1.0714e-01 1.1905e-02 5.9524e-04
Denominator coefficients
1.0000e+00 -5.0000e-01 1.0714e-01 -1.1905e-02 5.9524e-04
Zeros of approximant are at
-5.7924 - 1.7345i
-5.7924 + 1.7345i
-4.2076 - 5.3148i
-4.2076 + 5.3148i
Poles of approximant are at
5.7924 - 1.7345i
5.7924 + 1.7345i
4.2076 - 5.3148i
4.2076 + 5.3148i
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015