Types of Fourier Series

Let's look at periodic extensions of a simple example: f(x) = x,  0 < x < 1

Basic
f(x) = (Subscript[a, 0])+(∑_(n=1)^∞)[(Subscript[a, n])cos(((nπx)/L))+(Subscript[b, n])sin(((nπx)/L))]
where
(Subscript[a, 0])= (1/(2L))(∫_(-L)^L)f(x)dx
 
 (Subscript[a, n])= (1/L)(∫_(-L)^L)f(x)cos(((nπx)/L))dx
 
 (Subscript[b, n])= (1/L)(∫_(-L)^L)f(x)sin(((nπx)/L))dx

But before we actually compute the series, we need to have a periodic function to work with; so we need to choose a periodic extension.

Half-Range Expansions

Even: 
(Subscript[a, 0])= (1/L)(∫_(-L)^L)f(x)dx
 
 (Subscript[a, n])= (2/L)(∫_(-L)^L)f(x)cos(((nπx)/L))dx
 
 (Subscript[b, n])= 0

Define the periodic function:

f[x_] := x /; 0≤x<1

fEven[x_] := f[x] /; 0≤ x <1

fEven[x_] := f[-x] /; -1≤ x < 0

fEven[x_] := fEven[x-2] /; x≥1

fEven[x_] := fEven[x+2] /; x < -1

Plot[fEven[x], {x,-3,3}, AspectRatio -> 1/6,
PlotStyle -> Thick]

a[0] := (1/2)*Integrate[Abs[x], {x,-1,1}]

a[n_] := Integrate[Abs[x] * Cos[n*Pi*x], {x,-1,1}]

evenPartialSum[x_, i_]  := a[0] + Sum[ a[n]*Cos[n*Pi*x], {n,1,i}]

evenPartialSum[x, 3]

Plot[Evaluate[ a[0] ], {x,-3,3}]

Plot[Evaluate[ evenPartialSum[x, 1]  ], {x,-3,3}]

Plot[Evaluate[ evenPartialSum[x, 3]  ], {x,-3,3}]

Plot[Evaluate[ evenPartialSum[x, 11]  ], {x,-3,3}]

plotTable = Table[Plot[Evaluate[ evenPartialSum[x, n]  ], {x,-3,3}], {n,1,13,4}];

Show[GraphicsGrid[Partition[plotTable,2]]]

a[n]

Assuming [n ∈Integers,a[n] ]

Note that coefficients get smaller proportional to (n^(-2)) .

Odd
(Subscript[a, 0])= 0, (Subscript[a, n])= 0
 
 (Subscript[b, n])= (2/L)(∫_(-L)^L)f(x)cos(((nπx)/L))dx

f[x_] := x /; 0≤x<1

fOdd[x_] := f[x] /; 0≤ x <1

fOdd[x_] := -f[-x] /; -1≤ x < 0

fOdd[x_] := fOdd[x-2] /; x≥1

fOdd[x_] := fOdd[x+2] /; x < -1

Plot[fOdd[x],{x,-3,3}, AspectRatio -> 1/3,PlotStyle -> Thick]

b[n_] := Integrate[x * Sin[n*Pi*x], {x,-1,1}]

oddPartialSum[x_, i_]  := Sum[ b[n]*Sin[n*Pi*x], {n,1,i}]

oddPartialSum[x, 11]

Plot[{%, fOdd[x]}, {x,-3,3}, PlotStyle -> Thick]

b[n]

Assuming [n ∈Integers,b[n] ]

Note that coefficients get smaller proportional to (n^(-1)).

Compare with the behavior of the even version.

evenPartialSum[x, 9]

D[%,x]

Plot[%, {x,-3,3}, PlotStyle -> Thick]

evenPartialSum[x, 15]

D[%,x]

Plot[%, {x,-3,3}, PlotStyle -> Thick]

Contrast continuous function (coefficients decay ~(n^(-2))) with function with jumps (coefficients decay ~(n^(-1))). Note Gibb's phenomenon behavior near jumps (~7% overshoot).

evenPartialSum[x, 15]

D[%, {x,2}]

Plot[%, {x,-3,3}]

Coefficients do not decay, and the series does not converge to anything useful.

Complex

c[n_] := (1/2) Integrate[x*Exp[-I*n*Pi*x], {x,-1,1}]

complexPartialSum[x_, i_] := Sum[c[n]*Exp[I*n*Pi*x], {n,-i,i}]

complexPartialSum[x,3]

ExpToTrig[%]

oddPartialSum[x,3]

So we end up with an equivalent expression from the complex version...