Fourier series solutions V - Computing some Fourier series

It is a good idea to see computations of some Fourier series of functions that aren't built from sines and cosines. To that end, we consider two simple examples: 1) a "square wave"; and 2) a "triangular wave".

Example: A square wave


Consider the piecewise-defined function f(t) is periodic with period 1, and which on [0,1) is defined by

f(t)={1, if 0t<121, if 12t<1

In other words, this function alternates between the values of 1 and 1 over intervals of length 12. Although this function is discontinuous (where it "jumps" between the values of 1 and 1), if we suggestively connect the values across those jumps with vertical lines we get the following visualization of the graph of f:

squareWave.png|600

Based on this image, it's reasonable to call this graph a "rectangular wave", but for some reason the descriptor "square wave" is more popular.

In any case, let's compute the complex Fourier series associated to this function f. We first compute

f^(0)=01f(t)dt=0121dt+1211dt=0.

For n0 we compute

f^(n)=01f(t)e2πintdt=012e2πintdt121e2πintdt=12πin(eπin1)+12πin(e2πineπin)=1πin(1eπin)=1πin(1(1)n)={0, if n even2πin, if n odd

Note that we computed the integrals using u-substitutions, and simplified some expressions using the facts that e2πik=1 whenever k is an integer, while eπik is 1 when k is even and 1 when k is odd; i.e., eπik=(1)k.

It follows that that Fourier series associated to our function f is

n=f^(n)e2πint=n odd2πine2πint=2πi3e6πit2πie2πit+2πie2πit+2πi3e6πit+

If we group together the term at index n with the term at index n and use the identity e2πinte2πint=2isin(2πnt), we can rewrite the above series in the sines-and-cosines form as

n odd2πine2πint=odd n>04nπsin(2πnt)

Some Fourier approximations

Let's truncate our Fourier series after various amounts of terms and see how well the corresponding finite Fourier series approximates our function f. If we only use the first term, the finite Fourier series we obtain is

S1(t)=4πsin(2πt),

whose graph is

squareWave1.png|600

If we truncate instead at N=9 (i.e., include all terms with n9), the finite Fourier series we obtain is

S9(t)=4πsin(2πt)+43πsin(6πt)+45πsin(10πt)+47πsin(14πt)+49πsin(18πt),

whose graph is

squareWave9.png|600

Finally, if we truncate our series at N=99, the graph of the corresponding finite Fourier series we obtain is

squareWave99.png|600

Although our "Fourier approximations" appear to be converging quickly to the original square wave, you might notice those weird little "peaks" at the corners of each wave. There's something a little surprising going on here, but we'll hold off on investigating further until after our next example.

Example: A triangular wave


Now f(t) denote the "triangle wave" function, which is periodic with period 1 and is defined on [0,1) by

f(t)={t,0t<121t,12t<1

As you can see from the graph, it seems reasonable to call this function a "triangle wave":

triangleWave.png|600

We first compute

f^(0)=01f(t)dt=01/2tdt+1/21(1t)dt=14.

For n0, we have

f^(n)=01f(t)e2πintdt=01/2te2πintdt+1/21(1t)e2πintdt.

To compute these, we make the substitution u=2πint (so du=2πindt) and use integration by parts, obtaining

f^(n)=14πn20πinueudu12πinπin2πineudu+14π2n2πin2πinueudu=14π2n2[ueueu]0πin+i2πn[eu]πin2πin+14π2n2[ueueu]πin2πin=14π2n2(πineπineπin+1)+i2πn(e2πineπin)+14π2n2(2πine2πine2πin+πineπin+eπin)

To simplify this mess, recall that e2πin=1 for all n, and that eπin=(eπi)n=(1)n. So when n is even, the above expression simplifies to

f^(n)=14π2n2(πin1+1)+i2πn(11)+14π2n2(2πin1+πin+1)=0.

When n is odd, the expression instead simplifies to

f^(n)=14π2n2(πin+1+1)+i2πn(1+1)+14π2n2(2πin1πin1)=1π2n2.

We've shown that the Fourier series for f(t) is

n=f^(n)e2πint=141π2odd n1n2e2πint=141π2odd n>0(1n2e2πint+1(n)2e2πi(n)t)=141π2odd n>01n2(e2πint+e2πint)=142π2odd n>01n2cos(2πnt).

Some Fourier approximations

As with the square wave, we can get a sense for how quickly our Fourier series is converging to the original function by looking at some Fourier approximations with increasingly larger N values (i.e., more and more terms included). Here are the graphs of those approximations when N=1,9 and 99, this time with the original graph overlaid for visual comparison:

triangleWave1.png|600

triangleWave9.png|600

triangleWave99.png|600

Suggested next notes


Fourier series solutions VI - Inner product spaces