(* Sine-cosine expansion of tH(t)  *)
(*---------------------------------*)

ClearAll["@"];

(*Define, but don't evaluate the Fourier coeffs*)
a[n_]:=1/Pi*Integrate[t*Cos[n*t],{t,0,Pi}]
a[0]=1/2*a[0];
b[n_]:=1/Pi*Integrate[t*Sin[n*t],{t,0,Pi}]

(*Evaluate S5 and display*)
S5=Sum[a[n]*Cos[n*t]+b[n]*Sin[n*t],{n,0,5}]
(*Evaluate S50 but don't display*)
S50=Sum[a[n]*Cos[n*t]+b[n]*Sin[n*t],{n,0,50}];

(*Plot the approximation curves*)
flist={S5,S50};
Plot[Evaluate[flist],{t,-2Pi,2Pi},PlotRange->All]
