{'fraction_non_alphanumeric': 0.03469664663694515, 'fraction_numerical': 0.008238030626090328, 'mean_word_length': 4.442510548523207, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Eliminating oscillation in partial sum approximation of periodic function

If we cannot obtain all terms of a series, or if we cannot sum up a series, we have to turn to the partial sum approximation which approximate a function by the first several terms of the series. However, the partial sum approximation often does not work well for periodic functions. In the partial sum approximation of a periodic function, there exists an incorrect oscillation which cannot be eliminated by keeping more terms, especially at the domain endpoints. A famous example is the Gibbs phenomenon in the Fourier expansion. In the paper, we suggest an approach for eliminating such oscillations in the partial sum approximation of periodic functions.


Introduction
If a series cannot be exactly summed up, one turns to approximate the series by a partial sum, i.e., approximate the series by the sum of its first several terms. In many cases, the accuracy of the partial sum increases as the number of terms increases. But in the expansion of periodic functions, one encounters such a situation: the accuracy cannot be improved by increasing the number of terms in the partial sum. In other words, even if the number of the term of the partial sum is increased, the accuracy will not be improved. In the partial sum approximation of a periodic function, there exists an incorrect oscillation, especially at the domain endpoints. An important example of such kinds of problem is the Gibbs phenomenon of the Fourier expansion. In this appendix, we suggest an approach to solve the problem. We will take the problem encountered in the calculation of scattering cross section in the main text as an example to illustrate this approach.
In section 2, we illustrate the problem by an example. In section 3, we suggest a scheme for eliminating the oscillation. In sections 4 and 5, we consider examples in scattering. The conclusions are summarized in section 6.

Oscillation in partial sum approximation of periodic function
In order to illustrate the problem encountered in the expansion of periodic functions, we first take a look at an example in which the sum can be exactly performed.
The periodic function can be expanded as where P l (cosθ) is the Legendre polynomial. If we use an N-term partial sum to approximate the exact result, 0 an incorrect oscillation appears Fig. 1. This oscillation does not exist in the exact result, and can not be eliminated by increasing the number of partial sum terms, as shown in Fig. 1. Especially at the edges, i.e., as θ approaches π, the error does not decrease as the total number of terms of the partial sum increases. This oscillation is essentially the Gibbs phenomenon in the Fourier expansion.

Generalized Padé approximant
The example in section 2 is a special case of the problem encountered in scattering theory. Generally, in scattering theory, when using the partial wave method to calculate the scattering cross section, we encounter the following sum: where c l is the expansion coefficient and P l (z) is the Legendre polynomial.
If this sum cannot be performed exactly, we have to truncate the series and approximate the function f (θ) by a partial sum consisting of the first N terms of the series: The basis of this expansion is the Legendre polynomial, while the basis of the Fourier series is the sine/cosine function or the exponential function. The Fourier series can be obtained from a power series {x n } by replacing the basis of the Fourier series x with e inθ . The Legendre polynomial is an orthogonalized power series, which is a rearranged power series, so the series with {P l (cos θ)} as the basis is a rearranged Fourier series, which is essentially still a Fourier expansion. Therefore, the problem encountered here is essentially the Gibbs phenomenon in the Fourier expansion.
In this appendix, we will construct a modified Padé approximant to solve this problem. The Padé approximant is to use a rational function instead of the power series to approximate a function [1]. Since the common Padé approximant is of low efficiency in this case, in this appendix, we introduce a generalized Padé approximant to approximate the series (5).
The generalized Padé approximant is constructed as The generalized Padé approximant is to approximate the function f (θ) with the rational form (6) instead of the polynomial form (5). The numerator of the rational expression is a polynomial of order L and the denominator is a polynomial of order M. In principle, L and M can be chosen arbitrarily as long as the condition L + M = N is satisfied. Unlike the power series expansion, there is no unified method to determine the coefficients a n and b m in the rational expression (6).
In the Padé approximant, one uses the power series expansion to determine the coefficients of the rational approximation. Similarly, we here use the partial sum (5) to determine the coefficients of the rational form approximation (6), i.e., to determine a n and b m from c l by equaling the rational expression (6) and the polynomial (5): L n=0 a n P n (cos θ) M m=0 b m P m (cos θ) = L+M l=0 c l P l (cosθ). (7) These are equations determining the coefficients a n and b m . Next, we solve the coefficients a n and b m from Eq. (7). By Eq. (7) we have L n=0 a n P n (cosθ) = L+M l=0 c l P l (cos θ) The coefficients a n and b m are given by equaling the coefficients of the Legendre polynomial of the same order on both sides.
The coefficient a n can be obtained by utilizing the orthogonality of the Legendre polynomial by multiplying P n (cos θ) on both sides of Eq. (8) and performing the integral (9) From the right side of Eq. (8), it can be seen that the highest order of the Legendre polynomial in the sum is L, which requires These M equations solve M coefficients b l . For a rational expression, the value of b 0 can be taken arbitrarily, so for convenience we take b 0 = 1.
The solution of Eq. (13) is Here the matrix A is the coefficient matrix of Eq. (13),    7), we can greatly improve the oscillation problem.
Comparing with the exact solution, we can see that the rational expression f [3/3] (θ) constructed from the first 6 terms of the power series, i.e., taking N = 6 in Eq. (3), gives a very accurate result (see Fig. 2).

Example: Cross section in quantum mechanics
We take the scattering cross section in quantum mechanics as examples to illustrate the method and its effectiveness.

Coulomb potential: V (r) = α/r
Scattering on the coulomb potential has exact solutions. The exact scattering amplitude of the Coulomb potential is [3] f (θ) = − 1 Alternatively, the scattering amplitude of the Coulomb potential can also be written as a sum as that in Eq. (4) [3]: Though there is no oscillation in the exact result (18), an incorrect oscillation appears in the partial sum.
As an example, corresponding to the first-6-term partial sum, we construct the generalized Padé approximant f [3/3] (θ): where the numerator P = 3 n=0 a n P n (cosθ) and we take α = 1. From Fig. (3) we can see that the incorrect oscillation has been eliminated.

Potential V (r) = α/r 2
Analytic result: Born approximation. The scattering amplitude in quantum mechanical scattering is [3] Under the small phase shift approximation, the scattering amplitude can be written as By the Born approximation, the partial wave scattering phase shift is where V (r) is the potential and j l (z) is the spherical Bessel functions.
In this first order approximation, we encounter the sum of the form (4). The sum here, however, can be performed exactly, ∞ l=0 (2l + 1) j 2 l (kr)P l (cos θ) = sin(qr) qr (27) with q = 2k sin θ 2 , so the amplitude (26) becomes This enables us to check the validity of the method through directly comparing the approximate result given by the partial sum with the analytic result. For the potential by Eq. (28) we have Partial sum approximation: The partial sum approximation is This partial sum is of the form of Eq. (5), which leads to an incorrect oscillation as in the example given in section 2. This oscillation does not appear in the result given by (30). Such an oscillation cannot be eliminated by keeping more terms.
Eliminating oscillation. We now use the generalized Padé approximant constructed in section 3 to eliminate the incorrect oscillation.
Taking the first 6 terms, i.e., N = 6, in Eq. (31) as an example, The generalized Padé approximant (6) is where we take α = 1. It can be seen from Fig. (4) that the generalized Padé approximant works well.

Example: Scattering in Reissner-Nordström spacetime
In the calculation of the scattering cross section in the Reissner-Nordström spacetime, we also encounter the incorrect oscillation of the partial sum. Such an oscillation can also be eliminated by the generalized Padé approximant. For scattering cross section in the Reissner-Nordström spacetime, the scattering amplitude is [4] and the differential scattering cross section is Here the zeroth-order phase shift is [5] and the first-order phase shift is

Conclusion
The approach suggested in this appendix can be used for eliminating the oscillation in the truncated Fourier series, i.e., the partial sum approximation of the Fourier series. Expanding a periodic function needs a complete set consisting of the periodic function basis. The Fourier series chooses the sine and cosine functions as the basis, and the spherically symmetric scattering chooses the Legendre polynomial with the variable cosθ as the basis. The complete set of the Legendre polynomial with the variable cos θ is a rearrangement of the complete set of the sine and cosine functions -the Fourier case. Therefore, the Gibbs phenomenon of the Fourier series will be transferred to the series with the Legendre polynomial basis. The key in constructing the rational approximant for eliminating the oscillation in the Gibbs phenomenon is that the rational approximant should be constructed from the basis of the corresponding series. For example, the rational approximant corresponding to the Fourier series should be constructed by the sine and cosine functions, and the rational approximant corresponding to the series with the Legendre polynomial should be constructed by the Legendre polynomial, and so on. Only in this way can the efficiency of the calculation be guaranteed.