Fourier series and Gibbs phenomenon $cosx$

92 Views Asked by At

I want to calculate Fourier series. $$f\left( x\right) =\begin{cases}\cos x\left( 0 <x\leq \pi \right) \\ 0\left( \pi <x\leq 2\pi \right) \end{cases}$$

I think


$$\begin{aligned}a_{0}=\dfrac{1}{\pi }\int _{0}^{\pi }\cos xdx\\ =0\end{aligned}$$ $$\begin{aligned}a_{n}=\dfrac{1}{\pi }\int _{0}^{\pi }\cos x\cos nxdx\\ =-\dfrac{\pi \sin \pi n}{\pi \left( n^{2}-1\right) }\end{aligned}$$ $$\begin{aligned}b_{n}=\dfrac{1}{\pi }\int _{0}^{\pi }\cos x\sin nxdx\\ =\dfrac{n\left( \cos \left( \pi n\right) +1\right) }{\pi \left( n^{2}-1\right) }\end{aligned}$$ So Substituting these into a Fourier series equation $$\sum ^{\infty }_{n=1}\left[ \dfrac{-nx\sin \pi n}{\pi \left( n^{2}-1\right) }\cos nx+\dfrac{n\left( \cos \left( \pi n\right) +1\right) }{\pi \left( n^{2}-1\right) }\sin nx\right]$$

I made this graph with using gnuplot and confirmed that this is a Gibbs phenomenon.

I write command in gnuplot.

gnuplot> f(x,N)=sum[i=1:N](-1)*i*sin(pi*i)*cos(i*x)/(pi*(i**-1))+i*(cos(pi*i)+1)*sin(i*x)/(pi*(i**-1))
gnuplot> f(x,1000)

This is graph.

gnuplot

Is this a Gibbs phenomenon? Please tell me.