Question on convergence of Chebyshev series

140 Views Asked by At

I have written a script that plots some function and its truncated Chebyshev expansion in $[-1,1]$, which is given by $$ \sum a_nT_n(x) \quad \text{with} \quad a_n = \int_{-1}^{1}T_n(x)f(x)/\sqrt{1-x^2}dx $$

except for $a_0$, which must be divided by two. I represented different functions and for each function I considered a different number of terms in the truncated series, and I observed that the approximation at the endpoints tends to worsen as the number of terms in the truncated series increase. Why does this happen?