I'd like to plot some partial sums for a Fourier Series problem, but I am not sure if the output I am getting is correct. I want to be able to plot the partial sums and the function on the same graph. Here is something that I attempted.
s[n_, x_] := 8/4 + 3/(9 \[Pi]π) Sum[(6 (-1)^k)/(k \[Pi]π)
Cos[(k \[Pi]π x)/2] + (16 (-1)^k + 13)/(\[Pi]π k)
Sin[(k \[Pi]π x)/2],{k, 0, n}]
partialsums = Table[s[n, x], {n, 1, 5}];
f[x_] = Piecewise[{{-x^3-2x,-2 < x < 0},{-1+x,0<= x <= 2}}]
Plot[Evaluate[partialsums], {x, -4 Pi, 4 Pi}]
Any ideas about the best method to tackle something like this?