How to compute the pade approximation?

Solution 1:

The Pade approximation of order $(m,n)$ to a function $f$ is a local rational approximation of the form

$$f(x) \approx \frac{P_m(x)}{Q_n(x)}= \frac{\sum_{j=0}^{m}p_jx^j}{\sum_{j=0}^{n}q_jx^j}.$$

Expand $f(x)$ in a Maclaurin series

$$f(x) = \sum_{j=0}^{\infty}a_jx^j$$ and look at the difference

$$f(x) - \frac{P_m(x)}{Q_n(x)}= \frac{\left(\sum_{j=0}^{\infty}a_jx^j\right)\left(\sum_{j=0}^{n}q_jx^j\right)-\sum_{j=0}^{m}p_jx^j}{\sum_{j=0}^{n}q_jx^j}.$$

Let $q_0 = 1$ so the denominator does not vanish at $x=0$ and solve for the remaining $m+n+1$ coefficients $p_j$ and $q_j$ such that the left-hand side and its first $m+n$ derivatives equal $0$ at $x=0$. This leads to $m+n+1$ linear equations for the unknown coefficients.

$$p_0 = a_0q_0\\p_1 = a_1q_0+a_0q_1\\ \ldots \\p_m = a_mq_0+a_{m-1}q_1+ \,\ldots +a_{m-n}q_n\\a_{m+1}q_0+a_mq_1+ \, \ldots a_{m-n+1}q_n = 0\\a_{m+2}q_0+a_{m+1}q_1+ \, \ldots a_{m-n+2}q_n = 0\\ \ldots \\a_{m+n}q_0+a_{m+n-1}q_1+ \, \ldots a_{m}q_n = 0$$

An advantage of the Pade approximation is that it is relatively easy to compute. In some cases, the approximation is good outside the radius of convergence of the Maclaurin series. A disadvantage is there is no general closed form bound on the error.

For $\log(1+x)$ start with the expansion

$$\log(1+x) = \sum_{j=1}^{\infty}\frac{(-1)^{j+1}x^{j}}{j}$$

For the order $(2,2)$ approximant

$$q_0 = 1 \\\\ p_0 = a_0q_0\\\\p_1 = a_1q_0+a_0q_1 \\\\p_2 = a_2q_0+a_1q_1+a_0q_2 \\\\a_3q_0+a_2q_1+a_1q_2=0\\\ a_4q_0+a_3q_1+a_2q_2=0.$$

The approximation is

$$\log(1+x) \approx \frac{x+\frac1{2}x^2}{1+x+\frac1{6}x^2}$$