Next Article in Journal
The Unit Alpha-Power Kum-Modified Size-Biased Lehmann Type II Distribution: Theory, Simulation, and Applications
Previous Article in Journal
Relaxation Functions Interpolating the Cole–Cole and Kohlrausch–Williams–Watts Dielectric Relaxation Models
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Legendre Series Analysis and Computation via Composed Abel–Fourier Transform

by
Enrico De Micheli
IBF—Consiglio Nazionale delle Ricerche, Via De Marini 6, 16149 Genova, Italy
Symmetry 2023, 15(6), 1282; https://doi.org/10.3390/sym15061282
Submission received: 18 May 2023 / Revised: 14 June 2023 / Accepted: 16 June 2023 / Published: 19 June 2023
(This article belongs to the Section Mathematics)

Abstract

:
Legendre coefficients of an integrable function f ( x ) are proved to coincide with the Fourier coefficients with a nonnegative index of a suitable Abel-type transform of the function itself. The numerical computation of N Legendre coefficients can thus be carried out efficiently in O ( N l o g N ) operations by means of a single fast Fourier transform of the Abel-type transform of f ( x ) . Symmetries associated with the Abel-type transform are exploited to further reduce the computational complexity. The dual problem of calculating the sum of Legendre expansions at a prescribed set of points is also considered. We prove that a Legendre series can be written as the Abel transform of a suitable Fourier series. This fact allows us to state an efficient algorithm for the evaluation of Legendre expansions. Finally, some numerical tests are illustrated to exemplify and confirm the theoretical results.
MSC:
42C10; 44A05; 65R10; 65T50

1. Introduction

The computation of the coefficients of Legendre expansions is a very important problem in applied mathematics and numerical analysis, with a wide range of applications including, just to name a few, approximation theory [1], special function theory [2], spectral methods for differential equations [3], and the construction of quadrature formulae [3,4]. Its importance has also emerged in connection with the computation of spectra of highly oscillatory Fredholm integral operators, which play an important role in laser engineering [5]. Due to its relevance, this problem has attracted a significant amount of research attention since the 1970s [6,7].
The essential difficulty of the problem is that these coefficients are represented by integrals whose integrands oscillate rapidly for large values of the index of the polynomial. Standard quadrature procedures for the calculation of N Legendre coefficients lead only to slow O ( N 2 ) algorithms (see [6,8]). The first contribution toward a more efficient computation of Legendre coefficients traces back to the work of Orszag [9], where the algorithm used a slowly converging first-order WKB expansion of the Legendre polynomials.
More efficiently, in [10], the Legendre coefficients are obtained by transforming the corresponding Chebyshev coefficients through a multipole-like expansion, which yields a fast  O ( N log N ) algorithm, despite requiring a considerable and rather expensive initialization phase. In this context, various improvements have been proposed, e.g., in [11,12]. Remaining within this kind of approach, Hale and Townsend [13] described an O ( N ( log N ) 2 / log log N ) Chebyshev–Legendre transform, which is based on Stieltjes’ asymptotic formula for Legendre polynomials of large degree. Mori et al. [14] employed the same asymptotic formula to produce a fast O ( N log N ) algorithm, but this algorithm was affected by the problem of numerical instability for large values of N. The connection between Legendre and Chebyshev coefficients is also analyzed in [15] in the case of piecewise smooth functions. In Ref. [16] (see also [17]), an O ( N ( log N ) 2 ) algorithm is given for a value of N equal to a power of two, which requires a suitably preprocessed data structure.
Another way to tackle this problem was described by Iserles in [18], where an algorithm for the rapid computation of the Legendre coefficients is presented when the analytic expression of the input function is known on a Bernstein ellipse in the complex plane. The complexity of the algorithm is O ( N log N ) but requires knowledge of the region of analyticity of the function in C .
In this paper, an alternative procedure is presented. The basic idea of our method consists of exploiting the Dirichlet–Murphy integral representation of the Legendre polynomials. We prove that the coefficients of the Legendre expansion of a function f ( x ) are connected with a subset of the Fourier coefficients (the ones with a nonnegative index) of an Abel-type transform of f ( x ) [19,20,21].
The numerical implementation of the algorithm follows straightforwardly and is very efficient. The aforementioned Fourier coefficients (which represent the sought-for Legendre coefficients) can be computed in O ( N log N ) operations by a single fast Fourier transform (FFT) after the evaluation of the Abel-type integral by means of standard quadrature techniques.
The dual problem of calculating the values of (finite) Legendre expansions at a set of prescribed points is analyzed in Section 3. In Section 3.1, we prove that the Legendre expansions can be computed by an (inverse) cosine transform of a sequence of coefficients, which is obtained by a suitable linear transformation of the given set of N Legendre coefficients. Further, a novel algorithm is presented in Section 3.2, where the Legendre expansions are proved to be the Abel-type transform of a Fourier series, whose coefficients coincide with the Legendre coefficients of the function f ( x ) . This leads to an efficient algorithm that requires the calculation of one FFT and one Abel-type integral.

2. Connection between Legendre Expansions and Fourier Series

The standard form of the Legendre expansion reads
f ( x ) = n = 0 c n P n ( x ) , ( x [ 1 , 1 ] ) ,
where P n ( x ) are the Legendre polynomials, which can be defined by the generating function [22]
n = 0 P n ( x ) t n = 1 2 x t + t 2 1 2 , ( | x | 1 , | t | < 1 ) ,
and the coefficients { c n } n = 0 are given by
c n = n + 1 2 1 1 f ( x ) P n ( x ) d x , ( n 0 ) .
The conditions to be satisfied by f ( x ) to guarantee the uniform convergence of the series in (1) will be discussed in the next section. However, for our current purpose of computing the Legendre coefficients c n , it is sufficient to assume that f ( x ) must be absolutely integrable on the interval [ 1 , 1 ] . For later convenience, we define the normalized Legendre coefficients as
a n c n 2 n + 1 , ( n 0 ) .
We can now state the following theorem.
Theorem 1.
The normalized Legendre coefficients { a n } n = 0 coincide with the Fourier coefficients (with n 0 ) of an Abel-type transform of f ( x ) ; that is:
a n = π π f ^ ( y ) e i n y d y , ( n 0 ) ,
where the 2 π -periodic function f ^ ( y ) is defined by
f ^ ( y ) = 1 2 π i ε ( y ) e i y 2 cos y 1 f ( x ) [ 2 ( x cos y ) ] 1 2 d x , ( y R ) ,
with ε ( y ) being the sign function.
Proof. 
We consider the Dirichlet–Murphy integral representation of the Legendre polynomials [23] (Ch. III, §5.4):
P n ( cos u ) = i π u ( 2 π u ) e i ( n + 1 2 ) y 2 ( cos u cos y ) 1 2 d y .
Plugging (7) into Equality (3) (after changing the variable x cos u ), we have:
2 π i a n = 0 π d u f ( cos u ) sin u u ( 2 π u ) e i ( n + 1 2 ) y 2 ( cos u cos y ) 1 2 d y .
Interchanging the order of integration in (8), we obtain
2 π i a n = 0 π d y e i ( n + 1 2 ) y 0 y f ( cos u ) sin u 2 ( cos u cos y ) 1 2 d u + π 2 π d y e i ( n + 1 2 ) y 0 ( 2 π y ) f ( cos u ) sin u 2 ( cos u cos y ) 1 2 d u .
Next, changing the variables y y 2 π and u u , the second integral on the right-hand side of (9) reads
e i π π 0 d y e i ( n + 1 2 ) y 0 y f ( cos u ) sin u 2 ( cos u cos y ) 1 2 d u .
Then, (9) becomes
2 π i a n = 0 π d y e i ( n + 1 2 ) y 0 y f ( cos u ) sin u 2 ( cos u cos y ) 1 2 d u + e i π π 0 d y e i ( n + 1 2 ) y 0 y f ( cos u ) sin u 2 ( cos u cos y ) 1 2 d u ,
which, after changing the variable cos u x into the integrals on the r.h.s., yields:
a n = π π f ^ ( y ) e i n y d y , ( n 0 ) ,
with f ^ ( y ) given by (6). □
It is immediate to see from (6) that f ^ ( y ) satisfies the symmetry relation,
f ^ ( y ) = e i y f ^ ( y ) ,
which, by (5), induces the following symmetry on a n :
a n = a n 1 , ( n Z ) .

Numerical Issues

Let us now consider the actual problem of computing the first N Legendre coefficients { c n } n = 0 N 1 (or, equivalently, Nnormalized coefficients { a n } n = 0 N 1 ) associated with the function f ( x ) (see (1) and (3)).
The numerical implementation of the algorithm suggested by Theorem 1 requires the computation of the Fourier coefficients (5) of the Abel-type integral function f ^ ( y ) defined in (6). For what concerns the computation of f ^ ( y ) , the integrand has a weak algebraic singularity at the lower boundary of the integration domain, which can be effectively treated by means of a proper nonlinear change of variable. This technique, along with the use of a standard quadrature formula (e.g., the Gauss–Legendre one), produces high accuracy with a small number of nodes [24]. Quadrature formulae suited to end-point singular integrands can also be used [25,26].
It is important to stress that the function f ^ ( y ) does not depend on the order n of the Legendre polynomial. Therefore, the computational cost for evaluating f ^ ( y ) is independent of the number N of Legendre coefficients to be computed. This means that the number of knots that are necessary to compute the integral in f ^ ( y ) (with a prescribed fixed accuracy ϵ ) does not depend on N but depends only upon the oscillatory characteristics of the function f ( x ) (i.e., the number of samples needed to determine f ( x ) uniquely) and on the accuracy ϵ [27]. The oscillatory contributions due to the Legendre polynomials or, in other words, the dependence on the order n of the Legendre polynomial, are accounted for only in the Fourier formula (5) and are neatly separated from the oscillatory contributions ascribable to the input function f ( x ) . The consequence of this decoupling is the low computational complexity of the whole algorithm. In fact, Formula (5) makes it possible to take full benefit of the computational efficiency of the fast Fourier transform either in terms of speed of computation and accuracy [28,29,30]. The first N Fourier coefficients a n of f ^ ( y ) (which coincide with the normalized Legendre coefficients of f ( x ) ) can thus be computed by a single FFT from the values (samples) of f ^ ( y ) at N distinct points in O ( N log N )  time. As we have seen above, the number of operations for the calculation of each sample of f ^ ( y ) is independent of N and, consequently, the (asymptotic) computational complexity of the entire algorithm for the computation of the Legendre coefficients coincides with that of the FFT, i.e., O ( N log N ) . Moreover, in view of the symmetry Relation (10), the number of calls to the procedure for the computation of the Abel integral is halved. Of course, if O ( N ) samples are needed to uniquely determine the function f ( x ) and we want the error ϵ to be as small as possible, then all the O ( N ) samples of f ( x ) must be used for the numerical computation of the Abel integral and, consequently, the total number of operations in the algorithm will be O ( N 2 ) . Therefore, following logical lines similar to those adopted by Alpert and Rokhlin in [1] (and, more generally, in methods such as, e.g., the fast multipole methods [31]), the reduction of complexity from O ( N 2 ) to O ( N log N ) is obtained by accepting a lower precision in the computation (in our case, a lower precision in the computation of the Abel integral).
We want to remark on two additional features of the algorithm just presented. First, the algorithm does not require the knowledge of the input function f ( x ) at a specific and prescribed set of knots (see, for instance, [10] where the input function is supposed to be known at Chebyshev knots). The function f ( x ) enters the algorithm only through its Abel-type integral. This gives a significant amount of flexibility in choosing the quadrature scheme, which is more suitable for the distribution of knots at which the input function is known (e.g., a uniform grid, Chebyshev grid, or a set of measurements of f ( x ) that are non-uniformly distributed).
The final remark concerns the robustness of the algorithm against the noise. In the case for which the values of f ( x ) are only approximately known, e.g., when the input samples of f ( x ) represent measurements affected by error, the effects of the noise in the calculation of the coefficients c n are damped by the algorithm. In fact, the noisy input samples of f ( x ) are smoothed by the Abel integral operator [32] before being analyzed (encoded as samples of f ^ ( y ) ) by the oscillatory Fourier integral (5).
The procedure described above was implemented in double-precision arithmetics using the standard open source GNU Scientific Library (GSL) (all algorithms were implemented on a laptop with Intel Core i7-2630QM processor at 2.0 GHz with 8 GB RAM. The actual computation of the Abel-type integrals is based on the GSL module gsl_integration_qaws.) [33].
The feasibility and accuracy of the algorithm were verified by the direct comparison of the obtained numerical results with the true Legendre coefficients for a variety of functions. We report some of them here.
Table 1 displays the absolute error E n | c n True c n Computed | in the computation of Legendre coefficients for four functions with different degrees of regularity: the discontinuous function f 1 ( x ) = γ ε ( x x 0 ) (with ε ( · ) being the sign function and γ being a constant), whose Legendre coefficients are c 0 ( 1 ) = γ x 0 , c n ( 1 ) = γ P n 1 ( x 0 ) P n + 1 ( x 0 ) for n 1 ; the C 0 [ 1 , 1 ] function f 2 ( x ) = | x | 3 / 2 , whose Legendre coefficients are [3] (p. 78)
c n ( 2 ) = ( α + 1 ) 1 if n = 0 , ( α = 3 2 ) , ( ( 2 n + 1 ) α ( α 2 ) ( α n + 2 ) ( ( α + 1 ) ( α + 3 ) ( α + n + 1 ) if n is even , 0 if n is odd ;
the function f 3 ( x ) = ( 1 2 x t + t 2 ) 1 / 2 with c n ( 3 ) = t n (with a singlarity for x outside the interval [ 1 : 1 ] ; see (2)); and the C -analytic function f 4 ( x ) = e β x J 0 ( β 1 x 2 ) , with c n ( 4 ) = β n / n ! ( J 0 denoting the Bessel function of the first kind and zeroth order).
The first observation from Table 1 is that the accuracy depends on the degree of smoothness of the function because of the computation of the Abel transform of f ( x ) , which, in order to obtain a given target precision, requires more quadrature knots for low regular functions. Concerning the smooth (within the interval [ 1 , 1 ] ) functions f 3 and f 4 , which give similar results, the accuracy increases significantly to reach values comparable with the ϵ -machine.
The algorithm sources of error are the approximation of integral (5) by the discrete Fourier transform; the approximation of the Abel transform (6) by quadratures, and, finally, the limited accuracy of the floating-point arithmetic. The error associated with the discrete Fourier transform is ruled by N. This is clearly visible from Figure 1a, where the maximum error E m a x ( N ) max n [ 0 , N 1 ] E n is plotted versus N. For the C 0 -function f 2 ( x ) (asterisks), we see that for low values of N the maximum error is mainly ascribable to the error due to the approximation of the Fourier integral with the DFT and to the approximation of the Abel integral: it decreases according to N 2 up to N 10 3 and then starts increasing according to O ( N ) , as in the case of smooth functions. From the comparison with the plot of the maximum error for smooth functions (triangles), we can also say that it is not necessary to use a large number of points N in the DFT unless the function f ( x ) itself has low regularity.
The computation of N Legendre coefficients c n by ordinary quadrature produces a O ( N 2 ) algorithm. The increment of performances of the algorithm presented here was verified by evaluating the speed of computation at (nearly) the same precision. The results of these tests are illustrated in Figure 1b, where the execution time T (in seconds) is plotted versus the number N of computed Legendre coefficients. The results show a O ( N ) execution time (at least in the N-interval we considered, up to N 5 · 10 5 ) independent of the regularity properties of the input function f ( x ) , confirming the expected great increase in computational speed (asymptotically, with the awaited improvement ratio being proportional to N / log N ). Such an increase in performances will become even more crucial for the efficient evaluation of multivariate Legendre transforms [5] and of spherical harmonic expansions [35], which will be the subject of a forthcoming paper.

3. Computation of Legendre Expansions

Let us now move on to consider the dual problem of computing the function f ( x ) from the set of N Legendre coefficients c n . In general, in the complex plane, the domain of convergence of the Legendre expansion (1) is the maximal ellipse with foci at ± 1 within which the function f is analytic [36]. This rather restricted class of functions can be greatly enlarged when we limit ourselves to consider convergence issues on the segment x [ 1 , 1 ] . In Ref. [37], W. H. Young showed the tight connection between Legendre series and Fourier series when x ( 1 , 1 ) . In particular, he proved that in any internal closed interval of ( 1 , 1 ) , the Legendre series (1) behaves, with respect to convergence (uniform or otherwise), divergence, and oscillation, exactly as the Fourier series of f ( cos u ) , where x = cos u , assuming that the coefficients c n of Series (1) are such that
n 1 2 c n 0 for n ,
the latter being the natural necessary condition for the convergence of Series (1). More explicitly, E. W. Hobson [38] provided a test of convergence, stating that if the condition
1 1 ( 1 x 2 ) 1 4 | f ( x ) | d x <
is satisfied (the latter condition being equivalent to require that f ( cos u ) sin u be integrable on u [ 0 , π ] ), then Series (1) is convergent for any x ( 1 , 1 ) near which f is of a bounded variation. Since the points x = ± 1 are singular points of Legendre’s equation, the convergence at the end points of the interval requires somehow more stringent (than in the Fourier case) conditions, such as, e.g., f ( x ) being of bounded variation over the entire interval [ 1 , 1 ] .
This parallelism between Legendre and Fourier expansions has already been exploited in the previous section, where we proved that the (normalized) Legendre coefficients of f ( x ) coincide with the Fourier coefficients of the function f ^ ( y ) . In the next two subsections, we continue our analysis along this line, and present two algorithms for the computation of values of Legendre expansions.

3.1. An Algorithm for the Evaluation of Legendre Series

In the theorem that follows, we will prove that a Legendre expansion can be computed by calculating the (inverse) cosine transform of a sequence, which is obtained by a suitable linear transformation of the set of Legendre coefficients c n .
Theorem 2.
Assume that f ( x ) is such that the Legendre expansion (1) and the Fourier expansion of f ( cos u ) converge uniformly on x [ 1 , 1 ] and u [ 0 , π ] , respectively. Then, for u [ 0 , π ] , f ( cos u ) can be represented as
f ( cos u ) = φ 0 2 + m = 1 + φ m cos m u ,
with the coefficients φ m ( m = 0 , 1 , 2 , ) being given by
φ m = n = 0 + k m , n c n , ( m = 0 , 1 , 2 , ) ,
where c n denotes the Legendre coefficients of f ( x ) (see (3)) and
k m , n = 2 π 0 π P n ( cos u ) cos ( m u ) d u , ( m , n = 0 , 1 , 2 , ) .
Proof. 
Since f ( x ) is compactly supported on x [ 1 , 1 ] , the function f ( cos u ) ( u [ 0 , π ] ) is a 2 π -periodic function of u. Hence, the latter can be represented as the Fourier series,
f ( cos u ) = 1 2 π n = + f n e i n u , ( u [ 0 , π ] ) .
For the uniform convergence of the two series, we have from (1) and (14)
1 2 π n = + f n e i n u = n = 0 + c n P n ( cos u ) ,
so that, multiplying both sides of (15) by e i m u and integrating on u [ π , π ] , we have
n = + f n 1 2 π π π e i ( m n ) u d u = n = 0 + c n π π P n ( cos u ) e i m u d u .
The term in the parentheses on the l.h.s. of (16) is the integral representation of the Kronecker delta δ m , n . Then, from (16), we have
φ m f m π = n = 0 + 2 π 0 π P n ( cos u ) cos ( m u ) d u c n = n = 0 + k m , n c n ,
with k m , n defined in (13). Finally, Expansion (12) follows readily by observing that φ m = φ m . □
It is worth remarking that the linear transformation K { k m , n } m , n = 0 , which connects the Legendre coefficients of f ( x ) with the Fourier coefficients of f ( cos u ) , is independent of f ( x ) . Thus, it can be pre-computed with arbitrary precision and can be regarded as known. In the next proposition, some known facts on the structure of the matrix K are listed, along with the analytic expression of its entries as smooth functions of the indexes (see Ref. [10]) and an iterative procedure for computing its elements.
Proposition 1.
(i) The coefficients k m , n (defined in (13)) can be written as follows:
k m , n = 2 π 1 1 P n ( x ) T n ( x ) d x 1 x 2 ,
with T n ( · ) denoting the Chebyshev polynomials of the first kind.
(ii) The matrix K is upper triangular, and its entries k m , n can be computed as follows:
k m , n = 1 π Λ n 2 2 , for m = 0 and n m with n even , 2 π Λ n m 2 Λ n + m 2 , if 0 < m n and ( n + m ) is even , 0 , otherwise ,
where
Λ ( z ) Γ ( z + 1 2 ) Γ ( z + 1 ) ,
with Γ ( · ) denoting the Euler gamma function.
(iii) The following recurrence relationship holds for n 1 and 0 m < n :
k m , n = ( n 1 ) ( n m 1 ) n ( m + n ) k m , n 2 + m ( 2 n 1 ) n ( m + n ) k m 1 , n 1 .
(iv) The diagonal elements can be written as follows:
k m , m = 2 j = 1 m 1 1 2 j , ( m = 1 , 2 , ) .
(v) The elements k 0 , 2 n of the first row can be written as follows:
k 0 , 2 n = 2 j = 1 n 1 1 2 j 2 , ( n = 1 , 2 , ) .
Proof. 
Formula (17) follows from Definition (13) by making the substitution cos u x into the integral and recalling the definition of the Chebyshev polynomials of the first kind: T m ( x ) cos ( m arccos x ) , ( m 0 ). Representation (ii) of the coefficients k m , n is well-known, and it is given, e.g., by Alpert and Rokhlin in [10] (Formula (20)) (where the matrix K is there named M). The recurrence relationship in Equation (19) follows from Representation (18) and from the following three-term recurrence relationships holding, respectively, for the Legendre polynomials P n ( x ) and for Chebyshev polynomials T n ( x ) :
n P n ( x ) = ( 2 n 1 ) x P n 1 ( x ) ( n 1 ) P n 2 ( x ) , ( n 2 ) , P 0 ( x ) = 1 and P 1 ( x ) = x ,
and
1 1 T n ( x ) = 2 x T n 1 ( x ) T n 2 ( x ) , ( n 2 ) , T 0 ( x ) = 1 and T 1 ( x ) = x .
Finally, Point (iv) is obtained by putting n = m into (20), and, similarly, Point (v) follows by putting m = 0 into Relationship (20). □
The algorithmic prescription provided by Theorem 2 for the computation of the values of a (truncated) Legendre expansion is indeed very simple. It consists of a two-step procedure:
  • From the N-vector c = ( c 0 , c 1 , , c N 1 ) T of Legendre coefficients, compute the N-vector φ = ( φ 0 , φ 1 , , φ N 1 ) T by φ = K N c , where the (known) upper triangular matrix K N = { k m , n } m , n = 0 N 1 is defined in (13) (see also Proposition 1);
  • Compute the cosine transform of length N of the vector φ to obtain values of f ( cos u ) at N selected points of the interval u [ 0 , π ] .
The second step of the algorithm presents no difficulties. It is fast since it can be implemented by a single FFT of length N, which requires O ( N log N ) operations. The standard FFT procedure provides an output on a uniform grid { u n } n = 0 N 1 of [ 0 , π ] , so that, according to Formula (12), the final result consists of the set of function values { f ( cos u n ) } n = 0 N 1 at Chebyshev points.
The first step of the algorithm instead presents some aspects that deserve a few comments. The crux is that the matrix K N is dense, and the direct calculation of the matrix–vector product K N c requires O ( N 2 ) operations (precisely, N ( N + 2 ) 4 multiplications). Therefore, this step can become a bottleneck for the algorithm when N becomes large. In some practical cases, the question is not critical, e.g., when the triangular structure of K N can be exploited on some computer architectures (e.g., vector machines or parallel GPU) to significantly decrease the complexity of the computation. Nevertheless, the reduction in the algorithmic complexity remains an issue. Approximate methods are the only tools to effectively handle the fast computation of the matrix–vector product when the matrix is not structured (e.g., when its entries depend only on O ( N ) parameters). The key to many of these fast methods is renouncing exactness and accepting the result of the computation within an a priori fixed level of accuracy. This enables using approximations of the kernel K which, combined with a suitable subdivision of the matrix into panels, can enormously reduce the computational cost. Among these algorithms, it is worth citing the celebrated fast multipole methods by L. Greengard and V. Rokhlin for the fast computation of N-body interactions [12,31,39], which are able to reduce the number of operations to O ( N log N ) (or even less, to O ( N ) , when the matrix has structure).
The specific problem we are dealing with here, that is, the fast computation of the matrix–vector product K N c (where { k m , n } m , n = 0 N 1 is given by Formula (17)) has been solved brilliantly by B. Alpert and V. Rokhlin in Ref. [10]. In that paper, the matrix K N is first properly divided in square submatrices, and then, the computation associated with each submatrix is performed efficiently, approximating each entry of the submatrix by its finite Chebyshev expansion. The computational cost brought by a ν × ν submatrix is then reduced from order O ( ν 2 ) of the naive computation to O ( ν log 1 ϵ ) , with ϵ being the fixed precision required in the Chebyshev interpolation of the submatrix entries. This basic building block can thus be assembled to construct an algorithm for the fast computation of the matrix–vector product K N c with a O ( N log N ) order of complexity.

3.2. A Novel Algorithm

In this subsection, we present a novel algorithm for the inversion of the Legendre transform, which somewhat represents the natural dual algorithm of the one presented in Section 2 for the computation of the forward Legendre transform. In the next theorem, it will be proved that a Legendre expansion can be written as the Abel-type transform of a proper Fourier series, whose coefficients are the Legendre coefficients of f ( x ) (cf. Theorem 1).
Theorem 3.
Assume that the Legendre expansion in Equation (1) of f ( x ) converges uniformly on x [ 1 , 1 ] . Then, f ( cos u ) , where u [ 0 , π ] , can be represented as
f ( cos u ) = u π χ ( t ) [ 2 ( cos u cos t ) ] 1 2 d t , ( u [ 0 , π ] ) ,
with the function χ ( t ) being given by
χ ( t ) 2 π n = 0 c n sin ( n + 1 2 ) t , ( t [ 0 , π ] ) ,
and where c n are the Legendre coefficients of f ( x ) (see (3)).
Proof. 
The first step is to show that the Legendre polynomials P n ( cos u ) can be represented by the following integral:
P n ( cos u ) = 2 π u π sin ( n + 1 2 ) t [ 2 ( cos u cos t ) ] 1 2 d t , ( u [ 0 , π ] ) .
Formula (23) is readily derived from the Dirichlet–Murphy Representation (7). First, the domain of integration is divided into two subintervals, [ u , 2 π u ] = [ u , π ] [ π , 2 π u ] , and then, after changing the variable of integration in the second integral t 2 π t , we obtain
P n ( cos u ) = i π u π + π 2 π u e i ( n + 1 2 ) t 2 ( cos u cos t ) 1 2 d t = i π u π e i ( n + 1 2 ) t 2 ( cos u cos t ) 1 2 d t u π e i ( n + 1 2 ) t 2 ( cos u cos t ) 1 2 d t = 2 π u π sin ( n + 1 2 ) t [ 2 ( cos u cos t ) ] 1 2 d t .
Formula (23) can now be plugged into Expansion (1) to obtain, after swapping the sum and integral (which is legitimate for the uniform convergence of (1)),
f ( cos u ) = 2 π n = 0 c n u π sin ( n + 1 2 ) t [ 2 ( cos u cos t ) ] 1 2 d t = u π 2 π n = 0 c n sin ( n + 1 2 ) t [ 2 ( cos u cos t ) ] 1 2 d t ,
which is indeed Formula (21) with χ ( t ) defined by (22). □
Theorem 3 suggests the following algorithm for the calculation of N values of a Legendre expansion.
  • The N-term approximation χ N ( t ) of the function χ ( t ) is computed by using (22) from the input N-vector c = ( c 0 , c 1 , , c N 1 ) T of Legendre coefficients:
    χ N ( t ) 2 π n = 0 N 1 c n sin ( n + 1 2 ) t .
  • The values of the N-term Legendre expansion at points u n ( n 0 )
    f N ( cos u n ) = k = 0 N 1 c k P k ( cos u n ) ( u n [ 0 , π ] ) ,
    are computed by the Abel-type integral (see (21))
    f N ( cos u n ) = u n π χ N ( t ) [ 2 ( cos u n cos t ) ] 1 2 d t ( u n [ 0 , π ] ) .
The first step of the algorithm is fast. The N values { χ N ( t n ) } n = 0 N 1 of the function χ N ( t ) on a regular grid of [ 0 , π ] can be computed in O ( N log N )  time with one FFT.
For what regards the second point of the algorithm, it should first be noted that the choice of the the nodes u n is unconstrained, and hence the approximation f N ( cos u ) can be computed at any set of points u n [ 0 , π ] using Formula (24). Concerning the computation of Integral (24), since the first step of the algorithm yields values of the integrand on a regular grid of t [ 0 , π ] , only quadrature formulae based on equally spaced knots can be implemented.
In general, the computation of f N ( cos u n ) at N points { u n } n = 0 N 1 requires O ( N 2 ) operations since the second step of the algorithm requires O ( N ) operations when all the N known values of the function χ N ( t ) are used for the computation of the integral in (24). However, it is important to note that, for this computation, it is not always necessary to implement a full N-knot quadrature procedure, particularly when N is large. Frequently, the computation with the a priori fixed precision of Integral (24) requires much less (than N) quadrature nodes, with the actual number of nodes depending either on the adopted quadrature algorithm or on the oscillatory behavior of the integrand, which, in turn, depends on the oscillatory characteristics of f ( x ) .
An instance of a suitable quadrature scheme is given in [25,26], where quadrature rules are proposed, which are based on modifications of the trapezoidal rule for integrands with end-point singularities of various types, including singularities of the form x η , | η | < 1 . The convergence rate of these quadrature formulae is proved to be at least κ (that is, the approximation error is of the order of N κ ), where κ denotes the order of the corrected quadrature rule [25,26]. Thus, in these cases, and for an N that is sufficiently large, the algorithm we propose for the evaluation of the Legendre expansion turns out to be particularly favourable since the number of operations in Step (2) of the algorithm is a constant that does not depend on N. Therefore, the algorithm’s complexity is ruled by the O ( N log N ) complexity of the FFT used in Step (1).

4. Conclusions

In summary, we have presented a new and rapid, i.e., O ( N log N ) , algorithm for the computation of Legendre coefficients. The algorithm is very easy to implement and computes the coefficients by employing only one FFT of the Abel-type transform of the input function. The dual problem of evaluating Legendre expansions has also been considered, and two algorithms have been described. In the first algorithm, the values of the expansion at appropriately chosen points of the interval x [ 1 , 1 ] are computed by simply performing a single (inverse) FFT of a sequence of coefficients, which are obtained by a suitable linear transformation of the given set of N Legendre coefficients. The rapid evaluation of the expansion values requires using approximate methods for the rapid calculation of the matrix–vector product. The second algorithm for the calculation of values of Legendre expansions is new and somehow inverts the logical steps of the algorithm we have proposed for the computation of the Legendre coefficients. Thus, the N-term Legendre expansion can be evaluated efficiently (for an N that is sufficiently large) at any point in the interval x [ 1 , 1 ] by computing the Abel transform of a proper Fourier series.

Future Work

The procedures described so far call for a number of natural generalizations to other orthogonal polynomial systems, such as the associated Legendre polynomials and the related spherical harmonics, with the aim of deriving an algorithm for a fast spherical harmonic transform with an analogous flavour to the present paper. Another challange is to go up the Legendre branch of the Askey scheme of hypergeometric orthogonal polynomials and generalize what was discussed in Section 2 to Jacobi polynomials in order to achieve an integral representation of the latter in terms of a composed Abel–Fourier transform.

Funding

This research received no external funding.

Data Availability Statement

Not applicable.

Acknowledgments

The authors heartily acknowledge many illuminating discussions had with their friend and colleague, Giovanni Alberto Viano.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Cheney, C.W. Introduction to Approximation Theory; McGraw-Hill: New York, NY, USA, 1966. [Google Scholar]
  2. Rainville, E.D. Special Functions; MacMillan: New York, NY, USA, 1960. [Google Scholar]
  3. Canuto, C.; Hussaini, M.Y.; Quarteroni, A.; Zang, T.A. Spectral Methods: Fundamentals in Single Domains; Springer: Berlin/Heidelberg, Germany, 2006. [Google Scholar]
  4. Davis, P.; Rabinowitz, P. Methods of Numerical Integration; Academic Press: New York, NY, USA, 1975. [Google Scholar]
  5. Brunner, H.; Iserles, A.; Nørsett, S. The computation of the spectra of highly oscillatory Fredholm integral operators. J. Integral Equations Appl. 2011, 23, 467–519. [Google Scholar] [CrossRef]
  6. Gallagher, N.; Wise, G.; Allen, J. A novel approach for the computation of Legendre polynomial expansions. IEEE Trans. Acoustic Speech Signal Process. 1978, 26, 105–106. [Google Scholar] [CrossRef]
  7. Piessens, R. Algorithm 473, Computation of Legendre series coefficients. Comm. ACM 1974, 17, 25–26. [Google Scholar] [CrossRef]
  8. Delic, G. The Legendre series and a quadrature formula for its coefficients. J. Comp. Phys. 1974, 14, 254–268. [Google Scholar] [CrossRef]
  9. Orszag, S.A. Fast Eigenfunction Transforms. In Science and Computers; Academic Press: New York, NY, USA, 1986; pp. 13–30. [Google Scholar]
  10. Alpert, B.K.; Rokhlin, V. A fast algorithm for the evaluation of Legendre expansions. SIAM J. Sci. Stat. Comput. 1991, 12, 158–179. [Google Scholar] [CrossRef]
  11. O’Neil, M.; Woolfe, F.; Rokhlin, V. An algorithm for the rapid evaluation of special function transforms. Appl. Comput. Harmon. Anal. 2010, 28, 203–226. [Google Scholar] [CrossRef] [Green Version]
  12. Yarvin, N.; Rokhlin, V. An improved fast multipole method for potential fields on the line. SIAM J. Numer. Anal. 1999, 36, 629–666. [Google Scholar] [CrossRef]
  13. Hale, N.; Townsend, A. A fast, simple, and stable Chebyshev-Legendre transform using an asymptotic formula. SIAM J. Sci. Comput. 2014, 36, A148–A167. [Google Scholar] [CrossRef] [Green Version]
  14. Mori, A.; Suda, R.; Sugihara, M. An improvement on Orszag’s fast algorithm for Legendre polynomial transform. Trans. Info. Process. Soc. Japan 1999, 40, 3612–3615. [Google Scholar]
  15. Xiang, S. On fast algorithms for the evaluation of Legendre coefficients. Appl. Math. Lett. 2013, 26, 194–200. [Google Scholar] [CrossRef] [Green Version]
  16. Driscoll, J.R.; Healy, D.M., Jr. Computing Fourier transforms and convolutions on the 2-sphere. Adv. Appl. Math. 1994, 15, 202–250. [Google Scholar] [CrossRef] [Green Version]
  17. Potts, D.; Steidl, G.; Tasche, M. Fast algorithms for discrete polynomial transforms. Math. Comp. 1998, 67, 1577–1590. [Google Scholar] [CrossRef] [Green Version]
  18. Iserles, A. A fast and simple algorithm for the computation of Legendre coefficients. Numer. Math. 2011, 117, 529–553. [Google Scholar] [CrossRef]
  19. Gindikin, S. Abel Transform and Integral Geometry. In The Legacy of Niels Henrik Abel; Landal, O.A., Piene, R., Eds.; Springer: Berlin/Heidelberg, Germany, 2004; pp. 585–596. [Google Scholar]
  20. Abd El-Hamid, H.A.; Rezk, H.M.; Ahmed, A.M.; AlNemer, G.; Zakarya, M.; El Saify, H.A. Dynamic inequalities in quotients with general kernels and measures. J. Funct. Spaces 2020, 2020, 5417084. [Google Scholar] [CrossRef]
  21. Ahmed, A.M.; Saker, S.H.; Kenawy, M.R.; Rezk, H.M. Lower bounds on a generalization of Cesaro operator on time scales. Dyn. Contin. Discrete Impuls. Syst. A Math. Anal. 2021, 28, 345–355. [Google Scholar]
  22. Erdélyi, A.; Magnus, W.; Oberhettinger, F.; Tricomi, F.G. (Eds.) Higher Transcendental Functions. In Bateman Manuscript Project; McGraw-Hill: New York, NY, USA, 1953; Volume 2. [Google Scholar]
  23. Vilenkin, N.I. Special Functions and the Theory of Group Representations; American Mathematical Society: Providence, RI, USA, 1968; Volume 22. [Google Scholar]
  24. Monegato, G.; Scuderi, L. Numerical integration of functions with boundary singularities. J. Comp. Appl. Math. 1999, 112, 201–214. [Google Scholar] [CrossRef] [Green Version]
  25. Alpert, B.K. High-order quadratures for integral operators with singular kernels. J. Comp. Appl. Math. 1995, 60, 367–378. [Google Scholar] [CrossRef] [Green Version]
  26. Rokhlin, V. End-point corrected trapezoidal quadrature rules for singular functions. Comput. Math. Appl. 1990, 20, 51–62. [Google Scholar] [CrossRef] [Green Version]
  27. Novak, E. Some Results on the Complexity of Numerical Integration. In Monte Carlo and Quasi-Monte Carlo Methods; Cools, R., Nuyens, D., Eds.; Springer: Cham, Switzerland, 2016; Volume 36. [Google Scholar]
  28. Calvetti, D. A stochastic roundoff error analysis for the fast Fourier transform. Math. Comp. 1991, 56, 755–774. [Google Scholar] [CrossRef]
  29. Kaneko, T.; Liu, B. Accumulation of round-off error in Fast Fourier Transforms. J. Assoc. Comp. Mach. 1970, 17, 637–654. [Google Scholar] [CrossRef]
  30. Song, J.; Mingotti, A.; Zhang, J.; Peretto, L.; Wen, H. Accurate damping factor and frequency estimation for damped real-valued sinusoidal signals. IEEE Trans. Instrum. and Meas. 2022, 71, 1–4. [Google Scholar] [CrossRef]
  31. Greengard, L. The Rapid Evaluation of Potential Fields in Particle Systems; MIT Press: Cambridge, MA, USA, 1988. [Google Scholar]
  32. Gorenflo, R.; Vessella, S. Abel Integral Equations. In Lecture Notes in Math; Springer: Berlin/Heidelberg, Germany, 1991; Volume 1461. [Google Scholar]
  33. Galassi, M. GNU Scientific Library Reference Manual, 3rd ed.; Network Theory Ltd.: London, UK, 2009; ISBN 0954612078. [Google Scholar]
  34. Mathematica, Version 12.0; Software For Technical Computation; Wolfram Research, Inc.: Champaign, IL, USA, 2019.
  35. Mohlenkamp, M.J. A fast transform for spherical harmonics. J. Fourier Anal. Appl. 1999, 5, 159–184. [Google Scholar] [CrossRef]
  36. Hille, E. On the absolute convergence of polynomial series. Amer. Math. Monthly 1938, 45, 220–226. [Google Scholar] [CrossRef]
  37. Young, W.H. On the connexion between Legendre series and Fourier series. Proc. Lond. Math. Soc. 1920, 18, 141–162. [Google Scholar] [CrossRef]
  38. Hobson, E.W. The Theory of Spherical and Ellipsoidal Harmonics; Cambridge University Press: Cambridge, UK, 1931. [Google Scholar]
  39. Greengard, L.; Rokhlin, V. A fast algorithm for particle simulations. J. Comp. Phys. 1987, 73, 325–348. [Google Scholar] [CrossRef]
Figure 1. (a) Maximum error E max ( N ) = max n [ 0 , N 1 ] E n versus the number N of computed Lagendre coefficients. The filled dots ( ) refer to the function f 1 ( x ) , the asterisks ( * ) refer to f 2 ( x ) , and the filled triangles ( ) refer to f 3 ( x ) (see text). (b) Execution time T versus N. The O ( N 2 ) line is plotted just for reference.
Figure 1. (a) Maximum error E max ( N ) = max n [ 0 , N 1 ] E n versus the number N of computed Lagendre coefficients. The filled dots ( ) refer to the function f 1 ( x ) , the asterisks ( * ) refer to f 2 ( x ) , and the filled triangles ( ) refer to f 3 ( x ) (see text). (b) Execution time T versus N. The O ( N 2 ) line is plotted just for reference.
Symmetry 15 01282 g001
Table 1. Absolute error E n of the computed Legendre coefficients c n for four different functions with different degrees of smoothness (see text). The reference “exact” values of c n were computed with 30 significant figures by standard quadrature with Mathematica [34].
Table 1. Absolute error E n of the computed Legendre coefficients c n for four different functions with different degrees of smoothness (see text). The reference “exact” values of c n were computed with 30 significant figures by standard quadrature with Mathematica [34].
n E n [ f 1 ] E n [ f 2 ] E n [ f 3 ] E n [ f 4 ]
08.15 6 7.51 11 1.11 16 3.33 16
12.98 6 1.44 10 3.33 15 5.55 17
23.12 5 1.86 12 3.88 15 1.97 15
35.43 5 9.20 11 3.39 15 2.87 15
43.41 5 1.07 10 4.72 15 3.36 15
52.53 5 1.30 10 5.47 15 1.58 15
69.28 5 1.14 10 4.50 15 1.96 15
71.09 4 9.75 11 4.22 15 2.54 15
81.99 5 4.29 10 3.18 15 2.63 15
91.27 4 6.10 10 3.94 15 2.90 15
101.87 4 5.74 10 1.65 15 2.93 15
117.50 5 4.45 10 1.54 15 9.71 16
121.16 4 1.79 10 1.94 15 2.04 15
132.20 4 3.32 10 3.60 15 1.67 15
141.56 4 8.43 10 7.36 16 2.37 15
152.75 5 9.81 10 4.18 15 2.06 15
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

De Micheli, E. Legendre Series Analysis and Computation via Composed Abel–Fourier Transform. Symmetry 2023, 15, 1282. https://doi.org/10.3390/sym15061282

AMA Style

De Micheli E. Legendre Series Analysis and Computation via Composed Abel–Fourier Transform. Symmetry. 2023; 15(6):1282. https://doi.org/10.3390/sym15061282

Chicago/Turabian Style

De Micheli, Enrico. 2023. "Legendre Series Analysis and Computation via Composed Abel–Fourier Transform" Symmetry 15, no. 6: 1282. https://doi.org/10.3390/sym15061282

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop