Finding the complex fourier series of the function $x^2\sin(x)$ in the interval $[{-\pi}, \pi]$?

1.8k Views Asked by At

This forms part of a project I am doing and I wish to see how well complex fourier series approximates a smooth curve such as this one. After tedious integration by parts, I have attained an answer which has imaginary numbers in, although I have been advised that $C_{n}$ must be real.

Ignoring that, when trying to plot what I have derived to see how well it approximates the original function, the graph is not much like the original function. I have checked my work repeatedly but I must have made an error.

The answer I have attained is: $\sum_{n=-N}^{N} \Bigg(\dfrac{i(-1)^n}{(n-1)^2} - \dfrac{i(-1)^n}{(n+1)^2} \Bigg) e^{inx}$

If this answer is correct, is the fact that the fourier series is trying to approximate a smooth function mean it's hard to be correct? The discontinuous functions I have approximated have worked brilliantly with a suitably large n.

Any help with this would be greatly appreciated!

2

There are 2 best solutions below

16
On

The coefficient I get is

$$\frac{4 i (-1)^n n}{(n^2-1)^2},$$ which is not the same as yours.

For $n = 1,$ mathematica gives $$-\frac{1}{6} i \pi \left(2 \pi ^2-3\right)$$

and for $n=-1,$ $$\frac{1}{6} i \pi \left(2 \pi ^2-3\right)$$

15
On

The Fourier series for $x^2$ on $(-\pi,\pi)$ is $$ \frac{\pi^2}3 + 4 \sum_{n=1}^\infty \frac{(-1)^n}{n^2} \cos nx \\ = \frac{\pi^2}3 + 2 \sum_{n=-\infty\atop n\ne 0}^\infty \frac{(-1)^n}{n^2} e^{inx} $$ So the Fourier series for $e^{ix} x^2$ is $$ \frac{\pi^2}3e^{ix} + 2 \sum_{n=-\infty\atop n\ne 1}^\infty \frac{(-1)^{n+1}}{(n-1)^2} e^{inx} $$ So the Fourier series for $\sin(x) x^2 = \frac1{2i} (e^{ix}-e^{-ix}) x^2$ is $$ \frac{\pi^2}3 \sin(x) + i\sum_{n=-\infty\atop n\ne 1}^\infty \frac{(-1)^{n}}{(n-1)^2} e^{inx} - i\sum_{n=-\infty\atop n\ne -1}^\infty \frac{(-1)^{n}}{(n+1)^2} e^{inx} $$ So if $n \ne \pm 1$, then the Fourier coefficient of $e^{inx}$ is $$ i(-1)^n \left(\frac{1}{(n-1)^2}- \frac{1}{(n+1)^2}\right) $$ and this is the same as Igor Riven's answer. The cases $n=\pm1$ need to be calculated separately, but will be easy (basically the above with the divisions by zero replacing the offending term by what comes from the $\frac{\pi^2}3 \sin(x)$ term).