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 -L to L to get the bk, we take twice the integral from 0 to L.
(This is because we will always have the integral of f(x)sin(k Pi/L x), which is an odd function times an odd function, producing an even function.)

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

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, similar to the last one we did above. Here L=Pi.

In[79]:=

  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}];

In[80]:=

  b[n_]:=(2/Pi)(Integrate[x v[x,Pi,n],{x,0,Pi/2}]+
  Integrate[(Pi-x) v[x,Pi,n],{x,Pi/2,Pi}])
  Table[b[k],{k,1,10}]

Out[80]=

   4       -4        4        -4         4
  {--, 0, ----, 0, -----, 0, -----, 0, -----, 0}
   Pi     9 Pi     25 Pi     49 Pi     81 Pi

Can you see the pattern?

Can you see the pattern? ...

Let's calculate some partial sums. Be patient.

In[81]:=

  Clear[Sn]
  Sn=Table[Sum[b[k] v[x,Pi,k],{k,1,n}],{n,1,5}];

Let's see how we did.

In[82]:=

  Clear[sn1,sn3,sn5]

In[83]:=

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

In[84]:=

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

In[85]:=

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

Up to Half-Period Fourier Series