Odd Periodic Extension to Obtain Fourier Series

75 Views Asked by At

I'm asked to obtain the Fourier series for $f(x)=x|x|$ on the interval $[-1,1]$. I'm thinking it's easier to do an odd periodic extension of $x^2$ on $[0,1]$. My book says this is given by $$f(x)=\sum_{n=1}^{\infty}b_{n}\sin{\frac{n\pi}{L}x},$$ with $$b_{n}=\frac{2}{L}\int_{0}^{L}f(x)\sin{\frac{n\pi}{L}x}\ dx.$$ Taking $f(x)=x^2$, I computed \begin{align*}b_{n}&=2\int_0^1x^2\sin{n\pi x}\\&=\frac{2(2-\pi^2n^2)\cos{(\pi n)-4}}{\pi^3n^3}\\&=\frac{2(2-\pi^2n^2)(-1)^n-4}{\pi^3n^3}\end{align*} and so $$\hat{f}(x)=\sum_{n=1}^{\infty}\frac{2(2-\pi^2n^2)(-1)^n-4}{\pi^3n^3}\cos{n\pi x}.$$ But when I plot this up to n=1000 I get nothing close to $x|x|$. What am I doing wrong?

1

There are 1 best solutions below

2
On BEST ANSWER

It should be summing over sine terms rather than cosines:

$$\hat{f}(x)=\sum_{n=1}^{\infty}\frac{2(2-\pi^2n^2)(-1)^n-4}{\pi^3n^3}\color{red}\sin{n\pi x}.$$

enter image description here