Fourier Sine Series
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.
In[90]:=
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[91]:=
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}];
In[92]:=
b
Out[92]=
4 -4 4 -4 4
{--, 0, ----, 0, -----, 0, -----, 0, -----, 0}
Pi 9 Pi 25 Pi 49 Pi 81 Pi
Can you see the pattern?
Let's calculate some partial sums.
In[93]:=
Clear[Sn]
Sn=Table[Sum[b[[k]]Sin[k x],{k,1,n}],{n,1,10}];
Let's see how we did.
In[94]:=
Clear[sn1,sn3,sn5,sn10]
In[95]:=
sn1=Plot[Sn[[1]],{x,0,Pi},DisplayFunction->Identity];
Show[fgraph,sn1,PlotLabel->
FontForm["b1sin[x]",{"Helvetica-Bold",12}]];

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

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

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