I am trying to find the Fourier Series of $u=x^2(x-\pi)^2$. Given $$u_x(0)=u_x(\pi)=0$$ Using the even extension I got $$a_0=\frac{2}{\pi}\int_0^\pi x^2(x-\pi)^2 dx $$ $$\Rightarrow a_0=\frac{\pi^4}{15}$$ $$a_n=\frac{2}{\pi}\int_0^\pi [x^2(x-\pi)^2](\cos(nx))dx$$ $$\Rightarrow a_n=-\frac{24(\cos(\pi n)+1)}{n^4} $$ $$\Rightarrow u=\frac{\pi^4}{30}-\sum_{n=1}^\infty\frac{24(\cos(\pi n)+1)}{n^4}\cos (nx)$$
I tried to plot it but it was not quite the same as $u=x^2(x-\pi)^2$. Any advice would be greatly appreciated.
$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\on}[1]{\operatorname{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$ Define $\ds{\bbox[5px,#ffd]{\on{f}\pars{x} = \left\{\begin{array}{lcl} \ds{\on{f}\pars{-x}} & \mbox{if} & \ds{x < 0} \\[1mm] \ds{x^{2}\pars{x - \pi}^{2}} & \mbox{if} & \ds{0 \leq x \leq \pi} \\[1mm] \ds{\on{f}\pars{x - \pi}} & \mbox{if} & \ds{x > \pi} \end{array}\right.}}$
which is an even and periodic function of period $\ds{\pi}$ which looks like the following picture:
Lets $\ds{\on{f}\pars{x} = a_{0} + \sum_{n = 1}^{\infty}a_{n}\cos\pars{2nx}}$ $$ \mbox{with}\quad \left\{\begin{array}{lcl} \ds{\int_{-\pi/2}^{\pi/2}\cos\pars{2mx}\cos\pars{2mx} \,\dd x} & \ds{=} & \ds{{\pi \over 2}\,\delta_{mn}} \\[2mm] \ds{\int_{-\pi/2}^{\pi/2}\cos\pars{2nx}\,\dd x} & \ds{=} & \ds{\pi\,\delta_{n0}} \end{array}\right. $$
\begin{align} \on{f}\pars{x} & = {\pi^{4} \over 30} - 3\sum_{n = 1}^{\infty}{\cos\pars{2nx} \over n^{4}} = \bbx{6\sum_{n = 1}^{\infty} {\sin^{2}\pars{nx} \over n^{4}}} \label{1}\tag{1} \\ & \end{align} because $\ds{\sum_{n = 1}^{\infty}{1 \over n^{4}} = {\pi^{4} \over 90}}$.
In plotting the above series ( see (\ref{1}) ), you'll get the above picture again.