Example

Let's do an example. Use the odd periodic extension (hence the sine series) for this function. This function should look familiar.
f(x) = x for 0<=x<=1
2-x for1<=x<=2


  Clear[p1,p2,fgraph]
  p1=Plot[x,{x,0,1},DisplayFunction->Identity];
  p2=Plot[2-x,{x,1,2},DisplayFunction->Identity];
  fgraph=Show[p1,p2,DisplayFunction->$DisplayFunction,
  AspectRatio->Automatic,
  Ticks->{{1,2},Automatic}];

The period here is 4, so T is 2 (after we do the periodic extension!).


  b=(2/2)Table[Integrate[x Sin[(k Pi/2) x],{x,0,1}]+
  Integrate[(2-x) Sin[(k Pi/2) x],{x,1,2}],{k,1,10}];


  b

Can you see the pattern?

Can you see the pattern? ...

Let's calculate some partial sums.


  Clear[Sn]
  Sn=Table[Sum[b[[k]]Sin[(k Pi/2) x],{k,1,n}],{n,1,10}];

Let's see how we did.


  Clear[sn1,sn3,sn5,sn10]


  sn1=Plot[Sn[[1]],{x,0,2},DisplayFunction->Identity];
  Show[fgraph,sn1,PlotLabel->
  FontForm["b1sin[Pi/2 x]",{"Helvetica-Bold",12}]];


  sn3=Plot[Sn[[3]],{x,0,2},DisplayFunction->Identity];
  Show[fgraph,sn3,PlotLabel->
  FontForm["b1sin[Pi/2 x]+b2sin[Pi x]+b3sin[3Pi/2 x]",{"Helvetica-Bold",12}]];


  sn5=Plot[Sn[[5]],{x,0,2},DisplayFunction->Identity];
  Show[fgraph,sn5,PlotLabel->
  FontForm["Sum(k=1 to 5) bkSin[kPi/2 x]",{"Helvetica-Bold",12}]];


  sn10=Plot[Sn[[10]],{x,0,2},DisplayFunction->Identity];
  Show[fgraph,sn10,PlotLabel->
  FontForm["Sum(k=1 to 10) bkSin[kPi/2 x]",{"Helvetica-Bold",12}]];

Up to Periods Other than 2Pi