Your Mathematica calculation for the square wave is right. In your first post, the series formula after the "thus" is the series for the sawtooth wave, not for the square wave. This is why "all other values are double".
The series formula f(x)=∑n=1∞4nπsin(nπx) does not reproduce the function f(x)={−1,1,−1<x<00<x<1. It is the series for another function. Didn't you make the plot?
f(x)=∑n=1∞4nπsin(nπx)
f(x)={−1,1,−1<x<00<x<1
Your formula for f[x] is wrong. Try plotting the result:
f[x]
Sum[4/(n Pi) Sin[n Pi x], {n, 1, Infinity}] Plot[Chop[%], {x, -1, 1}]
Could you explain to me please why the F(x) is wrong?