A Different Looking Sine Function
In[77]:=
Clear[part1,part2,part3,part4,part5,part6];
part1=Plot[0,{x,-3Pi,-2Pi},DisplayFunction->Identity];
part2=Plot[Sin[x],{x,-2Pi,-Pi},DisplayFunction->Identity];
part3=Plot[0,{x,-Pi,0},DisplayFunction->Identity];
part4=Plot[Sin[x],{x,0,Pi},DisplayFunction->Identity];
part5=Plot[0,{x,Pi,2Pi},DisplayFunction->Identity];
part6=Plot[Sin[x],{x,2Pi,3Pi},DisplayFunction->Identity];
funcgraph=Show[part1,part2,part3,part4,part5,part6,
DisplayFunction->$DisplayFunction,
Ticks->{{-3Pi,-2Pi,-Pi,Pi,2Pi,3Pi},Automatic},AspectRatio->1/3];

In[78]:=
Clear[a0,a,b,Sn]
a0=(1/(2Pi))(Integrate[0,{x,-Pi,0}]+
Integrate[Sin[x],{x,0,Pi}]);
In[79]:=
a=(1/Pi)Table[Integrate[0 u[x][[i]],{x,-Pi,0}]+
Integrate[Sin[x] u[x][[i]],{x,0,Pi}],{i,1,10}];
In[80]:=
b=(1/Pi)Table[Integrate[0 v[x][[i]],{x,-Pi,0}]+
Integrate[Sin[x] v[x][[i]],{x,0,Pi}],{i,1,10}];
In[81]:=
a0
a
Out[81]=
1 -- Pi
Out[82]=
-2 -2 -2 -2 -2
{0, ----, 0, -----, 0, -----, 0, -----, 0, -----}
3 Pi 15 Pi 35 Pi 63 Pi 99 Pi
Can you see the pattern?
In[83]:=
b
Out[83]=
1
{-, 0, 0, 0, 0, 0, 0, 0, 0, 0}
2
It doesn't take rocket scientist to figure out this pattern:
b1=1/2 and bk=0 for k>1
Let's calculate a few partial sums.
In[84]:=
Sn=Table[a0+Sum[a[[k]]Cos[k x],{k,1,n}]
+Sum[b[[k]]Sin[k x],{k,1,n}],{n,1,10}];
Let's see how we did.
In[85]:=
Clear[sn1,sn3,sn5,sn10]
In[86]:=
sn1=Plot[Sn[[1]],{x,-2 Pi,2 Pi},DisplayFunction->Identity];
Show[funcgraph,sn1,PlotLabel->
FontForm["a0+a1Cos[x]+b1Sin[x]",{"Helvetica-Bold",12}]];

In[87]:=
sn3=Plot[Sn[[3]],{x,-2 Pi,2 Pi},DisplayFunction->Identity];
Show[funcgraph,sn3,PlotLabel->
FontForm["a0+Sum(k=1 to 3) akCos[kx]+bkSin[kx]",
{"Helvetica-Bold",12}]];

In[88]:=
sn5=Plot[Sn[[5]],{x,-2 Pi,2 Pi},DisplayFunction->Identity];
Show[funcgraph,sn5,PlotLabel->
FontForm["a0+Sum(k=1 to 5) akCos[kx]+bkSin[kx]",{"Helvetica-Bold",12}]];

In[89]:=
sn10=Plot[Sn[[10]],{x,-2 Pi,2 Pi},DisplayFunction->Identity];
Show[funcgraph,sn10,PlotLabel->
FontForm["a0+Sum(k=1 to 10) akCos[kx]+bkSin[kx]",{"Helvetica-Bold",12}]];

Up to Fourier Series Examples