<<

arXiv:2001.01985v3 [math.NA] 31 Dec 2020 nlplnmaswihhv enetnieyue nmn rnhso funct branches special many quadrature, in Gauss-type used as extensively such computing been sequences entific have important most which the polynomials of onal one are polynomials Legendre The Introduction 1 projection ahmtc ujc lsicto (2010) Classification Subject functions ftefiieeeetmto n pcrlmtosfrdifferential for methods spectral and method element finite the of ftesm ereb atrof factor a by degree same the of yol oecntn atr.Orrslspoiesm e insigh Keywords p new Legendre projections. some Legendre provide the results of than power Our better factors. approximation is constant approximation some only best smoothne by the fractional that of show functions we and functions analytic piecewise est fSineadTcnlg,Whn407,P .China R. P. 430074, Wuhan Scientific Technology, and and Modeling Science Engineering of versity of Laboratory Key Hubei University [email protected] Huazhong China. E-mail: Statistics, R. P. and 430074, Wuhan Mathematics of School Foundat Wang Haiyong Science Natural National by 11671160. supported number was work This b the that show we functions, differen analytic degree For and of norm. approximation analytic maximum polynomial for optim the projections derive in Legendre and tions of projections convergence Chebyshev and of Legendre and imations Abstract date Accepted: / date Received: Wang Haiyong polynomial projection? best Legendre the than converge does approximation faster much How wl eisre yteeditor) the by inserted be (will No. manuscript Noname · ecmaetecnegnebhvo fbs oyoilapprox- polynomial best of behavior convergence the compare We pia aeo convergence of rate optimal eedeprojection Legendre · etplnma approximation polynomial best n n 1 / 2 sbte hnteLgnr projection Legendre the than better is o ieetal ucin uhas such functions differentiable For . · nltcfunctions analytic 41A25 . fSineadTechnology, and Science of optn,Hahn Uni- Huazhong Computing, o fCiaudrgrant under China of ion · 41A10 · differentiable ions, · n integral and s however, ss, ibefunc- tiable Chebyshev sit the into ts forthog- of p rojection -version lrates al sci- f est 2 Haiyong Wang

equations (see, e.g., [6,9,11,13,14,21,24,25,27]). Among these applications, Legendre polynomials are particularly appealing owing to their superior prop- erties: (i) they have excellent error properties in the approximation of a glob- ally smooth function; (ii) quadrature rules based on their zeros or extrema are optimal in the sense of maximizing the exactness of integrated polynomials; (iii) they are orthogonal with respect to the uniform weight function ω(x)=1 which makes them preferable in Galerkin methods for PDEs. Let n 0 be an integer and let P (x) denote the Legendre polynomial of ≥ n degree n which is normalized by Pn(1) = 1. The sequence of Legendre poly- nomials Pn(x) forms a system of polynomials orthogonal over Ω = [ 1, 1] and { } − 1 2 P (x)P (x)dx = δ , (1) n m 2n +1 mn Z−1

where δmn is the Kronecker delta [20, p. 14]. Given a real-valued function f(x) which belongs to a Lipschitz class of order larger than 1/2 on Ω, then it has the following uniformly convergent Legendre series expansion [26]

∞ 1 1 f(x)= akPk(x), ak = k + f(x)Pk(x)dx. (2) 2 −1 Xk=0   Z Let (f) denote the truncated Legendre expansion of degree n, i.e., Pn n (f)= a P (x). (3) Pn k k Xk=0 which is also known as the Legendre projection. It is well known that this polynomial is the best polynomial approximation to f(x) in the L2 norm with respect to the Legendre weight ω(x) = 1. The computation of the first n +1 n Legendre coefficients ak k=0 has received much attention over the past decade and fast algorithms have{ } been developed in [2,15] that require only O(n log n) operations and in [29] that require O(n log2 n) operations. Besides Legendre polynomials, another widely used sequence of orthogo- nal polynomials is the , i.e., Tk(x) = cos(k arccos(x)). Suppose that f(x) is Dini-Lipschitz continuous on Ω, then it has the following uniformly convergent Chebyshev series [18, Theorem 5.7]

∞ 1 ′ 2 f(x)Tk(x) f(x)= ckTk(x), ck = dx, (4) 2 π −1 √1 x kX=0 Z −

where the prime indicates that the first term of the sum is halved. Let n(f) denote the truncated Chebyshev expansion of degree n, i.e., T

n (f)= a T (x), (5) Tn k k Xk=0 How much faster does the best approximation converge than Legendre 3

which is also known as the Chebyshev projection. It is well known that n(f) is the best polynomial approximation to f(x) in the L2 norm with respectT to the Chebyshev weight ω(x) = (1 x2)−1/2 and the first n + 1 Chebyshev n − coefficients ck k=0 can be evaluated efficiently by making use of the FFT in only O(n log{n)} operations (see, e.g., [18, Section 5.2.2]). Let n(f) denote the best approximation polynomial of degree n to f on Ω = [ 1B, 1] in the maximum norm, i.e., −

f n(f) ∞ = min f p ∞, k −B k p∈Πn k − k

where Πn denotes the space of polynomials of degree at most n. If f is contin- uous on Ω, it is well known that n(f) exists and is unique. From the point of view of polynomial approximationB in the maximum norm, it is clear that (f) is more accurate than (f) and (f). However, explicit expressions Bn Pn Tn for n(f) are generally impossible to obtain since the dependence of n(f) on f isB nonlinear and Remez-type algorithms, which are realized by iterativB e pro- cedures, have been developed for computing n(f) (see, e.g., [30, Chapter 10]). Although algorithms are available, they areB still time-consuming when n is in the thousands or higher. Obviously, this leads us to face an inevitable dilemma of whether the increase in accuracy is sufficient to justify the extra cost of com- puting n(f). WithB these three approaches, a natural question is: How much better is the accuracy of n(f) than n(f) and n(f) in the maximum norm? For the case of (f) whereB f C(Ω),T it has beenP shown in [22, Theorem 2.2] that the Tn ∈ maximum error of n(f) is inferior to that of n(f) by at most a logarithmic factor, i.e., T B 4 f (f) log n +4 f (f) . (6) k − Tn k∞ ≤ π2 k −Bn k∞  

For the case of n(f), it has been widely reported that the maximum error of P 1/2 n(f) is inferior to that of n(f) by at most a factor of n (see, e.g., [19,31, P33,35]). We summarize hereB existing results from two perspectives: – For f C(Ω), it is well known that ∈ f (f) (1 + Λ ) f (f) , (7) k −Pn k∞ ≤ n k −Bn k∞

where Λn = supf6=0 n(f) ∞/ f ∞ is the Lebesgue constant of n(f). Furthermore, Qu andkP Wongk in [19,k k Equation (1.10)] showed that P

1 3/2 n +1 (1,0) 2 1/2 Λn = Pn (x) dx = n + O(1), 2 −1 √π Z (1,0) where Pn (x) is the Jacobi polynomial of degree n with α = 1 and β =0 and α, β are the parameters in . Hence we can conclude that the rate of convergence of n(f) is slower than that of n(f) by a factor of n1/2. P B 4 Haiyong Wang

– Under the assumption that f,f ′,...,f (m−1) are absolutely continuous, f (m) is of bounded variation and f (m) < where m 1 is an in- k kT ∞ ≥ teger and T denotes some weighted semi-norm. It has been shown in k·k −m−1/2 [31,33] that the Legendre coefficients of f satisfy ak = O(k ). As a direct consequence we obtain | |

∞ f (f) a = O(n−m+1/2), (8) k −Pn k∞ ≤ | k| k=Xn+1

where we have used the inequality Pk(x) 1 (see, e.g., [25, p. 94]). | | ≤ −m Notice that the rate of convergence of n(f) for such functions is O(n ) as n [28, Chapter 7]. Again, weB see that the rate of convergence of (f)→ is ∞ slower than that of (f) by a factor of n1/2. Pn Bn Is the rate of convergence of n(f) really slower than n(f) by a factor of n1/2? Let us consider a motivatingP example f(x) = x B, which is absolutely continuous on Ω and its first-order derivative is of bounded| | variation. More- over, it has been shown in [33, Equation (2.11)] that the Legendre coefficients of f satisfy the following sharp bound

−1 4 1 −3/2 ak k = O(k ), (9) | |≤ π(2k 3) − 2 −   where k 2 is even andp a = 0 when k is odd. We now consider the rate ≥ k of convergence of n(f), n(f) and n(f). For n(f) and n(f), it is well know that their ratesB of convergenceT P are O(n−1)B as n T (see, e.g., [30, → ∞ Chapter 7]). For n(f), however, from (7) and (8) we can deduce that the predicted rate ofP convergence of (f) is only O(n−1/2). Unexpectedly, we Pn observed in [33, Figure 3] that the rate of convergence of n(f) is actually −1 P O(n ) as n , which is the same as that of n(f) and n(f). This unex- pected observation→ ∞ suggests that existing resultsB on the rateT of convergence of n(f) may be suboptimal. P In this paper, we aim to investigate the optimal rate of convergence of (f) in the maximum norm. For analytic functions, we show that the optimal Pn rate of convergence of n(f) is indeed slower than that of n(f) and n(f) by a factor of n1/2, althoughP all three approaches converge exponentiallyB T fast. For differentiable functions such as piecewise analytic functions and functions of fractional smoothness, however, we shall improve existing results in (7) and (8) and show that the optimal rate of convergence of n(f) is actually the same as that of (f) and (f), i.e., the accuracy of P(f) is inferior to that Bn Tn Pn of n(f) by only some constant factors. This result appears to be new and of interest.B The rest of this paper is organized as follows. In the next section, we present some experimental observations on the maximum error of n(f) with n(f) and (f). In section 3, we analyze the convergence behaviorP of (fB) for Tn Pn analytic functions. An explicit error bound for n(f) is established and it is optimal in the sense that it can not be improvedP with respect to n. In section 4 How much faster does the best approximation converge than Legendre 5

we analyze the convergence behavior of n(f) for piecewise analytic functions and functions with derivatives of boundedP variation. We extend our discussion to functions of fractional smoothness in section 5 and give some concluding remarks in section 6.

2 Experimental observations

In this section, we present some experimental observations on the comparison of the rate of convergence of n(f), n(f) and n(f). In order to quantify more precisely the difference inT the rateP of convergence,B we define the ratio of the maximum errors of (f) to (f) and (f) as Bn Pn Tn f (f) f (f) P = k −Bn k∞ , T = k −Bn k∞ . (10) Rn f (f) Rn f (f) k −Pn k∞ k − Tn k∞ In our computations, the maximum error of (f) is calculated using the Bn Remez algorithm in Chebfun [10] and the maximum errors of n(f) and n(f) are calculated by using a finer grid in Ω = [ 1, 1]. P T In Figure 1 we show the maximum error− of three approximations as a function of n for the three analytic functions f(x) = exp(x5), ln(1.2+ x), (1 + 4x2)−1 and P scaled by n1/2 and T . From the top row of Figure 1, we see Rn Rn that the rate of convergence of n(f) is almost indistinguishable with that of (f). Moreover, both rates ofB convergence of (f) and (f) are better Tn Bn Tn than that of n(f). From the bottom row of Figure 1, we see that each ratio P scaled byPn1/2 approaches a finite asymptote as n grows, which implies Rn that the rate of convergence of n(f) is faster than that of n(f) by a factor 1/2 B T P of n . On the other hand, each ratio n approaches a finite asymptote as T R n grows (0.6 n 0.7), which implies that n(f) is better than n(f) by only some constant≤ R ≤ factors. B T In Figure 2 we show the maximum error of three approximations as a function of n for the three differentiable functions f(x) = exp( 1/x2), (x 1 3 P T − − 2 )+, sin(5x) and the corresponding ratios n and n . For the first test function,| it is| infinitely differentiable on Ω. ForR the secondR test function, it is a spline function whose definition is given in (46). Moreover, f C2(Ω) and f ′′′ is of bounded variation on Ω. For the last function, it is absolutely∈ continuous and f ′ is of bounded variation on Ω. From the top row of Figure 2 we observe that all three methods n(f), n(f) and n(f) converge at the B T P P T same rate. From the bottom row of Figure 2 we see that each ratio n and n oscillates around or converges to a finite asymptote as n , whichR impliesR → ∞ that n(f) is better than n(f) and n(f) by only some constant factors (for the lastB two functions, noteT that P Pand T approach about 1/2 as n , Rn Rn → ∞ and thus n(f) is better than n(f) and n(f) by a factor of 2). In summary,B the above observationsT suggestP the following conclusions: – For analytic functions, the rate of convergence of (f) is better than that Bn of n(f) by some constant factors and is better than that of n(f) by a factorT of n1/2; P 6 Haiyong Wang

f(x)=exp(x5) f(x)=ln(1.2+x) f(x)=1/(1+4x2) 100 100 100

10-5 10-5 10-5

P (f) P (f) P (f)

Maximum Error n Maximum Error n Maximum Error n T (f) T (f) T (f) -10 n -10 n -10 n 10 B (f) 10 B (f) 10 B (f) n n n

0 5 10 15 20 25 30 0 5 10 15 20 25 30 0 5 10 15 20 25 30 n n n

f(x)=exp(x5) f(x)=ln(1.2+x) f(x)=1/(1+4x2) 2 2 2 n1/2*RP n1/2*RP n1/2*RP n n n RT RT RT n n n 1.5 1.5 1.5

1 1 1

0.5 0.5 0.5

0 0 0 0 5 10 15 20 25 30 0 5 10 15 20 25 30 0 5 10 15 20 25 30 n n n

Fig. 1 Top row shows the log plot of the maximum error of Bn(f), Tn(f) and Pn(f) for f(x) = exp(x5) (left), f(x) = ln(1.2+ x) (middle) and f(x) = 1/(1 + 4x2) (right). Bottom 1/2 P T row shows n Rn and Rn . Here n ranges from 1 to 30.

– For differentiable functions, however, the rate of convergence of n(f) is better than that of (f) and (f) by only some constant factors.B Tn Pn How to explain these observations? Regarding the convergence behavior of n(f), sharp bounds for its maximum error have received much attention in Trecent years. We collect the results in the following. Theorem 1 If f is analytic with f(z) M in the region bounded by the ellipse with foci 1 and major and minor| | ≤semiaxis lengths summing to ρ> 1, then for each n ± 0, ≥ 2M f (f) . (11) k − Tn k∞ ≤ ρn(ρ 1) − If f,f ′,...,f (m−1) are absolutely continuous on Ω = [ 1, 1] and f (m) is of bounded variation V for some integer m 1, then for− each n m +1, m ≥ ≥ 2V f (f) m . (12) k − Tn k∞ ≤ πm(n m)m − Proof We refer to [30, Chapter 8] for the proof of (11) and [30, Chapter 7] for the proof of (12). How much faster does the best approximation converge than Legendre 7

3 2 f(x)=(x-1/2) f(x)=exp(-1/x ) + f(x)=|sin(5x)| 100 100 100

10-5 10-5 10-5

P (f) P (f) P (f)

Maximum Error n Maximum Error n Maximum Error n T (f) T (f) T (f) n n n B (f) B (f) B (f) n n n 10-10 10-10 10-10 100 101 102 100 101 102 100 101 102 n n n

3 2 f(x)=(x-1/2) f(x)=exp(-1/x ) + f(x)=|sin(5x)| 2 2 2 RP RP RP n n n RT RT RT 1.5 n 1.5 n 1.5 n

1 1 1

0.5 0.5 0.5

0 0 0 0 20 40 60 80 100 0 20 40 60 80 100 0 20 40 60 80 100 n n n

Fig. 2 Top row shows the log-log plot of the maximum error of Bn(f), Tn(f) and Pn(f) for 2 1 3 f(x) = exp(−1/x ) (left), f(x) = (x − 2 )+ (middle) and f(x) = | sin(5x)| (right). Bottom P T row shows the corresponding Rn and Rn . Here n ranges from 1 to 100.

A few remarks on Theorem 1 are in order. 2 1 3 Remark 1 Notice that these functions f(x) = exp( 1/x ), (x 2 )+, sin(5x) correspond to m = , m = 3 and m = 1, respectively.− As a consequence,− | we| ∞ −k can deduce from (12) that the rates of convergence of n(f) are O(n ) for any k N, O(n−3) and O(n−1), respectively. On the otherT hand, we can deduce ∈ from [28, Chapter 7] that the rates of convergence of n(f) for these three functions are also O(n−k) for any k N, O(n−3) and BO(n−1), respectively. ∈ Clearly, the rates of convergence of n(f) and n(f) are of the same order, which explain the convergence behaviorT of (fB) observed in Figure 2. For Tn discussions on the comparison of n(f) and n(f) when f is a polynomial of degree larger than n, we refer to [8].B T Remark 2 For differentiable functions, the bound (12) is only optimal for func- tions with interior singularities of integer-order. For functions of fractional smoothness, optimal error estimates of n(f) was recently analyzed in [17] by introducing fractional Sobolev-type spacesT and using the fractional calculus properties of Gegenbauer functions of fractional degree. We refer the inter- ested reader to [17] for more details. In the following sections, we shall focus on the convergence behavior of the Legendre projection (f) for analytic and several typical kinds of differen- Pn 8 Haiyong Wang

tiable functions and present some theoretical results concerning its optimal rate of convergence.

3 Optimal rate of convergence of Pn(f) for analytic functions

In this section we study the optimal rate of convergence of n(f) for analytic functions. Let denote the Bernstein ellipse P Eρ u + u−1 = z C z = , u = ρ 1 , (13) Eρ ∈ 2 | | ≥  

which has the foci at 1 and the major and minor semi-axes are given by (ρ + ρ−1)/2 and (ρ ρ±−1)/2, respectively. − Our starting point is the contour integral expression of the Legendre coef- ficients.

Lemma 1 Suppose that f is analytic in the region bounded by the ellipse ρ for some ρ> 1, then for each k 0, E ≥ Γ (k + 1)Γ ( 1 ) 1 2 f(z) k +1, 2 1 ak = 2F1 ; dz, 1 2 k+1 3 2 2 Γ (k + )iπ E (z √z 1) k + (z √z 1) 2 I ρ ± −  2 ± −  (14) where the sign in z √z2 1 is chosen so that z √z2 1 > 1 and Γ (z) is ± − | ± − | the gamma function. Here 2F1( ) is the Gauss defined by · ∞ k a,b (a)k(b)k z 2F1 ; z = , c (c)k k!   kX=0 where z < 1 and c = 0, 1, 2,..., and (z)k is the Pochhammer symbol defined| by| (z) =1 and6 (z) − =− (z) (z + k) for k 0. 0 k+1 k ≥ Proof This contour integral was first derived by Iserles in [15] for the purpose n of designing some fast algorithms for computing ak k=0. The idea of his { } (j) derivation is based on writing ak as a linear combination of f (0) and then as an integral transform with a Gauss hypergeometric function{ as}its kernel. After that, a hypergeometric transformation was used to replace the original kernel by a new one that converges rapidly, which finally leads to (14). More recently, a new and simpler approach for the derivation of (14) was proposed in [32] and the idea is simply to rearrange the Chebyshev coefficients of the second kind. We refer the interested reader to [15,32] for more details.

In the following, we state some new upper bounds for the Legendre co- efficients, which are simpler but slightly less sharp than the result stated in [32]. As will be shown later, these new bounds allow us to establish a new and explicit error bound for the Legendre projection (f). Pn How much faster does the best approximation converge than Legendre 9

Lemma 2 Suppose that f is analytic in the region bounded by the ellipse ρ for some ρ> 1, then for each k 0, E ≥ D(ρ) k1/2 a , a D(ρ) , k 1, (15) | 0|≤ 2 | k|≤ ρk ≥ where D(ρ) is defined by

2L( ) D(ρ)= Eρ max f(z) . (16) π ρ2 1 z∈Eρ | | − Here L( ) denotes the length of thep circumference of . Eρ Eρ Proof From Lemma 1, we immediately obtain

Γ (k + 1)Γ ( 1 ) 1 2 k +1, 2 1 L( ρ) ak 1 2F1 3 ; 2 kE+1 max f(z) . (17) | |≤ Γ (k + )π k + ρ ρ z∈Eρ | | 2  2  Furthermore, for each k 0 and ρ> 1, we have ≥ k +1, 1 1 k + 3 , 1 1 1 1 F 2 ; F 2 2 ; = F 2 ; 2 1 k + 3 ρ2 ≤ 2 1 k + 3 ρ2 1 0 ρ2  2   2    1 −1/2 = 1 . (18) − ρ2  

Combining (17) and (18), the bound for a0 follows immediately. We now consider the case k 1. To establish an explicit| | bound for the ratio of gamma functions in (17), we≥ define the following sequence

1 Γ (k + 1)Γ ( 2 ) −1/2 ψ(k)= 1 k . Γ (k + 2 ) It can be easily shown that the sequence ψ(k) is strictly decreasing. Hence, we obtain { }

1 Γ (k + 1)Γ ( 2 ) 1/2 ψ(k) ψ(1) = 2 1 2k . (19) ≤ ⇒ Γ (k + 2 ) ≤ Combining (17), (18) and (19) gives the desired result. This completes the proof.

Remark 3 Sharp bounds for the Legendre coefficients of analytic functions were studied in [31,32,35,37] with different approaches. The new bound (15) is slightly less sharp than the latest result stated in [32, Corollary 4.5] by a factor of up to 2/π1/2( 1.13) since we have established a uniform bound for ψ(k) in (19). However,≈ the factor D(ρ) in (16) is independent of k, which is more convenient when applying (15) to refine a simple error bound of n(f), as will be shown below. P 10 Haiyong Wang

Remark 4 The length of the circumference of ρ is given by L( ρ)=4E(ε)/ε, where ε =2/(ρ + ρ−1) and E(z) is the completeE elliptic integralE of the second kind (see, e.g., [20, Equation (19.9.9)]). For various approximation formulas of L( ρ), we refer to the survey article [1] for an extensive discussion. Moreover, sharpE bounds of L( ) are also available (see, e.g., [16]), i.e., Eρ 1 π 1 L( ) 2 ρ + +2 1 ρ , ρ 1, (20) Eρ ≤ ρ 2 − − ρ ≥       and the above inequality becomes an equality when ρ =1 or ρ . → ∞ With the above Lemma at hand, we are now able to establish an explicit ∞ error bound for the Legendre projection n(f) in the L norm. Moreover, we show that the derived error bound is optimalP up to a constant factor.

Theorem 2 Suppose that f is analytic in the region bounded by the ellipse ρ for some ρ> 1. Then, for each n 0, E ≥ D(ρ) (n + 1)1/2 (n + 1)−1/2 f (f) + . (21) k −Pn k∞ ≤ ρn ρ 1 (ρ 1)2  − −  Up to a constant factor, the bound on the right hand side is optimal in the sense that it can not be improved in any negative powers of n further.

Proof As a consequence of Lemma 2, we obtain that

∞ ∞ k1/2 f (f) a D(ρ) . (22) k −Pn k∞ ≤ | k|≤ ρk k=Xn+1 k=Xn+1 For the last sum in (22), we have

∞ ∞ k1/2 k 1 (n + 1)1/2 (n + 1)−1/2 (n + 1)−1/2 = + . ρk ≤ ρk ρn ρ 1 (ρ 1)2 k=Xn+1 k=Xn+1  − −  This proves the bound (21). We now turn to prove the optimality of the bound (21). By contradiction suppose that it can be further improved in a negative power of n, i.e.,

D(ρ) (n + 1)1/2 (n + 1)−1/2 f (f) n−γ + , (23) k −Pn k∞ ≤ ρn ρ 1 (ρ 1)2  − −  where γ > 0. Let us consider a concrete function, e.g., f(x) = (x 2)−1. It is easily seen that this function has a simple pole at x = 2 and therefore− ρ 2+ √3 ǫ, where ǫ > 0 may be taken arbitrary small. On the other hand,≤ using Lemma− 1 and the residue theorem, we can write the Legendre coefficients of f(x) as

Γ (k + 1)Γ ( 1 ) 1 2 k +1, 2 1 ( 2) ak = 2F1 ; − . (24) Γ (k + 1 ) k + 3 √ 2 √ k+1 2  2 (2 + 3)  (2 + 3) How much faster does the best approximation converge than Legendre 11

∞ Clearly, ak < 0 for all k 0, and it is easy to check that the sequence ak k=0 is strictly decreasing. Now,≥ we consider the error of the Legendre projection{− } at the point x =1. In view of P (1) = 1 for k 0, we obtain that k ≥

∞ f(x) (f) = ( a ) a . | −Pn |x=1 − k ≥− n+1 k=Xn+1

Thus, combining the above bound with (23) yields

D(ρ) (n + 1)1/2 (n + 1)−1/2 a f(x) (f) n−γ + . (25) − n+1 ≤k −Pn k∞ ≤ ρn ρ 1 (ρ 1)2  − −  Furthermore, from (24) we can deduce that the lower bound of f(x) 1/2 −n k − n(f) ∞ behaves like an+1 = O(n (2 + √3) ) and the upper bound of P k | | 1/2−γ −n f(x) n(f) ∞ behaves like O(n (2 + √3 ǫ) ) as n . Clearly, kthis leads−P to ank obvious contradiction since the upper− bound may→ ∞ be smaller than the lower bound when ǫ is sufficiently small. Therefore, we can conclude that the derived bound (21) is optimal in the sense that it can not be improved in any negative powers of n further. This completes the proof.

Remark 5 From [7, p. 131] we know that

∞ π max ck f n(f) ∞ ck . (26) 4 k≥n {| |} ≤ k −B k ≤ | | k=Xn+1

−k Moreover, from [4, p. 95] we know that ck 2maxz∈Eρ f(z) ρ , and thus −|n | ≤ | | the rate of convergence of n(f) is O(ρ ) as n , i.e., f n(f) ∞ = O(ρ−n). Comparing this withB (21), it is easy to see→ that ∞ the ratek of−B converkgence 1/2 of n(f) is O(n ) faster than that of n(f). Moreover, comparing (21) and (11),B we see that the rate of convergenceP of (f) is also O(n1/2) faster than Tn that of n(f). These explain the convergence behavior of n(f), n(f) and (f) illustratedP in Figure 1. P T Bn

4 Optimal rate of convergence of Pn(f) for functions with derivatives of bounded variation

In this section we study optimal rate of convergence of n(f) for differentiable functions with derivatives of bounded variation. WeP start with the case of piecewise analytic functions and then extend our discussion to the case of functions whose mth order derivative is of bounded variation. Throughout this paper, we denote by K a generic positive constant independent of n. 12 Haiyong Wang

4.1 Piecewise analytic functions

We first introduce the definition of piecewise analytic function (see, e.g., [23]). Definition 1 Let f be a piecewise analytic function, by which we mean there exist a set of points 1 < ξ < ξ < < ξ < 1, ℓ 1, − 1 2 ··· ℓ ≥ such that the restriction of f to each [ 1, ξ1],[ξ1, ξ2],...,[ξℓ, 1] has an analytic continuation to a neighborhood of this− closed interval, but f itself is not an- alytic at each point ξ1,...,ξℓ. In the following discussion, we will denote by T ℓ T PA(Ω, ξ~), where ξ~ = (ξ1,...,ξℓ) R and denotes the transpose, the set of piecewise analytic functions for∈ notational· simplicity.

In order to analyze the convergence behavior of n(f), we first rewrite it as P n 1 1 1 n(f)= Pk(x) k + f(y)Pk(y)dy = f(y)Dn(x, y)dy, (27) P 2 −1 −1 kX=0   Z Z where Dn(x, y) is the Dirichlet kernel of Legendre polynomials defined by n 1 D (x, y)= k + P (x)P (y). (28) n 2 k k kX=0   By means of the Christoffel-Darboux identity for Legendre polynomials [25, p. 51], the Dirichlet kernel can also be written as n +1 P (x)P (y) P (y)P (x) D (x, y)= n+1 n − n+1 n . (29) n 2 x y  −  In the following we give two useful lemmas. Lemma 3 For x 1 and n 0, we have | |≤ ≥ 2 1 −1/2 P (x) n + φ (x), (30) | n |≤ π 2 n r   where π 1 1/2 φ (x) = min (1 x2)−1/4, n + . (31) n − 2 2 ( r   ) Proof Recall the Bernstein-type inequality of Legendre polynomials [3], i.e.,

2 1 −1/2 (1 x2)1/4 P (x) < n + , x [ 1, 1], − | n | π 2 ∈ − r   and the bound is optimal in the sense that the factor (n +1/2)−1/2 can not be improved to (n +1/2+ ǫ)−1/2 for any ǫ > 0 and the constant 2/π is best possible. On the other hand, recall the well known inequality P (x) 1. np Combining these two inequalities give the desired result. | |≤ How much faster does the best approximation converge than Legendre 13

Lemma 4 Let x 1 and let δ (0, 1). | |≤ ∈ 1. If y 1, then | |≤ (n + 1)2 D (x, y) . (32) | n |≤ 2 2. If y 1 δ, then | |≤ − D (x, y) Kn, n 1. (33) | n |≤ ≫ Proof As for (32), it follows from (28) and the inequality Pk(x) 1. As for (33), we split our discussion into two cases: x y < δ/2 or| x |y ≤ δ/2. In the case when x y < δ/2. By (28) and Lemma| − | 3 we obtain| that− |≥ | − | n 2 2(n + 1) D (x, y) φ (x)φ (y) (1 x2)−1/4(1 y2)−1/4. (34) | n |≤ π k k ≤ π − − kX=0 For y 1 δ, it is easily verified that x 1 δ/2, and therefore, | |≤ − | |≤ − −1/4 2(n + 1) δ 2 D (x, y) 1 1 (1 (1 δ)2)−1/4 | n |≤ π − − 2 − −   ! 2(n + 1) δ −1/4 = δ−1/2 1 (2 δ)−1/4 π − 4 −   = O(n). (35) Next, we consider the case x y δ/2. From (29) and Lemma 3 it follows that | − | ≥ n +1 2 1 −1/2 3 −1/2 D (x, y) n + φ (y)+ n + φ (y) . | n |≤ δ π 2 n 2 n+1 r     ! 2(n + 1) 2 1 −1/2 n + (1 y2)−1/4 ≤ δ π 2 − r   2 2 1 −1/2 (2 δ)−1/4(n + 1) n + ≤ δ5/4 π − 2 r   = O(n1/2). (36) Finally, the desired result (33) follows from (35) and (36). This completes the proof. We are now ready to state the first main result of this section. Theorem 3 Assume that f Cm−1(Ω) PA(Ω, ξ~) for some integer m N ∈ ∩ ∈ and some ξ~ Rℓ with ℓ 1. Then, for n 1, we have ∈ ≥ ≫ f (f) Kn−m. (37) k −Pn k∞ ≤ Up to constant factors, the bound on the right hand side is optimal in the sense that it is the same as that of (f). Bn 14 Haiyong Wang

Proof Since f Cm−1(Ω) and is piecewise analytic on Ω, we know from [23, ∈ Theorem 3] that there exists a polynomial pn of degree n such that for all x Ω ∈ C α β f(x) p (x) e−cn d(x) , (38) | − n |≤ nm where α (0, 1) and β α or α = 1 and β > 1, d(x) = min1≤k≤ℓ x ξk and C,c are∈ some positive≥ constants. Taking α = β (0, 1) and recalling| − that| ∈ n(f) f whenever f is a polynomial of degree up to n, we immediately Pobtain ≡

f (f) f p + (f p ) | −Pn | ≤ | − n| |Pn − n | 1 C α C α e−c(nd(x)) + e−c(nd(y)) D (x, y) dy, (39) ≤ nm nm | n | Z−1 where we have used (38) and (27) in the last step. It remains to show the last integral in (39) behaves like O(1) as n . For simplicity of presentation, we denote it by I. Moreover, we let I =→ [ξ ∞ ǫ, ξ + ǫ],...,I = [ξ ǫ, ξ + ǫ], 1 1 − 1 ℓ ℓ − ℓ where ǫ> 0 is chosen to be small enough so that these subintervals I1,...,Iℓ are pairwise disjoint and are contained in the interior of Ω, i.e., I1,...,Iℓ Ω. Then ⊂

ℓ −c(nd(y))α −c(nd(y))α I = e Dn(x, y) dy + e Dn(x, y) dy. | | Ω Sℓ | | k=1 ZIk Z \ k=1 Ik X (40)

For the former sum in (40), notice that d(y)= y ξk when y Ik, and thus we get | − | ∈

ℓ ℓ ξk +ǫ α α −c(nd(y)) −c(n|y−ξk|) e Dn(x, y) dy = e Dn(x, y) dy Ik | | ξk −ǫ | | kX=1 Z Xk=1 Z ℓ ǫ −c(n|t|)α = e Dn(x, t + ξk) dt, −ǫ | | Xk=1 Z

where we applied the change of variable y = t+ξk in the last step. Furthermore, using (33) and a change of variable z = nt, we obtain

ℓ ǫ α α e−c(nd(y)) D (x, y) dy 2Kℓn e−c(nt) dt | n | ≤ k=1 ZIk Z0 X ∞ α 2Kℓ e−cz dz ≤ Z0 Γ (α−1) =2Kℓ . (41) αc1/α How much faster does the best approximation converge than Legendre 15

ℓ For the second term in (40), notice that d(y) ǫ when y Ω k=1 Ik, we obtain ≥ ∈ \ S −c(nd(y))α −c(nǫ)α e Dn(x, y) dy e Dn(x, y) dy Ω\ Sℓ I | | ≤ Ω\ Sℓ I | | Z k=1 k Z k=1 k α e−c(nǫ) (n + 1)2, (42) ≤ where we have used (32) in the last step. Combining (39), (41) and (42) gives the desired result. This completes the proof.

1 3 Remark 6 It is clear that the test functions f(x) = (x 2 )+, sin(5x) are piecewise analytic functions on Ω and they correspond to−m = 3| and m|= 1, respectively. As a consequence, we can deduce from Theorem 3 that the rates of −3 −1 convergence of n(f) are O(n ) and O(n ), respectively. Clearly, these rates of convergenceP are the same order as that of (f) and (f), which explain Bn Tn the convergence behavior of n(f) for these two test functions observed in Figure 2. P

Remark 7 In Figure 3 we plot the pointwise error of n(f) for the function 1 P f(x) = (x 2 )+. It is clear to see that the maximum error of n(f), i.e., f (f) ,− is achieved at the singularity of f. Moreover, we alsoP observek that− Pn k∞ the accuracy of n(f) is much more accurate than n(f) except at the very small neighborhoodP of the singularity. A similar phenomenonB for Chebyshev interpolants has been observed in [30, Chapter 16].

10-3 0.01 3

2 0.005 1

0 0

-1 -0.005 -2

-0.01 -3 -1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1 x x

Fig. 3 Pointwise error of Pn(f) (blue) and Bn(f) (red) for n = 50 (left) and n = 100 1 (right). Here we choose f(x) = (x − 2 )+.

4.2 Differentiable functions with derivatives of bounded variation

In this section we consider the case of differentiable functions with derivatives of bounded variation. Specifically, let m 1 be an integer and introduce the ≥ 16 Haiyong Wang

function space

H = f f,f ′,...,f (m−1) AC(Ω), f (m) BV(Ω) , (43) m | ∈ ∈ n o where AC(Ω) and BV(Ω) denote the space of absolutely continuous functions and the space of bounded variation functions on Ω, respectively. This space is preferable when developing error estimates for various orthogonal polynomial approximations to differentiable function (see, e.g., [17,30,33,36]). For each f PA(Ω, ξ~) Cm−1(Ω), it is easy to see that the restriction of f (m+1) on each [ ∈1, ξ ],[ξ , ξ ∩],...,[ξ , 1] is continuous and bounded, and therefore the total − 1 1 2 ℓ variation of f (m) on Ω is finite. Hence, we can deduce that PA(Ω, ξ~) Cm−1(Ω) ∩ is a subset of Hm. In the following we will extend our analysis to the function space Hm. Since f = n(f) for f n, using the Peano kernel theorem [5, Section 4.2] we obtain P ∈P

1 f(x) (f)= f (m)(t)K (x, t)dt, (44) −Pn m Z−1

where Km(x, t) is the Peano kernel defined by

m−1 m−1 (x t) n((x t) ) K (x, t)= − + −P − + , (45) m (m 1)! − and

0, x 0, r ≤ (x)+ = (46) ( xr,x> 0.

We now state some properties of the Peano kernel.

Lemma 5 Let Km(x, t) be the Peano kernel defined in (45). Then for x Ω and n m 1 we have ∈ ≥ − (1) For m 2, then Km(x, 1)=0. When m =1, then K1(x, 1)=0. (2) For each≥ m 2, then d±K (x, t)= K (x, t). ≥ dt m − m−1 (3) For n m, we have for any q that 1 q(t)K (x, t)dt =0. ≥ ∈Pn−m −1 m (4) For x, t [ 1, 1] and m 2, we have K (x, t) Kn−m+1. ∈ − ≥ k m R k∞ ≤ m−1 m−1 Proof For the first assertion, notice that (x 1)+ = 0 and (x + 1)+ = m−1 − (x + 1) when m 2. Therefore, Km(x, 1) = 0. When m = 1, notice that 0 ≥ ± (x 1)+ = 0, the desired result follows. For the second assertion, differentiating the− Peano kernel with respect to t yields

m−2 m−2 d (x t) n((x t) ) K (x, t)= − + −P − + = K (x, t). dt m − (m 2)! − m−1 − How much faster does the best approximation converge than Legendre 17

This proves the second assertion. For the third assertion, we notice that f (f) whenever f . Setting f = q in (44) gives ≡ Pn ∈Pn ∈Pn 1 q (q)= q(m)(t)K (x, t)dt =0. −Pn m Z−1 Since q n is arbitrary, this proves the third assertion. For the last assertion, ∈P m−1 m−1 we note that (x t)+ is a piecewise analytic function and (x t)+ Cm−2[ 1, 1]. The− desired result follows from Theorem 3. This ends− the proof.∈ − We are now ready to state the second main result of this section. Theorem 4 Assume that f H for some integer m 1. Then, we have ∈ m ≥ f (f) Kn−m. (47) k −Pn k∞ ≤ Proof Applying the second assertion of Lemma 5 and integrating by parts, we obtain 1 d f(x) (f)= f (m)(t) K (x, t)dt −Pn − dt m+1 Z−1 1 1 = f (m)(t)K (x, t) K (x, t)df (m)(t) − m+1 −1 − m+1  Z−1  1 (m) = Km+1(x, t)df (t), Z−1 where the last integral is understood as a Riemann-Stieltjes integral and we have used the first assertion of Lemma 5 in the last step. Furthermore, using the inequality of Riemann-Stieltjes integral, we arrive at f(x) (f) K (x, t) V (f (m)). k −Pn k∞ ≤k m+1 k∞ where V (f (m)) is the total variation of f (m). The desired result follows from the last assertion of Lemma 5. Remark 8 For the test function f(x) = exp( 1/x2), it is infinitely differen- tiable on Ω and f (m) BV(Ω) for every m −N. Thus, we can deduce from ∈ ∈ −m Theorem 4 that the rate of convergence of n(f) is O(n ) for any m N. P 1 3 ∈ Moreover, for the other two test functions f(x) = (x 2 )+, sin(5x) , they can also be viewed as differentiable functions with derivatives− | of bounded| varia- tion and they correspond to m = 3 and m = 1, respectively. Therefore, we can −3 deduce from Theorem 4 that the rate of convergence of n(f) is O(n ) and O(n−1), respectively. Clearly, these results explain why theP rate of convergence of (f) is the same as that of (f) observed in Figure 2. Pn Bn

5 Extension

In this section we extend our discussion to functions of fractional smoothness. We shall restrict our attention to some model functions for the sake of brevity and their results will shed light on the investigation of more complicated func- tions. 18 Haiyong Wang

5.1 Functions with an interior singularity of fractional order

α Consider the function f(x) = x x0 , where x0 ( 1, 1) and α > 0 is not an integer. Clearly, this function| − has| an interior∈ singularity− of fractional order. To derive the optimal rate of convergence of n(f), we shall combine the asymptotic estimate of the Legendre coefficientsP of f and the observation in Remark 7. Using [12, Equation (7.232.3)], we see that

1 1 a = k + x x αP (x)dx k 2 | 0 − | k   Z−1 1 x0 1 = k + (x x)αP (x)dx + (x x )αP (x)dx 2 0 − k − 0 k  Z−1 Zx0  1 Γ (α + 1)Γ (k + 1) = k + (1 x )α+1P (α+1,−α−1)(x ) 2 Γ (k + α + 2) − 0 k 0   h +( 1)k(1 + x )α+1P (α+1,−α−1)( x ) , (48) − 0 k − 0 i (α+1,−α−1) where Pk (x) is the Jacobi polynomial of degree k. From [27, Theo- (α,β) −1/2 rem 8.21.8] we know that Pk (x) = O(k ) where x ( 1, 1) and α, β are arbitrary real numbers. Combining this result with the∈ asympto− tic behav- ior of the ratio of gamma functions [20, Equation (5.11.12)], we obtain the −α−1/2 estimate ak = O(k ). On the other hand, as observed in Remark 7, the maximum error of (f) is achieved in a small neighborhood of the singular- Pn ity x = x0. Using the Laplace-Heine formula of the Legendre polynomials [27, Theorem 8.21.1], i.e., P (x)= O(k−1/2) where x ( 1, 1), we see at once that k ∈ − ∞ ∞ f (f) a P (x) = O(k−α−1)= O(n−α). (49) k −Pn k∞ ≤ | k|| k | k=Xn+1 k=Xn+1 Moreover, this rate of convergence is optimal in the sense that it is the same as that of n(f) up to constant factors (see, e.g., [28, p. 410]). Regarding n(f), it has beenB shown in [17, Equation (4.61)] that the optimal rate of convergenceT −α of n(f) is also O(n ). Thus, n(f), n(f) and n(f) have the same rate of convergenceT for functions with anT interiorB singularityP of fractional order. In Figure 4 we show the maximum error of three methods as a function of n 1 5/2 4 5/4 2/3 for the three functions f(x)= x 2 , x 5 , x and the corresponding P T | − | | − | | | ratios n and n . From the top row of Figure 4 we see that all three methods (f),R (f) andR (f) indeed converge at the same rate. Moreover, the Bn Tn Pn accuracy of n(f) and n(f) is indistinguishable. From the bottom row of Figure 4 weT see that eachP ratio P and T approaches a constant value as Rn Rn n , which confirms that n(f) is better than n(f) and n(f) by only some→ ∞ constant factors (for theB three test functions,T P , T P[0.44, 0.49] as Rn Rn ∈ n and thus n(f) is better than n(f) and n(f) by a factor of up to 2.3).→ ∞ B T P How much faster does the best approximation converge than Legendre 19

f(x)=|x-1/2|5/2 f(x)=|x-4/5|5/4 f(x)=|x|2/3 100 100 100

10-3 10-3 10-3

P (f) P (f) P (f)

Maximum Error n Maximum Error n Maximum Error n T (f) T (f) T (f) n n n B (f) B (f) B (f) n n n 10-6 10-6 10-6 100 101 102 100 101 102 100 101 102 n n n

f(x)=|x-1/2|5/2 f(x)=|x-4/5|5/4 f(x)=|x|2/3 1 1 1 RP RP RP n n n 0.8 RT 0.8 RT 0.8 RT n n n

0.6 0.6 0.6

0.4 0.4 0.4

0.2 0.2 0.2

0 0 0 0 20 40 60 80 100 0 20 40 60 80 100 0 20 40 60 80 100 n n n

Fig. 4 Top row shows the log plot of the maximum error of Bn(f), Tn(f) and Pn(f) for 1 5/2 4 5/4 2/3 f(x) = |x − 2 | (left), f(x) = |x − 5 | (middle) and f(x) = |x| (right). Bottom row P T shows the corresponding Rn and Rn . Here n ranges from 2 to 100.

5.2 Functions with endpoint singularities

α Consider the functions fα(x)=(1 x) , where α> 0 is not an integer. From [12, Equation (7.311.3)] and setting± λ = 1/2, closed forms of the Legendre coefficients are given by

2αΓ (α + 1)2(2k + 1) a = ( 1)k , k 0. (50) k ± Γ (α +1 k)Γ (α +2+ k) ≥ − Furthermore, combining the reflection formula [20, Equation (5.5.3)] and the asymptotic behavior of the ratio of gamma functions [20, Equation (5.11.12)], we can deduce that

2α sin(απ)Γ (α + 1)2(2k + 1)Γ (k α) a = ( 1)( 1)k − = O(k−2α−1). k − ∓ πΓ (k + α + 2)

An important observation is that the sequence ak k>α has the same constant α { } α sign when fα(x)=(1 x) and has alternating signs when fα(x)=(1+ x) . −k Recall Pk( 1)= ( 1) , we can deduce that the maximum error of n(fα) is taken at x±= 1 for±f (x) = (1 x)α and at x = 1 for f (x) =P (1+ x)α. α − − α 20 Haiyong Wang

Therefore, we obtain for n α that ≥⌊ ⌋ ∞ f (f ) = a = O(n−2α). (51) k α −Pn α k∞ | k| k=Xn+1

We remark that this result is optimal since the rate of convergence of n(fα) is O(n−2α) (see, e.g., [28, p. 411]). Moreover, from [17] we know that theB rate −2α of convergence of n(f) is also O(n ). Thus, these three approaches n(fα), (f ) and (f T) converge at the same rate. B Pn α Tn α In Figure 5 we show the maximum error of n(f), n(f) and n(f) as a function of n for the three functions f(x) = (1+B x)5/2T, (1 x2)3/P2, cos−1(x) P T − and the corresponding ratios n and n . From the top row of Figure 5 we see that all three methods indeedR convergeR at the same rate. From the bottom row of Figure 5 we see that each ratio P and T converges to a finite asymptote Rn Rn as n , which means that n(f) is better than n(f) and n(f) by only → ∞ B T P P some constant factors (for these three test functions, n [0.17, 0.29] and T R ∈ n [0.44, 0.49] as n and thus n(f) is better than n(f) by at most aR factor∈ of 5.9 and is better→ ∞ than (fB) by at most a factorP of 2.3). Tn

f(x)=(1+x)5/2 f(x)=(1-x2)3/2 f(x)=cos-1(x) 100 100 100

10-5 10-5 10-5

P (f) P (f) P (f)

Maximum Error n Maximum Error n Maximum Error n T (f) T (f) T (f) n n n B (f) B (f) B (f) n n n 10-10 10-10 10-10 100 101 102 100 101 102 100 101 102 n n n

f(x)=(1+x)5/2 f(x)=(1-x2)3/2 f(x)=cos-1(x) 1 1 1 RP RP RP n n n 0.8 RT 0.8 RT 0.8 RT n n n

0.6 0.6 0.6

0.4 0.4 0.4

0.2 0.2 0.2

0 0 0 0 20 40 60 80 100 0 20 40 60 80 100 0 20 40 60 80 100 n n n

Fig. 5 Top row shows the log plot of the maximum error of Bn(f), Tn(f) and Pn(f) for f(x)=(1+ x)5/2 (left), f(x) = (1 − x2)3/2 (middle) and f(x) = cos−1(x) (right). Bottom P T row shows the corresponding Rn and Rn . Here n ranges from 2 to 100. How much faster does the best approximation converge than Legendre 21

Remark 9 For fα(x), it has been shown in [32, Theorem 5.10] that

ak Γ (α + 1) 1/2 −1 = 1 π + O(k ). (52) ck Γ (α + 2 ) It is easy to verify that the first term on the right hand side is always greater than one for α > 0 and is strictly increasing as α grows. Moreover, similar to the Legendre case, we can show that the maximum error of n(f) is also achieved at x = 1 for f (x)=(1 x)α, i.e., f (f ) = T ∞ c . ∓ α ± k α − Tn α k∞ k=n+1 | k| Combining this with (51) and (52), we can deduce that n(fα) is better than Γ (α+1) 1/2 T P n(fα) by a constant factor of 1 π as n . This means that the P Γ (α+ 2 ) → ∞ larger α, the better the accuracy of n(fα) than n(fα), and this phenomenon can be seen clearly from the bottomT row of FigureP 5.

6 Concluding remarks

In this paper we have studied the optimal rate of convergence of Legendre projections (f) in the L∞ norm for analytic and differentiable functions. For Pn analytic functions, we showed that the optimal rate of convergence of n(f) is 1/2 B faster than that of n(f) by a factor of n . For differentiable functions such as piecewise analyticP functions and functions of fractional smoothness, however, we improved the existing results and showed that the rate of convergence of n(f) is better than that of n(f) by only some constant factors (the factor Bis between 2 to 6 for most ofP examples displayed in this paper). Our results provide new insights into the approximation power of n(f). Finally, we present some problems for future research:P – In Figure 3, we have illustrated the pointwise error of (f). It can be seen Pn that n(f) converges actually much faster than n(f) when x is far from the singularityP of f. It would be interesting to establishB a precise estimate on the rate of pointwise convergence of n(f) to explain this observation. – Gegenbauer and Jacobi projections areP widely used in spectral methods for differential and integral equations and their optimal error estimates are often required in these applications. Our work can be extended to these two cases (see [34] for the case of Gegenbauer projections). Following the same line of Theorem 3, it is possible to establish an optimal error estimate of Jacobi projections for piecewise analytic functions by combining the result [23, Theorem 3] and some sharp estimates of the Dirichlet kernel of Jacobi polynomials. Moreover, for functions of fractional smoothness, it is also possible to establish some optimal error estimates of Jacobi projections by combining the observation in Remark 7 and sharp estimates of Jacobi expansion coefficients (see [36]). – Spectral interpolation, i.e., polynomial interpolation in roots or extrema of Legendre, and, more generally, Gegenbauer and Jacobi polynomials, is a powerful approach for approximating smooth functions that are difficult to compute and serves as theoretical basis for spectral collocation methods 22 Haiyong Wang

(see, e.g., [25, Chapter 3]). It is of interest to study the comparison of the convergence behavior of spectral interpolation and that of the best approximation (f) for analytic and differentiable functions. Bn

Acknowledgements The author would like to thank two anonymous referees for their careful reading of the manuscript and helpful comments which have improved this paper.

References

1. G. Almkvist and B. Berndt, Gauss, Landen, Ramanujan, the arithmetic-geometric mean, ellipses, π, and the ladies diary, Amer. Math. Monthly, 95(7):585-608, 1988. 2. B. K. Alpert and V. Rokhlin, A fast algorithm for the evaluation of Legendre expansions, SIAM J. Sci. Statist. Comput., 12(1):158-179, 1991. 3. V. A. Antonov and K. V. Holsevnikov, An estimate of the remainder in the expansion of the for the Legendre polynomials (Generalization and improvement of Bernstein’s inequality), Vestnik Leningrad University Mathematics, 13, 163–166, 1981. 4. S. Bernstein, Sur l’ordre de la meilleure approximation des fonctions continues par les polynˆomes de degr´edonn´e, Mem. Cl. Sci. Acad. Roy. Belg. 4:1-103, 1912. 5. H. Brass and K. Petras, Quadrature Theory: The Theory of Numerical Integration on a Compact Interval, Amer. Math. Soc., Providence, Rhode Island, 2011. 6. C. Canuto, M. Y. Hussaini, A. Quarteroni and T. A. Zang, Spectral Methods: Funda- mentals in Single Domains, Springer, 2006. 7. E. W. Cheney, Introduction to Approximation Theory, AMS Chelsea Publishing, Provi- dence, RI, 1998. 8. C. W. Clenshaw, A comparison of “best” polynomial approximations with truncated Chebyshev series expansions, SIAM Numer. Anal., 1(1):26-37, 1964. 9. P. J. Davis and P. Rabinowitz, Methods of Numerical Integration, Second edition, Aca- demic Press, London, 1984. 10. T. A. Driscoll, H. Hale and L. N. Trefethen, Chebfun User’s Guide, Pafnuty Publications, Oxford, 2014. 11. K. Eriksson, Some error estimates for the p-version of the finite element method, SIAM J. Numer. Anal., 23(2): 403-411, 1986. 12. I. S. Gradshteyn and I. M. Ryzhik, Table of Integrals, Series, and Products, Seventh Edition, Academic Press, 2007. 13. W. Gui and I. Babuˇska, The h,p and h-p versions of the finite element method in 1 dimension, Numer. Math., 49:577-612, 1986. 14. J. H. Hesthaven, S. Gottlieb and D. Gottlieb, Spectral Methods for Time-Dependent Problems, Cambridge University Press, 2007. 15. A. Iserles, A fast and simple algorithm for the computation of Legendre coefficients, Numer. Math., 117(3):529-553, 2011. 16. G. J. O. Jameson, Inequalities for the perimeter of an ellipse, Math. Gazette, 98:227-234, 2014. 17. W.-J. Liu, L.-L. Wang and H.-Y. Li, Optimal error estimates for Chebyshev approxima- tion of functions with limited regularity in fractional Sobolev-type spaces, Math. Comp., 88(320):2857–2895, 2019. 18. J. C. Mason and D. C. Handscomb, Chebyshev Polynomials, Chapman and Hall/CRC, Boca Raton, 2003. 19. C. K. Qu and R. Wong, Szego’s conjecture on Lebesgue constants for Legendre series, Pacific J. Math., 135(1):157-188, 1988. 20. F. W. J. Olver, D. W. Lozier, R. F. Boisvert and C. W. Clark, NIST Handbook of Mathematical Functions, Cambridge University Press, 2010. 21. A. Osipov, V. Rokhlin and H. Xiao, Prolate Spheroidal Wave Functions of Order Zero: Mathematical Tools for Bandlimited Approximation, Springer, 2013. 22. T. J. Rivlin, An introduction to the approximation of functions, Dover Publications, Inc. New York, 1981. How much faster does the best approximation converge than Legendre 23

23. E. B. Saff and V. Totik, Polynomial approximation of piecewise analytic functions, J. London Math. Soc., s2-39:487-498, 1989. 24. J. Shen, Efficient spectral-Galerkin method I. Direct solvers of second-and fourth-order equations using Legendre polynomials, SIAM J. Sci. Comput., 15(6):1489-1505, 1994. 25. J. Shen, T. Tang and L.-L. Wang, Spectral Methods: Algorithms, Analysis and Appli- cations, Springer, Heidelberg, 2011. 26. P. K. Suetin, Representation of continuous and differentiable functions by Fourier series of Legendre polynomials, Dokl. Akad. Nauk SSSR, 158(6):1275-1277, 1964. 27. G. Szeg˝o, , volume 23, American Mathematical Society, 1939. 28. A. F. Timan, Theory of Approximation of Functions of a Real Variable, Pergamon Press, Oxford, 1963. 29. A. Townsend, M. Webb and S. Olver, Fast polynomial transforms based on Toeplitz and Hankel matrices, Math. Comp., 87(312):1913-1934, 2018. 30. L. N. Trefethen, Approximation Theory and Approximation Practice, SIAM, 2013. 31. H.-Y. Wang and S.-H. Xiang, On the convergence rates of Legendre approximation, Math. Comp., 81(278):861–877, 2012. 32. H.-Y. Wang, On the optimal estimates and comparison of Gegenbauer expansion coef- ficients, SIAM J. Numer. Anal., 54(3):1557-1581, 2016. 33. H.-Y. Wang, A new and sharper bound for Legendre expansion of differentiable func- tions, Appl. Math. Letters, 85:95-102, 2018. 34. H.-Y. Wang, On the optimal rates of convergence of Gegenbauer projections, arXiv:2008.00584, 2020. 35. S.-H. Xiang, On error bounds for orthogonal polynomial expansions and Gauss-type quadrature, SIAM J. Numer. Anal., 50(3):1240–1263, 2012. 36. S.-H. Xiang and G.-D. Liu, Optimal decay rates on the asymptotics of orthogonal poly- nomial expansions for functions of limited regularities, Numer. Math., 145:117-148, 2020. 37. X.-D. Zhao, L.-L. Wang and Z.-Q. Xie, Sharp error bounds for Jacobi expansions and Gegenbauer-Gauss quadrature of analytic functions, SIAM J. Numer. Anal., 51(3):1443- 1469, 2013.