Exploring the Pointwise Convergence of Legendre Series for Piecewise Analytic Functions

Table of Contents
Introduction
In this article, we explore the behavior of the pointwise convergence of the Legendre series for piecewise analytic functions using numerical methods. The article extensively covers the mathematics required for forming and computing the series as well as pseudocode code for some of the non-trivial algorithms. It extends the research made in the papers by Babuska and Hakula 1 2 by proving evidence for the conjectures about the Legendre series in a large number of points in the domain and up to very high degree series approximations. We present the numerical results as figures and provide explanations. We also provide the Python code for computing and recreating the results in LegendreSeries repository.
Legendre Polynomials

Legendre polynomials are a system of complete and orthogonal polynomials defined over the domain
The recursive definition enables efficient computing of numerical values of high degree Legendre polynomials at specific points in the domain.
Legendre polynomials also have important properties which are used for forming the Legendre series. The terminal values, i.e. the values at the edges, of Legendre polynomials can be derived from the recursive formula
The symmetry property also follows from the recursive formula
The inner product is denoted by the angles
where
Differentiation of Legendre polynomials can be defined in terms of Legendre polynomials themselves as
The differentiation
Legendre Series
The Legendre series is a series expansion which is formed using Legendre polynomials. Legendre series of function
$$ f(x) = ∑{n=0}^{∞}C{n}P_{n}(x). \tag{7} \label{legendre-series} $$
where
The Legendre series coefficients can be derived using the Legendre series formula
Show proof:
$$f(x) = ∑{m=0}^{∞}C{m}P_{m}(x)
The partial sum of the series expansion gives us an approximation of the function
The approximation error
The actual analysis of the approximation errors will be using the absolute value of the error
Piecewise Analytic Functions

The motivation for studying a series expansion for piecewise analytic functions is to understand the behavior of a continuous approximation of a function with non-continuous or non-differentiable points. We will study the series expansion on two special cases of piecewise analytic functions, the step function and the V function. The results obtained from studying these two special cases generalizes into all piecewise analytic functions, but this is not proven here.
Piecewise analytic function
where
The step function is piecewise analytic function of degree
As can be seen, the V function is the absolute value scaled with
We’ll also note that the derivative of step function is zero
This will be used when forming the Legendre series.
Legendre Series of Step Function
The coefficients for the Legendre series of the step function will be referred as step function coefficients. A formula for them in terms of Legendre polynomials at the singularity
Proof: The coefficients for degree
The coefficients for degrees
$$\begin{aligned}= & \frac{1}{2} \left[ (P_{n+1}(x) - P_{n-1}(x)) u^\prime(x) \right]{-1}^{a} + \\ & \frac{1}{2} \left[ (P{n+1}(x) - P_{n-1}(x)) u^\prime(x) \right]_{a}^{1} \end{aligned}$$
$$\begin{aligned}= & \frac{1}{2} \left[ (P_{n+1}(x) - P_{n-1}(x)) \cdot (-c+\beta) \right]{-1}^{a} + \\ & \frac{1}{2} \left[ (P{n+1}(x) - P_{n-1}(x)) \cdot (c+\beta) \right]_{a}^{1} \end{aligned}$$
Legendre Series of V Function
The coefficients for the Legendre series of the step function will be referred as V function coefficients. A formula for them in terms of step function coefficients can be obtained by substituting the V function
Proof: The coefficients for degree
The coefficients for degrees
Pointwise Convergence

The series is said to converge pointwise if the partial sum
Equivalently in terms of the approximation error which approaches zero
Numerical exploration of the pointwise convergence explores the behavior of the approximation error
Convergence Line
We will perform the exploration by computing a convergence line which contains two parameters:
The convergence rate which is the maximal rate at which the error approaches zero as the degree grows.
The convergence distance which is a value proportional to the degree when the series reaches the maximal rate of convergence.
The definition of the converge line requires a definition for a line. A line between two points
An alternative form of this formula is
where the coefficient
The pseudocode for the convergence line algorithm is then as follows:
Input: A sequence of strictly monotonically increasing positive real numbers
Output: A convergence line defined by the values
- while
- …..
- …..
- ….. if
- ….. ….. break
- …..
- …..
- return
The approximation errors generated by the Legendre series have linear convergence in the logarithmic scale, and therefore we need to convert the values into a logarithmic scale, find the convergence line and then convert the line into exponential form
Input: The degrees
Output: The coefficient
- return
Conjectures of Pointwise Convergence
The papers by Babuska and Hakula 1 2 introduced two conjectures about the convergence rate and convegence distance. They are stated as follows. The convergence rate
As can be seen, there are different convergence rates at the edges, singularity and elsewhere.
The convergence distance
and near edges we have
where
Results
The source code for the algorithms, plots, and animations is available in the LegendreSeries GitHub repository. It also contains instructions on how to run the code.
The results were obtained by computing the approximation error
Step Function
The following results where
Pointwise convergence at the edges has a convergence rate of
Pointwise convergence at the singularity and its negation have a convergence rate of
Pointwise convergence near singularity
Pointwise convergence near edges

We have plotted the convergence distances
Near-singularity convergence distances
Near edges, convergence distances
V Function
The following results where
Pointwise convergence at the edges has a convergence rate of
Pointwise convergence at the negation of singularity has convergence rate of
Pointwise convergence near singularity
Pointwise convergence near edges

We have plotted the convergence distances
Near-singularity convergence distances
Near edges, convergence distances
Conclusions
The results show that the Legendre series for piecewise analytic functions follows the conjectures
The future research could be extended to study the effects of the position of the singularity
Contribute
If you enjoyed or found benefit from this article, it would help me share it with other people who might be interested. If you have feedback, questions, or ideas related to the article, you can contact me via email. For more content, you can follow me on YouTube or join my newsletter. Creating content takes time and effort, so consider supporting me with a one-time donation.
References
Babuška, I., & Hakula, H. (2014). On the
-version of FEM in one dimension: The known and unknown features, 1–25. Retrieved from http://arxiv.org/abs/1401.1483 ↩︎ ↩︎Babuška, I., & Hakula, H. (2019). Pointwise error estimate of the Legendre expansion : The known and unknown features. Computer Methods in Applied Mechanics and Engineering, 345(339380), 748–773. https://doi.org/10.1016/j.cma.2018.11.017 ↩︎ ↩︎