Fourier Series Illustrations

William O. Bray

Our purpose here is to examine computation of Fourier sine and cosine coefficients and illustrate the pointwise convergence theorem.
All output has been deleted; so enter each Input Cell (white background) and hit Shift+Enter.

Computing Fourier Coefficients

Here are a couple of simple functions defined on the interval [0,π].

In[1]:=

fourier-series_1.gif

Computing the Fourier sine coefficients is easy. For example

In[3]:=

fourier-series_2.gif

Out[3]=

fourier-series_3.gif

gives a formula for the Fourier sine coefficients of g. For plotting purposes, I find it useful to form tables of such coefficients for a range of the index n. I have also included the code to form the partial sums of the series and for the even and odd extensions of a function.

In[4]:=

fourier-series_4.gif

Sine and Cosine Series for g

For example the following generates the first 20 Fourier cosine coefficients of g.

In[10]:=

fourier-series_5.gif

Out[10]=

fourier-series_6.gif

We can look at the numeric values with the command:

In[11]:=

fourier-series_7.gif

Out[11]=

fourier-series_8.gif

The plot of the function along with some partial sums is given as follows.

In[12]:=

fourier-series_9.gif

Out[12]=

fourier-series_10.gif

For the sine series, the commands are similar as follows. In both instances note the behaviour of the partial sums near the jump discontinuity; the Gibbs effect is apparent.

In[13]:=

fourier-series_11.gif

Out[13]=

fourier-series_12.gif

In[14]:=

fourier-series_13.gif

Out[14]=

fourier-series_14.gif

To illustrate convergence of the partial sums more dynamically, the following code does the trick

Fourier Sine and Cosine Series of gg

The following code presents similar computations and graphical illustration for the function gg.

In[17]:=

fourier-series_15.gif

Out[17]=

fourier-series_16.gif

In[18]:=

fourier-series_17.gif

Out[18]=

fourier-series_18.gif

The above plot illustrates uniform convergence of the partial sums to the function.

In[19]:=

fourier-series_19.gif

Out[19]=

fourier-series_20.gif

In[20]:=

fourier-series_21.gif

Out[20]=

fourier-series_22.gif

A non-piecewise continuous function

In[21]:=

fourier-series_23.gif

This function is continuous everywhere on the interval [0,π] except at the point x=0. The Fourier cosine coefficients are given by (here the built in command for the coefficients is used; see the documentation):

In[22]:=

fourier-series_24.gif

Out[22]=

fourier-series_25.gif

This may cause a "What???" in your mind. The expression on the right is one of the many special functions out there and is known as the Fresnel Cosine integral (see the Documentation Center for a definition). It originally occured in various optics problems.
None the less, we can capture the numerical values and plot the results as follows. This is followed by the same computations for the sine series.

In[23]:=

fourier-series_26.gif

Out[23]=

fourier-series_27.gif

In[24]:=

fourier-series_28.gif

Out[24]=

fourier-series_29.gif

In[25]:=

fourier-series_30.gif

Out[25]=

fourier-series_31.gif

In[26]:=

fourier-series_32.gif

Out[26]=

fourier-series_33.gif

Both plots indicate that the Fourier sine and cosine series of h(x) does indeed converge to the function and in fact blow up at the singular point of h, facts we will not prove but are nonetheless, true.

Built in Functions

With the introduction of Mathematica 8, a variety of Fourier series functions are now built in. Here is one example, others can be seen in the documentation.

In[27]:=

fourier-series_34.gif

Out[28]=

fourier-series_35.gif

In[29]:=

fourier-series_36.gif

Out[29]=

fourier-series_37.gif

Spikey Created with Wolfram Mathematica 8.0