Fourier Sine Series

If we use the odd periodic extension of f(x), we will be finding the Fourier series of an odd function.
Let's make a few notes:
1. All of the ak terms will be zero!
(This is because we have an odd function.)
2. Instead of integrating from -Pi to Pi to get the bk, we take twice the integral from 0 to Pi.
(This is because we will always have the integral of f(x)sin(kx), which is an odd function times an odd function, producing an even function.)

ak=0,
bk=(2/Pi) Integral from 0 to Pi of f(x)sin(kx)

Let's do an example.
f(x) = x for 0<=x<=Pi/2
Pi-x for Pi/2<=x<=Pi
This is a reasonable function.


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


  b=(2/Pi)Table[Integrate[x Sin[k x],{x,0,Pi/2}]+
  Integrate[(Pi-x) Sin[k x],{x,Pi/2,Pi}],{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 x],{k,1,n}],{n,1,10}];

Let's see how we did.


  Clear[sn1,sn3,sn5,sn10]


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


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


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


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

Up to Half-Period Fourier Series