Sunteți pe pagina 1din 37

Fourier series

Jose Rodellar, jose.rodellar@upc.edu


Control, Dinamica i Aplicacions - CoDAlab
Departament de Matematica Aplicada III
Universitat Politecnica de Catalunya
Barcelona, Spain

Mathematical tools for hydroinformatics


European Master in Hydroinformatics and Water
Management

European Master EUROAQUAE Mathematical tools


Purpose of these notes

This material is written to give the students a mathematical


background for the Fourier series, which can be used to
construct analytical solutions for some problems with partial
differential equations.

In addition, Fourier series are very useful to represent functions


in many practical problems.

European Master EUROAQUAE Mathematical tools


Fourier series - Outline

Sets of orthogonal vectors


Sets of orthogonal functions
Fourier series
Mean square approximation
Orthonormal basis and representation of functions

European Master EUROAQUAE Mathematical tools


Sets of orthogonal vectors
Consider a vector space in <3 with an orthonormal basis {i, j,
k}, along the axis x, y, z. Each vector in this space can be
decomposed in the form
f = f1 i + f2 j + f3 k,
where f1 , f2 , f3 are the components which uniquely define the
vector f.
Define the internal product of two vectors f, g in the form
3
X
hf, gi = fi g i .
i=1

and the norm of a vector


v
u 3
p uX
kfk = hf, fi = t fi2 .
i=1

kfk > 0 for all f except that k0k = 0.


European Master EUROAQUAE Mathematical tools
We say that f, g are orthogonal if

hf, gi = 0 .

Be v1 , v2 , v3 non null vectors. They are called a orthogonal


vector set if hvn , vm i = 0 for any n 6= m.

Any orthogonal set can be turn into a so-called orthonormal


base with the vectors having norm 1 in the form
vn
un = , n = 1, 2, 3 .
kvn k

such that

0, for n 6= m
hun , um i =
1, for n = m .

European Master EUROAQUAE Mathematical tools


Every vector f can be expressed as a linear combination of the
vectors {un } in the form
3
X
f= cn u n ,
n=1

where the coefficients cn IR are calculated in the form

X3 3
X 3
X
hf, ui i = h cn un , ui i = hcn un , ui i = cn hun , ui i = ci .
n=1 n=1 n=1

Then
cn = hf, un i .
Geometric meaning: cn are the projections of vector f on the
directions defined by the unit vectors un .

European Master EUROAQUAE Mathematical tools


Sets of orthogonal functions
Consider a function space: a set of functions such that any
linear combination lies inside the set. As prototype, consider
I = [0, `] and the set Cs (I) of piecewise continuous functions on
I.

Be p Cs (I) a strictly positive function that is named weighting


function.
We define the internal product of two functions f , g C(I) with
respect to the weight p as
Z `
hf , gi = f (x)g(x)p(x)dx.
0

If we see a function f as a vector of infinite dimension whose


components are the values f (x) at the infinite points x I, this
internal product can be interpreted as the extension of the
internal product for two vectors.
European Master EUROAQUAE Mathematical tools
We define the norm of a function:
q hZ ` i1/2
kf k = hf , f i = f (x)2 p(x)dx 0.
0

If kf k = 0, then f (x) = 0 for all x [0, `].

Two functions f y g are orthogonal if


Z `
hf , gi = f (x)g(x)p(x)dx = 0 .
0

Be {n }n=1,2,... a set of functions. It is called orthogonal set if


hn , m i = 0 for any n 6= m.

European Master EUROAQUAE Mathematical tools


If no function has null norm, we may normalize them:

n (x)
n (x) = , n = 1, 2, . . . .
kn (x)k

These functions forma a orthonormal set, that is


Z 
0, for n 6= m
hn , m i = n (x)m (x)p(x) = dx =
I 1, for n = m .

European Master EUROAQUAE Mathematical tools


Example
n  nx o
sin is a orthogonal set in I = [0, `] with respect
` n=1,2,...
to the the weight p(x) = 1.

Indeed, we may check that


Z `  nx   mx  
0, for n 6= m
sin sin dx =
0 ` ` `/2, for n = m .
p
All these functions have norm `/2. Then the functions
r  nx 
2
n (x) = sin , n = 1, 2, . . .
` `
form a orthonormal set in [0, `].

European Master EUROAQUAE Mathematical tools


Example
The functions
r  nx 
1 2
0 (x) = , n (x) = cos , n = 1, 2, . . .
` ` `

form a orthonormal set in [0, `].

Example
The functions
1 1  2nx 
c0 (x) = , cn (x) = cos
2` ` `

1  2nx 
sn (x) = sin , n = 1, 2, . . .
` `
form a orthonormal set in [0, `].

European Master EUROAQUAE Mathematical tools


Fourier series

Be {n (x)}n=1,2,... a orthonormal set in Cs (I). Given a function


f Cs (I), we have interest in expressing this function as an
infinite series of the orthonormal functions in the form

X
f (x) = cn n (x)
n=1

with appropriate coefficients cn .

This expression is the natural extension of decomposing a


vector into components in a basis. It involves two fundamental
questions:
1) Is it valid for all x [0, `] ?
2) How to select the coefficients cn ?

European Master EUROAQUAE Mathematical tools


Let us assume that this expression is true for all x [0, `].

Using the internal product, we can write



DX
E Z ` hX i
hf , i i = cn n , i = cn n (x) i (x)p(x)dx .
n=1 0 n=1

Assuming the series can be integrated term by term we


continue the calculation in the form

X Z `
hf , i i = cn n (x)i (x)p(x)dx = ci ,
n=1 0

where we have used that the funcions n (x) are orthonormal !!

European Master EUROAQUAE Mathematical tools


In summary

If f (x) =
P
n=1 cn n (x) for all x [0, `] and if the series can be
integrated term by term, then the coefficients are uniquely
determined by the formula
Z `
cn = hf , n i = f (x)n (x)p(x)dx . (1)
0
For a general orthonormal set and a general class of functions
f (x), it can be difficult to ensure both conditions a priori.
However, the formula (1) can be calculated even if the infinite
series does not converge to f (x) for all x. The only condition is
that f (x)n (x)p(x) are integrable in [0, `]. This is not a very
restrictive condition since it may be satisfied by general classes
of functions.

European Master EUROAQUAE Mathematical tools


Given a function, we directly construct a Fourier series

Given f (x) in I = [0, `], we calculate a set of coefficients cn with


the expressions
Z `
cn = hf , n i = f (x)n (x)p(x)dx , n = 1, 2, . . . , (2)
0

and we construct the infinite series



X
f (x) cn n (x) . (3)
n=1

It is called the Fourier series of f with respect to the


orthonormal set {n }.
The constants cn are named the Fourier coefficients of the
function.

European Master EUROAQUAE Mathematical tools


The sign () in (3) is a graphical form of indicating the
association between the function and its Fourier series without
a priori requiring a point to point identification.

This is one way of representing a function through a linear


decomposition in an infinite set of orthonormal functions {n }.
The Fourier coefficients {cn } are the components, in an analogy
with the decomposition of a vector in a base.

In general, it may happen that the Fourier series does not


converge or does not coincide with the value of f (x) at all points
in x [0, `]. This coincidence would be the ideal case in which

X
f (x) = cn n (x).
n=1

However, in general the Fourier series represents the function


in a weaker but practical form refereed to as mean square.

European Master EUROAQUAE Mathematical tools


Mean square approximation

Consider the first N functions of a orthonormal set in Cs (I) and


the linear combination

N (x) = 1 1 (x) + 2 2 (x) + + N N (x) (4)

with some coefficients i .

We define
Z `
2
EN = kf N k = [f (x) N (x)]2 p(x)dx (5)
0
as the mean square error when f is approximated by N .

It gives an overall measure of the approximation on the whole


domain, instead of focussing point to point.

European Master EUROAQUAE Mathematical tools


Problem: Find the coefficients i such that EN is minimum

Z `h N
X i2 Z `
EN = f (x) n n (x) p(x)dx = f (x)2 p(x)dx+
0 n=1 |0 {z }
kf k2
N
Z ` hX i2 Z ` N
X
n n (x) p(x)dx 2 f (x) n n (x)p(x)dx ,
0 n=1 0 n=1
| {z } | {z }
I2 PN
n=1 n cn

where cn are the Fourier coefficients.

European Master EUROAQUAE Mathematical tools


N
Z ` hX N
i hX i
I2 = n n (x) m m (x) p(x)dx
0 n=1 m=1
N
X N
X hZ ` i XN
n m m (x)n (x)p(x)dx = n2 ,
n=1 m=1 0 n=1

Then
N
X N
X N
X N
X
2
EN = kf k + n2 2 n cn = kf k + 2
(n cn ) 2
c2n .
n=1 n=1 n=1 n=1
| {z }

Since all the terms are non-negative, the minimum of EN is


attained when n = cn , n = 1, 2, . . . , N. And it is given by
N
X
min EN = kf k2 c2n . (6)
n=1

European Master EUROAQUAE Mathematical tools


From (6) we have that the bound N 2 2
P
n=1 cn kf k .
2
Since all the cn are positive, the infinite series for N is
convergent and also bounded:

X
c2n kf k2 .
n=1

Since the n-term of a convergent series goes to 0, we have

lim cn = lim hf , n i = 0 .
n n

The error reduces as N , so that the minimum error (the


better approximation) is when the complete Fourier series is
used:

X
2 2
E = lim {min EN } = lim kf N k = kf k c2n .
N N
n=1

European Master EUROAQUAE Mathematical tools


Compilation
Be {n (x)}n=1,2,... a orthonormal set in Cs (I) and the Fourier
series of a function f :
X
cn = hf , n i; f (x) cn n (x) .
n=1

We have learned the following properties:



X
c2n kf k2 , (Bessel inequality)
n=1
lim cn = 0.
n
Among all the possible linear combinations with {n (x)},
the Fourier series is the best representation of f in the mean
square sense. The mean square error is
X
X
E = kf cn n k2 = kf k2 c2n .
n=1 n=1

European Master EUROAQUAE Mathematical tools


Orthonormal basis
The best case occurs when the mean square error is 0. In this
case, we say that the Fourier series converges to f in the mean
square sense.
In this case, the Parseval identity holds:

X
kf k2 = c2n . (7)
n=1

Definition
We say that {n (x)}n=1,2,... is a orthonormal base (or a complete
set) in a function space when, for any function f belonging to
the space, its Fourier series converges to f in mean square, that
is
XN
lim kf cn n (x)k2 = 0.
N
n=1

European Master EUROAQUAE Mathematical tools


Example
s
n 2 nx o
sin
p` ` n=1,2,...
s s
n 1 2 nx o
, cos
p` p` ` n=1,2,...
s s s
n 1 2 2nx 2 2nx o
, cos , sin
p` p` ` p` ` n=1,2,...

are orthonormal bases in the space of piecewise continuous


functions in [0, `].

European Master EUROAQUAE Mathematical tools


Uniqueness of the Fourier series

Consider Fourier Pseries2 in a orthonormal base. The Parseval


identity kf k2 = n=1 cn says that the only way for a function f
to have all its coefficients equal to 0 is to have kf k = 0.

Consider now two functions f (x) and g(x) with Fourier


coefficients cn and dn respectively. Then the function f (x) g(x)
has coefficients cn dn . Therefore, the only way to have cn = dn
for all n = 1, 2, . . . is that kf gk = 0.

This means to be f (x) = g(x) for all points x [0, `] except


possibly at a discrete number of points.

European Master EUROAQUAE Mathematical tools


Conclusion

For a given piecewise continuous function, its Fourier


coefficients give a unique representation

in the sense that no other functions (except those differing


in a discrete number of points) have the same coefficients.

The Fourier coefficients are the components of the


function in the orthonormal basis.

The corresponding Fourier series is the best


representation of the function in the mean square sense.

European Master EUROAQUAE Mathematical tools


Examples of Fourier series

Consider the interval


I = [0, 1] and the orthonormal function
base {n (x) = 2 sin(nx)}n=1,2,... .

Let us see the Fourier series of several functions with respect to


this base with the Fourier coefficients calculated by
Z 1
cn = < f , n > = f (x)n (x)dx .
0

All the calculations and plots are done with Maple.

European Master EUROAQUAE Mathematical tools


Maple program

Define n (x) = 2 sin(nx)
> phi:=(n,x)->sqrt(2)*sin(n*Pi*x);
Define f (x) = x
> f:=x->x;
R1
Calculate the Fourier coefficients cn = 0 f (x)n (x)dx
> c:=n->int(f(x)*phi(n,x),x=0..1);
assume(n,integer);

(1)n 2

n

European Master EUROAQUAE Mathematical tools


Maple program, cont
Plot the coefficients to observe their convergence to 0.
> coefs:=[seq([n,c(n)], n=1..20)];
> plot(coefs,n=1..20, style=point,
symbol=circle);

0.4

0.3

0.2

0.1

0.0

5 10 15 20
0.1 n~

0.2

European Master EUROAQUAE Mathematical tools


Maple program, cont
Calculate partial summations SN (x) = N
P
n=1 cn n (x) and
error approximation |f (x) SN (x)|.
> SF:=(N,x)-> sum(c(n)*phi(n,x), n=1..N);
> EF:=(N,x)-> abs(f(x)-SF(N,x));
Plot several approximations to observe their convergence
to the function.
> plot(f(x),SF(1,x), SF(5,x),x=0..1,
thickness=2);
> plot(EF(1,x), EF(5,x), EF(20,x),x=0..1,
thickness=2);

European Master EUROAQUAE Mathematical tools


Maple program, cont
1.0
1.0

0.75 1.0 0.75

0.5 0.75
0.5

0.25 0.5
0.25

0.25
0.0 0.0
0.0 0.25 0.5 0.75 1.0
0.0
0.0 0.25 0.5 0.75 1.0
x
x
0.0 0.25 0.5 0.75 1.0
x
f(x)=x N=5
N=1 f(x)=x N=1
N=5 N=15 N=15

The accuracy improves as the number of terms N increases.


The approximation is slower for points close to the end x = 1
and none of the functions SN attain the value f (1) = 1.
This is due to the fact that all the orthonormal functions give
n (1) = 0.

European Master EUROAQUAE Mathematical tools


Example 2

1, for 0 x 0.5
f (x) =
1, for 0.5 x 1
> g:=x->piecewise(x<0.5,1,x>0.5, -1);
Fourier coefficients:

cn = 0.4501581581 1.0+cos(1.570796327
n
n)

n
+0.4501581581 1.0 cos(1.570796327
n
n)+(1.0)

0.8

0.6
Most of the coefficients
are 0.
0.4
The only cn 6= 0 are
0.2
c2 , c6 , c10
0.0

5 10 15 20 25 30
x

European Master EUROAQUAE Mathematical tools


Example 2, cont.
1.0
1

0.75

0
0.5
0.0 0.25 0.5 0.75 1.0
x 0.25
1
0.0
0.0 0.25 0.5 0.75 1.0
f(x) x

N=26
N=10
N=2 N=2
N=10 N=26

As N increases, the series converges to f (x) at the points where f


is continuous. Near the discontinuity points, the approximation
sN overshoots the function (Gibbs phenomenon) . Even for
N , sN does not match the function at these points.

European Master EUROAQUAE Mathematical tools


Example 3

f (x) = x4 (x 1)
Fourier coefficients:
 
2 3 + 12 (1)1+n + (1)n n2 2
8
n5 5

0.03

0.02
The coefficients go to
0.01
0 very fast
(with n15 ).
0.0
0 1 2 3 4 5 6 7 8 9 10
0.01 x

0.02

European Master EUROAQUAE Mathematical tools


Example 3, cont.
0.025
0.075

0.02
0.05
0.015

0.025 0.01

0.005
0.0
0.0
0.0 0.25 0.5 0.75 1.0
x 0.0 0.25 0.5 0.75 1.0
x

f(x) N=2
N=5 N=5
N=2 N=10

SN (x) matches the function at all points with a very small


number of terms.
Notice that in this case, f (x) is continuous at all points and
the orthonormal functions coincide with f at the extreme
ends.

European Master EUROAQUAE Mathematical tools


On convergence of the Fourier series

In all the examples, as expected from the presented theory, we


have seen that
The functions SN (x) converge to the given function f (x) in
the mean square sense.
The Fourier coefficients cn 0.
More refined convergences have been also observed in the
examples depending on some conditions on the functions and
the conditions at the extreme ends of the interval domain.

They can be understood from the following theorems.

European Master EUROAQUAE Mathematical tools


Theorem Pointwise convergence
Let the set {n (x)}n=1,2,... be a orthonormal base of
eigenfunctions. Suppose that f and its derivative f 0 are
piecewise continuous on x [0, `]. Then the Fourier series for f
converges to f (x) at every x where f is continuous.

If f is discontinuous at x = x0 , the Fourier series converges to


the average

f (x+
0 ) + f (x0 )
2

where f (x+
0 ) = limxx+ and f (x0 ) = limxx .
0 0

This theorem has been illustrated by the examples 1 and 2.

European Master EUROAQUAE Mathematical tools


Theorem Uniform convergence
Suppose that f is continuous and has continuous first and
second derivatives on the closed interval [0, `].

Suppose that f and the orthonormal functions {n (x)}n=1,2...


satisfy the same conditions at the interval ends (for example
they are 0 like in the example 3).

Then, the Fourier series converges uniformly to f (x) on the


closed interval [0, `].

In pointwise convergence, the quality of the convergence


depend on each point x. Uniform convergence is stronger, has
an overall character independent on the values of x.

Compare example 3 (uniform convergence) with the examples


1-2 (pointwise convergence).

European Master EUROAQUAE Mathematical tools

S-ar putea să vă placă și