This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Add-ons / Standard Packages / Calculus  /


A rational function is the ratio of polynomials. Because these functions only use the elementary arithmetic operations, they are very easy to evaluate numerically. The polynomial in the denominator allows one to approximate functions that have rational singularities. For these reasons it is frequently useful in numerical work to approximate a given function by a rational function.
There are various methods to perform this approximation. The methods differ in how they interpret the notion of the "goodness" of the approximation. Each method is useful for certain classes of problems. This package computes Padé approximations and economized rational approximations. The package NumericalMath`Approximations` contains functions that perform general rational and minimax approximations.
There is a related class of approximation questions that involve the interpolation or fitting of a set of data points by an approximating function. In this type of situation you can use the built-in functions Fit, InterpolatingPolynomial, and Interpolation. For more information, see the section covering numerical operations on data in The Mathematica Book.

Padé approximations.

The Padé approximation can be thought of as a generalization of a Taylor polynomial. More precisely, a Padé approximation of degree to a function at a point is the rational function where is a polynomial of degree , is a polynomial of degree , and the formal power series of about the point begins with the term


  • This loads the package.
  • In[1]:= << Calculus`Pade`;

  • Here is the Padé approximation of degree to at

  • In[2]:= Pade[Cos[x], {x, 0, 2, 4}]


  • This gives another Padé approximation of the same degree.
  • In[3]:= pd = Pade[Exp[x], {x, 1, 2, 4}]


  • The initial terms of this series vanish. This is the property that characterizes the Padé approximation.
  • In[4]:= Series[Exp[x] Denominator[pd] -
    Numerator[pd], {x, 1, 8}]


  • This plots the difference between the approximation and the "true" function. Notice that the approximation is very good near the center of expansion, but the error increases very rapidly as you move away.
  • In[5]:= Plot[pd - Exp[x], {x, 0, 2}]

    Economized rational approximations.

    A Padé approximation is very accurate near the center of expansion, but the error increases rapidly as you get farther away. If one is willing to sacrifice some of the "goodness of fit" near the center of expansion it is possible to obtain a better fit over the entire interval under consideration. This is what the other types of approximation do.
    With an economized rational approximation, the idea is to start with a Padé approximation and perturb it with a Chebyshev polynomial in such a way as to reduce the leading coefficient in the error. This perturbation does cause the terms that had vanished to reappear. However, the magnitude of the error does not increase very much near the center of expansion and this small increase is compensated for by a decrease in the error farther away. With EconomizedRationalApproximation you specify the interval over which the approximation is to work rather than the center of expansion. In the limit as the length of the interval goes to zero, the economized rational approximation approaches the Padé approximation.

  • Here is the economized rational approximation of degree of over the interval

  • In[6]:= era =
    {x, {0, 2}, 2, 4}]


  • This gives the difference between the true function and the economized rational approximation. In general you may even get a small nonvanishing constant term.
  • In[7]:= Series[era - Exp[x], {x, 1, 2}]


  • The error has been spread out when compared to the Padé approximation plotted above.
  • In[8]:= Plot[era - Exp[x], {x, 0, 2}]

  • Even though the error at the endpoint is not particularly small, it is considerably smaller than what Pade

  • In[9]:= N[(pd - Exp[x])/(era - Exp[x]) /. x -> 2]