:

## Computing Fourier series using the package Fourier

by Karel Srot, Department of mathematics at Masaryk University, Czech Republic,

NOTE: This worksheet solves some examples using the package Fourier. This package provides procedures for computing Fourier series of real functions, drawing plots and animations. Especially animations illustrates the convergence of Fourier series in a comprehensive form. The usage of procedures from package Fourier is described in its help file.

The recent czech/english version of the package Fourier (as well as some exported examples) can be found at www.math.muni.cz/~xsrot/frady. Unfortunately, this website is only in czech at the present.

> restart;

Making package Fourier available. If it is not correctly installed, it is necessary to use the worksheet with sources.

> with(Fourier);

Find the Fourier series of the function f(x)=sgn(cos x) on the interval and draw the plots of partial sums , and together with periodic extension of function f.

> f:=x->signum(cos(x)):

> FSeries:=FSeriesOfFunction(f,-Pi..Pi);

First we put the graph of periodic extension into the variable. Then we use it as a background when drawing the graphs of partial sums.

> g1:=PeriodicExtension(f,-Pi..Pi,-7..7):

> AnimGraphOfFSeries(FSeries,[1,3,5],-7..7,[g1]);

>

>

Find the Fourier series of the function f(x)=abs(sin x) on the interval and draw the plots of partial sums , , and together with periodic extension of function f.

> f:=x->abs(sin(x));

> FSeries:=FSeriesOfFunction(f,-Pi..Pi);

In earlier versions of module Fourier was neccessary to solve this problem manually (because of 0 in dominator when n=1). Now it is solved correctly.

To draw the plot we use the same technique as in previous example..

> g1:=PeriodicExtension(f,-Pi..Pi,-Pi..Pi):

> AnimGraphOfFSeries(FSeries,[1,3,5,7],-Pi..Pi,[g1]);

>

>

Find the FS of the function f(x)=x sin(x) a draw tha animation which shows the convergence of the FS.

> f:=x->x*sin(x);

> FSeries:=FSeriesOfFunction(f,-Pi..Pi);

> g1:=PeriodicExtension(f,-Pi..Pi,-6..6):

> AnimGraphOfFSeries(FSeries,10,-6..6,[g1],start=1,insequence=true, commentpoint=[-3,2]);

other examples

> f:=x->piecewise(x<0,1/2*x,2*x);

> FSeries:=FSeriesOfFunction(f,-Pi..Pi);

> g1:=PeriodicExtension(f,-Pi..Pi,-6..6):

> AnimGraphOfFSeries(FSeries,[1,3,5],-6..6,[g1]);

>

>

> f:=x->piecewise(x<0,a,b);

> FSeries:=FSeriesOfFunction(f,-Pi..Pi);

>

>

>

>

This post generated using the online HTML conversion tool