Odd and Even Function Demo

f[x_]:=Piecewise[{{1,x>=0},{-1,x<0}}]

Plot[f[x],{x,-5,5}]

Plot[f[x]Cos[x],{x,-10,10}]

Plot[f[x]Sin[x],{x,-10,10}]

Computing Fourier Coefficients for a Step Function

b[k_]:=((2(1-(((-1))^k)))/(k*π))

Table[b[k],{k,1,10}]

Manipulate[
Plot[{f[x],Sum[b[k]*Sin[k*x],{k,1,max}]},{x,-10,10}],
{max,1,50,1}
]

Matching Problem

(a) matches to II.

Manipulate[
Plot[{(x^2),((π^2)/3)+4*Sum[((((-1))^k)/(k^2))*Cos[k x],{k,1,max}]},{x,-10,10},PlotRange->{-1,12}],
{max,1,50}]

(b) matches to III.

Manipulate[
Plot[{x((π^2)-(x^2)),-12*Sum[((((-1))^k)/(k^3))*Sin[k x],{k,1,max}]},{x,-10,10},PlotRange->{-20,20}],
{max,1,50}]

(c) matches to I.

Manipulate[
Plot[{Sin[(x/2)],(8/π)Sum[((k(((-1))^k))/(1-4(k^2)))*Sin[k x],{k,1,max}]},{x,-10,10},PlotRange->{-2,2}],
{max,1,50}]

(d) matches to IV.

Manipulate[
Plot[{Piecewise[{{(π/2)+x,-π<=x<0},{(π/2)-x,0<=x<=π}}],(2/π)Sum[((1-(((-1))^k))/(k^2))*Cos[k x],{k,1,max}]},{x,-10,10},PlotRange->{-2,2}],
{max,1,50}]