Você está na página 1de 22

The Fourier series

A large class of phenomena can be described as periodic in nature:


. waves, sounds, light, radio, water waves etc
It is natural to attempt to describe these phenomena by means of expansions in
.periodic functions
The Fourier series is an expansion of a function in terms of trigonometric
:sines and cosines
Suppose f(x) is defined over a finite range L x L, i.e. f(x) is periodic with
period 2L. The trigonometric functions are periodic with period 2L = 2 , so it
is natural to expand these functions in terms of trigonometric functions with
/ 2L) 2 n], n
:an argument [(x
1
n
n
f ( x) a0 am cos( x) bm sin( x)
2 m 1 L m 1 L
1 L n 1 L n
an f x cos( x)dx bn f x sin( x)dx
L L L L L L
Example for Fourier series
:Lets take the following function
x|
=f(x) } ; - 8 <= x <= 8
f(x 16n) , n ; otherwise
|

. f(x) is even in x while sin(x) is odd => bns must be zero-


2 L n 2L 4L
L
aifn nis odd
0
x cos(
L
x)dx
n
2 2
[cos(n ) 1] 2 2
n ;

2 L n 2L
L
aifn nis even
0
x cos(
L
x)dx
n
2 2
[cos(n ) 1] 0 ;

L 8
1 n
:the expansion is=> f ( x) (1 2
2

n odd n
2
cos(
L
x))
Example for Fourier series(2)

source: f(x) =|x|, -8 <= x <= 8


L 8
1 n
n= 1
n= 5 f ( x) (1 2
2

n odd n
2
cos(
L
x))
n= 3
y

f(x) Successive
approximations
of f(x)

x
Complex version of the Fourier expansion

: The Euler identity ei cos i sin


:The inverse equations
, sin 1
2i ( e i e i ) cos 12 (e i e i )

Using the formulas above and some properties of exponential function, the
Fourier series can also be written as an expansion in terms of complex
: exponentials as


1 1 L
c e
i ( n / L ) x
f ( x) ( in / L ) x
cn f ( x ) e dx
n , 2L L
n

.here Note: you can read the full explanation


The Fourier transform

=> n . =Lets
dw w
define
L L

The Fourier transform is a generalization of the complex Fourier series in the


:limit as L on the formula we got on the previous slide


1 1 L
c e
i ( n / L ) x
f ( x) ( in / L ) x
cn f ( x ) e dx
n , 2L L
n

2 ^ 1
f ( x)
2
f ( x)e iwx dx
The inverse Fourier transform

By placing the formula 2 in the formula 1 we get the inverse Fourier


: transform formula


1 1 L
c e
i ( n / L ) x
f ( x) ( in / L ) x
cn f ( x ) e dx
n , 2L L
n

3 1 ^
f ( x)
2

f ( x)eiwx dw

Note: you can read the full explanation


here
The discrete Fourier transform
Motivation: computer applications of the Fourier transform require that all of
the definitions and properties of Fourier transforms be translated into
analogous statements appropriate to functions represented by a discrete set of
.sampling points rather than by continuous functions
Let f(x) be a function.
Let {fk = f(xk)} be a set of N function values, xk kx k = 0, 1, , N-1.
Let x be the separation of the equidistant sampling points.
.Assumption: N is even
: The discrete Fourier transform is
^ N
f n (e 2i / N nk
) f k , n 0,1,..., N 1
k 0

: The inverse discrete transform is


1 N 2i / N nk ^
fk
N 1 n 0
(e ) f n , k 0,1,..., N 1
The discrete Fourier transform(2)

: Lets examine more closely the formula of the discrete Fourier transform

^ N
f n (e 2i / N ) nk f k , n 0,1,..., N 1
k 0

2i
wN
We know that N (its called n-th root of unity), so the
:formula above can be rewritten as

^ N ^ ^
f n wn f k , n 0,1,..., N 1 f n f n ( wn )
k

k 0
Usage of the Fast Fourier Transform - motivation
n 1 n 1
.Let A( x) ak x k , B ( x) bk x k be two polynomials
k 0 k 0

.We want to multiply them: C(x) = A(x)*B(x)


Two ways to do this:
2n2 j
1. C ( x ) j , where c j ak b j k
c x
j 0
j

k 0
- takes time ( n 2 )

calculate A(x) and B(x) values in 2n-1 distinct points x0, , x2n-2; ) a. (2
we get two vectors {(x0, y0),,(x2n-2, y2n-2)}, {(x0,z0),,(x2n-2, z 2n-2)};
(b) multiply these vectors: {(x0, y0 z0),,(x2n-2, y2n-2 z 2n-2)}
(c) calculate the polynomial C(x) that passes through the result vector
(interpolation)
- takes time
(n log n) if use FFT
Uniqueness of C(x)
Theorem1: for any set {(x0, y0),,(xn-\, yn-1)} on n distinct points there is a unique
.polynomial C(x) with degree less than n such that yi = C(xi) for i = 0,1,, n-1
n 1

Proof: we can write yi = C(xi) = ck xi for i = 0,1,, n-1 as matrices


k

k 0
: multiplication
c0 c1 y0 y1
... ...
* cn-1 = yn-1

The matrix V(x0 ,..., xn-\ ) is called a Vandermonde matrix.


Since all x0 ,..., xn-\ are distinct, a discriminate of V isnt zero, so it is reversible.
. => we can calculate ci = V (x0 ,..., xn-\ ) -1 yi
Discrete FFT and FFTinverse
.We will use FFT to execute step (a) and FFTinv to execute step (c)
n 1
.Let C ( x) k be a polynomial
c x
k 0
k

We want to execute a step (a): calculate C(x) in n distinct points x0, , xn-1.
.FFT uses special n points wn0, wn1 , wn2 , , wnn-1
wn is called the n-th (complex) root of unity.
.That means that wnn = 1
Properties of n-th root of unity

: Lets examine some properties of wn


.There are exactly n n-th roots of unity: wn0, wn1 , wn2 , , wnn-1 .1
2i / n
Each one of them can be presented as e .
. wn is called the principal n-th root of unity
The inverse of wn is wn-1 = wnn-1: wn * wn-1 = wn0 = 1; .2
. 2i / dn dk
w n * w n-1
= w
2i / n k
n n
n
=1
(e ) (e )
. wdn = wn : wdn =
dk k dk
= = wnk. 3
e 2i / 2
.wnn/2 = w2 = -1 : wnn/2 = w(n/2)*2n/2 = (by property 3) w2 = = -1 .4
Properties of n-th root of unity(2)

:If n > 0 and n is even => (wnk ) 2 = wn/2k , k = 0, 1, , n1. 5


. =
2 (e 2i / n =) 2 k (e 2i / n /=2 )wkn/2k) wnk. (
. 2 = wn2k+n = wn2k wnn = wn2k = (wnk ) 2 = wn/2k) wnk+n/2. (
n 1 n 1
( w k n
) 1 ( w n k
) 1 (1) k
1
. (w
j 0
k
n ) 0
j
( wn
k j
) n

wn 1
k
n

wn 1
k :

wn 1
k
0
.6
j 0

geometry series formula


DFFT preview
n 1
.Let pc ( x) k be a polynomial
c x
k 0
k

.We want to execute a step (a): calculate pc(x) in wn0, wn1 , wn2 , , wnn-1
Observation:
Let c (c0 , c1 ,..., cn 1 ) be an n-tuple of the coefficients of pc(x).
Assume that n is power of 2 (if it isnt, we force it to be by adding 0s).
a (c0 , c2 ,..., cn 2 ) Let b (c1 , c3 ,..., cn 1 ) and
p
wherec ( x ) p (
is the x 2
) xp
a polynomial b ( x 2
) is
that pa , =<
defined by the vector a, and p b is the polynomial that is defined by the
. vector b
p (
<= c nw i
) p a ( wn
2i
) w i
n bp ( w 2i
n )

. Let t = n/2 =< wnt = wnn/2 = -1


: for i < n/2=>
pc ( wni ) p a ( wn2i ) wni p b ( wn2i )
pc ( wni ) p a ( wn2i ) wnj t p b ( wn2i ) p a ( wn2i ) wnj p b ( wn2i )
: for i >= n/2
DFFT algorithm
DFFT ( c (c0 , c1 ,..., cn 1 ) , wn) :
// n is a power of 2 and wnn/2 = -1 //
array C[0, , n 1] // for the answer
if n = = 1 then C[0] c[0]
else
t n/2
arrays a, b, A, B [0,,t 1] // intermediate arrays
for i 0 to t 1 do:
a[i] c[2i]
b[i] c[2i + 1]
// recursive Fourier transform computation
A DFFT (a, wn2 )
B DFFT (b, wn2 )
// Fourier transform computation of the vector c
for i 0 to t 1 do:
temp = wni
C[i] A[i] + temp * B[i]
C[t + i] A[i] temp * B[i]
temp temp * wn
return C // return the answer
DFFT algorithm - example

Let n = 8 and c = (255, 8, 0, 226, 37, 240, 3, 0).


.Let F257 be a finite field => w8 = 4 (48 mod 257 = 1)

a = (255, 0, 37, 3), b = (8, 226, 240, 0)) 1


recursive call with t = 8 / 2 = 4 and w82 = 42 = 16: ) 2
A = [38, 170, 32, 9], B = [217, 43, 22, 7]
C[0] 38 + 217 = 255 C[4] 38 217) 3
C[1] 170 + 43* w8 = 85 C[5] 170 43* w8 = 255
C[2] 32 + 22 * w82= 127 C[6] 32 22 * w82= 194
C[3] 9 + 7 * w83 = 200 C[7] 9 7 * w83 = 75
.The final result is: C = (255, 85, 127, 200, 78, 255, 194, 75)) 4
DFFT algorithm execution time

.We have log(n) recursive calls


For each call:
- n multiplications w8i+1 w8i * w8
- n multiplications of const * w8i , i = 0, 1, , n / 2 - 1
- n / 2 additions, n / 2 subtractions

=> (n) arithmetical instructions, each costs (1)

DFFT algorithm execution time is=> (n log n)


DFFTinv algorithm - preview

We want to execute a step (c) calculate the polynomial C(x) that passes through
the result vector (interpolation)
n 1

ck wn for i = 0,1,, n-1 as matrices multiplication


ik
: We can write yi = C(wni) =
k 0

c0 c1 y0 y1
... ...
* cn-1 = yn-1

The matrix Vij(x0 ,..., xn-\ ) is called a Vandermonde matrix.


Since all x0 ,..., xn-\ are distinct, a discriminate of Vij isnt zero, so it is reversible.
. => we can calculate ci = Vij (x0 ,..., xn-\ ) -1 yi
DFFTinv algorithm preview(2)

Theorem: let Vij (x0 ,..., xn-\ ) be the matrix as above.


.Then the inverse matrix of Vij is Vij-1 = n-1 wn-ij
.Proof: we already saw that Vij-1 exists
n 1 n 1

=> ik kj
V
k 0
V n 1
n
w (i j ) k

k 0
= Vij * Vij-1
n 1
n 1 1 n * n 1
i. if i = j, then wn(i - j)k = wn0 = 1, and so k 0
n 1
n 1 wn(i j ) k n 1 * 0 0
ii. else, then k 0 (by property 6)

. So we get that Vij * Vij-1 = In


DFFTinv algorithm

DFFTinv (C[0, , n 1] , wn) :


// n is a power of 2 and wnn/2 = -1 //
array c[0, , n 1] // for the answer
c DFFT (C[0, , n 1] , wnn-1 ) // remember that wn-1 = wnn-1
for i 0 to n 1 do:
c[i] n-1* c[i]
return c // return the answer
DFFTinv algorithm - example

Let n = 8 and C = (255, 85, 127, 200, 78, 255, 194, 75).
.Let F257 be a finite field => w8 = 4 (48 mod 257 = 1)

.w8-1 = w87 = 193) 1


calculate DFFT(C, 193): ) 2
c = [241, 64, 0, 9, 39, 121, 24, 0]
multiply c by n-1 = 225 (225 * 8 mod 257 = 1)) 3
.The final result is: c = (255, 8, 0, 226, 37, 240, 3, 0)) 4
DFFTinv algorithm execution time

DFFT takes (n log n) time .

n multiplications c[i] n-1 * c[i]

=> (n) arithmetical instructions, each costs (1)

DFFTinv algorithm execution time is=> (n log n)

Você também pode gostar