Approximaths

  • Euler summation I

    So far we’ve seen Padé’s approximants. These have enabled us to approximate a function from its corresponding Taylor series and then transform this (potentially non-convergent) series into a convergent rational fraction.

    We’d like to introduce other techniques that could be used to sum non-convergent series. First, we’ll take a look at Euler summation.

    If the series \sum_{n=0}^{\infty} a_n is algebraically divergent (the terms blow up like some power of n), then the series:

    \displaystyle f(x) = \sum_{n=0}^{\infty}a_n x^n

    converges for x \in (-1,1). If the limit

    \displaystyle E := \lim_{x \to 1_{-}}f(x)

    exists and is finite then it is called the Euler sum E of the original series.

    For example, consider the divergent series:

    \displaystyle 1 - 1 + 1 - 1 + 1 - 1 + ...

    and multiply each n-term with x^n (starting at n = 0):

    \displaystyle f(x) = x^0 - x^1 + x^2 - x^3 + x^4 - x^5 + ...
    \displaystyle = \frac{1}{1-(-x)} = \frac{1}{1+x}
    \displaystyle E = \lim_{x \to 1_{-}}{\frac{1}{1+x}} = \frac{1}{2}

    Therefore (according to Euler summation):

    \displaystyle 1 - 1 + 1 - 1 + 1 - 1 + ... = \frac{1}{2}
  • Padé approximants: Convergence III

    For a function f(z) analytic at z=0, with Taylor series

    \displaystyle f(z) = \sum_{k=0}^{\infty} a_k z^k

    valid within its radius of convergence R, the Padé approximant of order [m/n], denoted \frac{P_m(z)}{Q_n(z)} with \deg P_m \leq m and \deg Q_n \leq n, satisfies

    \displaystyle f(z) - \frac{P_m(z)}{Q_n(z)} = O(z^{m+n+1})

    near z=0. The rational structure of \frac{P_m(z)}{Q_n(z)} allows it to approximate f(z) beyond the disk |z| < R by modeling singularities (e.g., poles or branch points) through the zeros of Q_n(z). This enables analytic continuation into regions where the Taylor series diverges.

    Formally, for a meromorphic function f(z) in a domain D, the diagonal Padé approximants [n/n] often converge to f(z) in D \setminus S, where S is the set of poles of f:

    Let f(z) be meromorphic in a domain D \subseteq \mathbb{C}, with a set of poles S of finite total multiplicity. The diagonal Padé approximants [n/n], defined as rational functions \frac{P_n(z)}{Q_n(z)} satisfying

    \displaystyle f(z) - \frac{P_n(z)}{Q_n(z)} = O(z^{2n+1})

    near z=0, converge uniformly to f(z) on compact subsets of D \setminus S as n \to \infty.

    The zeros of Q_n(z) approximate the poles in S, enabling analytic continuation of f(z) beyond the radius of convergence of its Taylor series.

  • Nuttall’s Padé approximant

    Let f(z) = \sum_{k=0}^\infty C_k z^k be a power series. The denominator Q_{n-1}(z) of the Padé approximant P(n, n-1) is given by Nuttall’s compact form:

    \displaystyle Q_{n-1}(z) = \frac{ \begin{vmatrix} C_0 & C_1 & C_2 & \cdots & C_{n-1} & C_n \\ C_1 & C_2 & C_3 & \cdots & C_n & C_{n+1} \\ C_2 & C_3 & C_4 & \cdots & C_{n+1} & C_{n+2} \\ \vdots & \vdots & \vdots & \ddots & \vdots & \vdots \\ C_{n-2} & C_{n-1} & C_n & \cdots & C_{2n-3} & C_{2n-2} \\ 1 & z & z^2 & \cdots & z^{n-2} & z^{n-1} \end{vmatrix} }{ \begin{vmatrix} C_0 & C_1 & C_2 & \cdots & C_{n-1} \\ C_1 & C_2 & C_3 & \cdots & C_n \\ C_2 & C_3 & C_4 & \cdots & C_{n+1} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ C_{n-1} & C_n & C_{n+1} & \cdots & C_{2n-1} \end{vmatrix} }

    The numerator P_n(z) is obtained by satisfying the Padé approximation condition: f(z) Q_{n-1}(z) - P_n(z) = O(z^{2n}).

    The compact form of Nuttall’s Padé approximant P(n, n-1) is particularly valuable in numerical analysis and theoretical physics for its efficiency in computing Padé approximants without explicitly solving large linear systems.

    By expressing the denominator Q_{n-1}(z) as a ratio of determinants, it provides a direct and elegant method to capture the approximant’s poles, which is crucial for analyzing singularities of functions, especially in Stieltjes series or meromorphic functions.

    This formulation simplifies calculations, facilitates the study of convergence properties, and connects Padé approximants to orthogonal polynomials, enabling applications in areas like quantum field theory and asymptotic analysis where rapid computation and singularity detection are essential.

  • Continued fractions II

    A well-known continued fraction representation of exp(x) is:

    \displaystyle exp(x) = 1 + \frac{x}{1 - \frac{x}{2 + \frac{x}{3 - \frac{x}{4 + \cdots}}}}

    Using the procedure described in the previous post, we can show that the near-diagonal Padé coefficients presented in this post can be converted to a sequence of truncated fractions corresponding to the continued fraction above (see figures below).


    P(m,n) 0 1 2 3
    0
    \displaystyle 1
    \displaystyle 1 + x
    1
    \displaystyle 1 + \cfrac{x}{1 - \cfrac{x}{2}}
    \displaystyle 1 + \cfrac{x}{1 - \cfrac{x}{2 + \cfrac{x}{3}}}
    2
    \displaystyle 1 + \cfrac{x}{1 - \cfrac{x}{2 + \cfrac{x}{3 - \cfrac{x}{4}}}}
    \displaystyle 1 + \cfrac{x}{1 - \cfrac{x}{2 + \cfrac{x}{3 - \cfrac{x}{4 + \cfrac{x}{5}}}}}
    3

    Caption: Padé Approximants P(m,n) for exp(x) expressed as continued fractions.

    The relationship between Padé approximants and continued fractions is a profound connection in mathematical analysis, particularly for approximating functions like exp(x). Padé approximants, which are rational functions that match the Taylor series of a function up to a specified order, can often be expressed as continued fractions. This representation is advantageous because continued fractions can provide better convergence properties for certain functions, especially near singularities. For instance, the near-diagonal Padé approximants for exp(x), as shown above, can be systematically converted into a sequence of truncated continued fractions, revealing a structured pattern known as the “main Padé sequence.”

    A function with a convergent Taylor series around x = a can be approximated by a sequence of diagonal Padé approximants P(n,n)(x) = \frac{P_n(x)}{Q_n(x)}, provided the associated Hankel matrices H_n, built from the Taylor coefficients, have nonzero determinants.

    When this “Padé table” is normal (i.e., \det(H_n) \ne 0 for all n), each Padé approximant is uniquely defined.

    Under these conditions, one can systematically derive a continued fraction whose successive convergents exactly match the Padé approximants.

    This establishes a rigorous connection between the Taylor series, Padé approximation, and continued fraction representation of the function.

  • Continued fractions I

    We can use Padé approximants to build a sequence of truncated continued fractions representing a given function. For example using P(1,1):

    P(1,1) = \frac{A_0 + A_1 x}{1 + B_1 x} = C_0 + C_1 x + C_2 x^2

    Solving the linear systems presented in post Computing Padé approximants sequentially leads to:

    C_1 B_1 = - C_2 \quad \Rightarrow \quad B_1 = -\frac{C_2}{C_1}
    \begin{pmatrix} C_0 & 0 \\ C_1 & C_0 \end{pmatrix} \begin{pmatrix} 1 \\ B_1 \end{pmatrix} = \begin{pmatrix} A_0 \\ A_1 \end{pmatrix}
    A_0 = C_0, \quad A_1 = C_1 + C_0 B_1

    Setting C_0 = 1:

    P(1,1) = \frac{1 + (C_1 + B_1) x}{1 + B_1 x}
    P(1,1) = \frac{1 + (C_1 - \frac{C_2}{C_1}) x}{1 - \frac{C_2}{C_1} x}
    P(1,1) = \frac{1 + (C_1 - \frac{C_2}{C_1}) x}{1 + (C_1 - \frac{C_2}{C_1}) x - C_1 x}
    P(1,1) = \frac{1}{1 - \frac{C_1 x}{1 + (C_1 - \frac{C_2}{C_1}) x}}
    P(1,1) = \frac{1}{1 - \frac{C_1 x}{1 - (\frac{C_2}{C_1} - C_1) x}}

    Now define:

    \frac{b_0}{1 - \frac{b_1 x}{1 - b_2 x}} = \frac{1}{1 - \frac{C_1 x}{1 - \left(\frac{C_2}{C_1} - C_1\right) x}}

    We have:

    b_0 = 1, \quad b_1 = C_1, \quad b_2 = \frac{C_2}{C_1} - C_1, \quad \ldots
  • Python code for Padé approximants

    In this post, we provide readers with Python code that enables the derivation of Padé approximants from series coefficients given as input to the algorithm in the form of a coefficient vector. It is also necessary to predefine the degree of the numerator and denominator.

    import sympy as sp
    
    def pade_approximation_function(series, m, n):
        """
        Returns the Padé approximation [m/n] in the form of a rational function
        with coefficients simplified as fractions.
        
        Parameters:
        series : list - Coefficients of the Taylor series (e.g., [1, 0, -1/2, 0, 1/24, ...] for cos(x))
        m : int - Degree of the numerator
        n : int - Degree of the denominator
        
        Returns:
        sympy.Expr - Rational function P(x)/Q(x) with simplified fractions
        """
        # Check that there are enough terms in the series
        if len(series) < m + n + 1:
            raise ValueError(f"The series must contain at least {m + n + 1} terms for an [m/n] approximation")
    
        # Convert the series coefficients to simplified fractions
        series = [sp.simplify(sp.Rational(str(c))) for c in series]
        
        # Symbolic variable
        x = sp.Symbol('x')
        
        # Coefficients of the numerator P(x) = a0 + a1*x + ... + am*x^m
        a = [sp.Symbol(f'a{i}') for i in range(m + 1)]
        # Coefficients of the denominator Q(x) = 1 + b1*x + ... + bn*x^n (b0 = 1)
        b = [1] + [sp.Symbol(f'b{i}') for i in range(1, n + 1)]
        
        # Polynomials P(x) and Q(x)
        P = sum(ai * x**i for i, ai in enumerate(a))
        Q = sum(bi * x**i for i, bi in enumerate(b))
        
        # The truncated series in polynomial form
        S = sum(c * x**i for i, c in enumerate(series))
        
        # Equation to solve: P(x) - Q(x)*S(x) = 0 up to order m+n
        expr = P - Q * S
        
        # Extract coefficients of x^0 to x^(m+n) and set the equations to 0
        equations = [sp.expand(expr).coeff(x, k) for k in range(m + n + 1)]
        
        # Variables to solve for (a0, a1, ..., am, b1, b2, ..., bn)
        unknowns = a + b[1:]
        
        # Solve the system
        solution = sp.solve(equations, unknowns)
        
        if not solution:
            raise ValueError("No solution found for this approximation")
        
        # Simplified coefficients for P(x) and Q(x)
        num_coeffs = [sp.simplify(sp.Rational(str(solution[ai]))) if ai in solution else 0 for ai in a]
        den_coeffs = [1] + [sp.simplify(sp.Rational(str(solution[bi]))) if bi in solution else 0 for bi in b[1:]]
        
        # Construct the final polynomials
        P_final = sum(coef * x**i for i, coef in enumerate(num_coeffs))
        Q_final = sum(coef * x**i for i, coef in enumerate(den_coeffs))
        
        # Return the simplified rational function
        return sp.simplify(P_final / Q_final)
    

    Here is the code to compute the Padé(2,2) for \cos(x)

        # Compute Padé(2,2) for cos(x)
        series = [1, 0, -sp.Rational(1,2), 0, sp.Rational(1,24)]
        m, n = 2, 2
        pade_approx = pade_approximation_function(series, m, n)
        print("Padé(2,2) approximant for cos(x):")
        sp.pprint(pade_approx)
    
  • Anharmonic oscillator I

    We would like to illustrate the use of Padé approximants in the context of the anharmonic oscillator. A harmonic oscillator is an oscillating system that experiences a restoring force. Anharmonicity is the deviation of a system from being a harmonic oscillator. The anharmonic oscillator is described by the following differential equation:

    \displaystyle \left(-\frac{d^2}{dx^2} + x^2 + x^4\right) \phi(x) = E_n \phi(x)

    This differential equation is very hard to solve exactly. In order to obtain an approximate solution, we can use perturbation theory. By inserting a small dimensionless parameter \epsilon, the equation becomes:

    \displaystyle \left(-\frac{d^2}{dx^2} + x^2 + \epsilon x^4\right) \phi(x) = E_n(\epsilon) \phi(x)

    If we are interested in the energy levels, the basic idea is to write E_n(\epsilon) as a geometric series. For the ground state E_0 we write:

    \displaystyle E_0(\epsilon) = \sum_{n=0}^{\infty} E_{0,n} \epsilon^n

    The solution is a divergent perturbation series (C.M. Bender and T.T. Wu, Phys. Rev. 184, 1969):

    \displaystyle E_0(\epsilon) = \frac{1}{2} + \frac{3}{4}\epsilon - \frac{21}{8}\epsilon^2 + \frac{333}{16}\epsilon^3 + \mathcal{O}(\epsilon^4)

    Let’s calculate the P(1,1) approximant of E_0 using the techniques presented in post Computing Padé approximants:

    \displaystyle P(1,1) = \frac{A_0 + A_1 \epsilon}{1 + B_1 \epsilon} = C_0 + C_1 \epsilon + C_2 \epsilon^2

    Solving the linear systems for computing Padé approximants sequentially leads to:

    \displaystyle C_1 B_1 = - C_2 \implies B_1 = -\frac{C_2}{C_1}
    \displaystyle \frac{3}{4} B_1 = \frac{21}{8} \implies B_1 = \frac{84}{24} = \frac{7}{2}
    \displaystyle \begin{pmatrix} C_0 & 0 \\ C_1 & C_0 \\ \end{pmatrix} \begin{pmatrix} 1 \\ B_1 \end{pmatrix} = \begin{pmatrix} A_0 \\ A_1 \end{pmatrix}
    \displaystyle \begin{pmatrix} \frac{1}{2} & 0 \\ \frac{3}{4} & \frac{1}{2} \\ \end{pmatrix} \begin{pmatrix} 1 \\ \frac{7}{2} \end{pmatrix} = \begin{pmatrix} \frac{1}{2} \\ \frac{3}{4} + \frac{7}{4} \end{pmatrix}
    \displaystyle P(1,1)_{E_0} = \frac{\frac{1}{2} + \left(\frac{3}{4} + \frac{7}{4}\right)\epsilon}{1 + \frac{7}{2}\epsilon}

    Setting \epsilon = 1 (to recover the initial differential equation) we have:

    \displaystyle P(1,1)_{E_0} = \frac{\frac{1}{2} + \frac{3}{4} + \frac{7}{4}}{1 + \frac{7}{2}} = 0.6666

    The P(4,4)_{E_0} = 1.3838 and the exact solution is 1.3924.

    The relative error (definition here) of the approximant P(4,4)_{E_0} is:

    \displaystyle \text{Relative error} = \frac{1.3838 - 1.3924}{1.3924} = -0.0062

    It’s therefore interesting to note that in order to solve a very difficult differential equation, we can use perturbation theory. In the case of the anharmonic oscillator, the perturbative series is divergent. Using Padé approximants, we can make use of a divergent perturbative series and approximate the exact answer arbitrarily.

  • Padé approximants: Possible application

    The basic idea beyond Padé approximants is to construct a rational fraction whose Taylor series expansion near the origin coincides with that of a given function up to the maximum order. In the previous sections we introduced Padé approximants P(m,n) and a procedure to calculate their coefficients by solving 2 systems of linear equations sequentially (see this post).

    We have observed (in particular through the examples concerning \tan(x) and \sec(x)) that Padé approximants:

    Converge beyond the disc of convergence of the entire series

    Speed up convergence

    Extend the notion of series

    Now, let’s imagine that we want to solve a problem that is very difficult or even impossible to solve exactly (i.e. a specific differential equation, extracting the roots of a polynomial, etc.). We can split the problem into an infinite number of simple problems. This is the principle of perturbation theory (which is in many cases the only way to solve the problem). The result of such a procedure is a geometric series (we will see this later). In a very large number of cases, this series does not converge. In these cases, we can use Padé approximants to ‘extract’ the information contained in the series and finally obtain a convergent rational function (as illustrated in the case of the functions \tan(x) and \sec(x)).

    The figure below presents schematically a potential application of Padé approximants in this context.

  • Padé approximants: Convergence examples

    We will first illustrate the Montessus’s theorem with the function:

    \displaystyle f(z) = \frac{z}{4 + z^2} = \frac{z}{(z - 2i)(z + 2i)}

    where z \in \mathbb{C}. This function has two poles at z = 2i and z = -2i.

    The corresponding Maclaurin series is:

    \displaystyle \frac{1}{4}z - \frac{1}{16}z^3 + \frac{1}{64}z^5 - \frac{1}{256}z^7 + \frac{1}{1024}z^9 + \mathcal{O}(z^{11})

    The corresponding P(2,2) approximant is (calculations were made according to the linear systems presented in this post):

    \displaystyle P(2,2) = \frac{z}{4 + z^2}

    We see that, in this case, if we set n = 2 (the total number of poles) we recover the original function since P(2,2) = f(z). The graphs of the f(z), P(2,2) and the corresponding Maclaurin series are presented in the figure below.

    Left, graph of

    \displaystyle \frac{z}{4 + z^2}

    and its corresponding P(2,2). Right, graph of the Maclaurin series

    \displaystyle \frac{1}{4}z - \frac{1}{16}z^3

    in the complex \mathbb{C}-plane. The poles at -2i and 2i are clearly visible on the left picture. Hue and brightness are used to display phase and magnitude, respectively.

    The Montessus’s theorem is also illustrated in the figures below for the function tan(z).

    \displaystyle P(2,2) = \frac{z}{1 - \frac{1}{3}z^2}

    and

    \displaystyle P(4,2) = \frac{z + \frac{1}{3}z^2}{1 - \frac{6}{15}z^2}

    of the \tan(z) function. The improvement of the approximation between P(2,2) and P(4,2) is visible on the figures.

    Graph of tan(z):

    Graphs of the P(2,2) (left) and P(4,2) (right) of tan(z):

    Pictures were produced using: Samuel Jinglian, 2018. “Complex Function Plotter.” https://samuelj.li/complex-function-plotter/.

  • Padé approximants: Convergence II

    In the previous post we gave a modern definition of Montessus’s theorem. Here is the original formulation from R. De Montessus (1902):

    “Il ressort de ces considérations qu’étant donnée une série de Taylor représentant une fonction f(x) dont les p pôles les plus rapprochés de l’origine sont intérieurs à un cercle (C) lui-même intérieur aux pôles suivants, chaque pôle multiple étant compté pour autant de pôles simples qu’il existe d’unités dans son degré de multiplicité, la fraction continue déduite de la ligne horizontale de rang p du Tableau de M. Padé, ce tableau étant composé de réduites normales, représente la fonction f(x) dans un cercle de rayon \displaystyle \lvert \alpha_{p+1} \lvert, où \alpha_{p+1} est l’affixe du pôle le plus rapproché de l’origine parmi tous ceux qui sont extérieurs au cercle (C). Si tous les pôles ont des modules différents, les fractions continues correspondant aux lignes horizontales représentent toute la fonction ; s’il existe simplement des discontinuités dans l’ensemble linéaire des modules des pôles, les fractions continues correspondant à des lignes horizontales convenablement choisies représentent encore la fonction. Si tous les pôles sont simples, la représentation a lieu dans des cercles d’autant plus grands que la ligne horizontale choisie est plus éloignée dans le Tableau. S’il y a des pôles multiples, il y a stationnement, en ce sens que plusieurs lignes horizontales consécutives représentant la fonction ont le même rayon de convergence. S’il y a enfin un point singulier essentiel, le stationnement se prolonge indéfiniment, aucune des fractions continues considérées ne représente la fonction en dehors du cercle sur la circonférence duquel se trouve le point singulier essentiel le plus rapproché de l’origine.”

    References:

    • R. De Montessus, “Sur les fractions continues algébriques”, Bulletin de la S. M. F., tome 30 (1902), p. 28-36.
    • E. B. Saff, “An extension of Montessus de Ballore’s theorem on the convergence of interpolating rational functions”, Journal of Approximation Theory, vol 6, No. 1, July 1972.