Trigonometric Polynomial Approximation the Discrete Fourier Transform Trigonometric Least Squares Solution
Total Page:16
File Type:pdf, Size:1020Kb
Trigonometric Polynomial Approximation The Discrete Fourier Transform Trigonometric Least Squares Solution Numerical Analysis and Computing Lecture Notes #14 — Approximation Theory — Trigonometric Polynomial Approximation Joe Mahaffy, [email protected] Department of Mathematics Dynamical Systems Group Computational Sciences Research Center San Diego State University San Diego, CA 92182-7720 http://www-rohan.sdsu.edu/∼jmahaffy Spring 2010 Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (1/22) Trigonometric Polynomial Approximation The Discrete Fourier Transform Trigonometric Least Squares Solution Outline 1 Trigonometric Polynomial Approximation Introduction Fourier Series 2 The Discrete Fourier Transform Introduction Discrete Orthogonality of the Basis Functions 3 Trigonometric Least Squares Solution Expressions Examples Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (2/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Fourier Series Trigonometric Least Squares Solution Trigonometric Polynomials: A Very Brief History ∞ ∞ P(x)= an cos(nx)+ i an sin(nx) n=0 n=0 1750s Jean Le Rond d’Alembert used finite sums of sin and cos to study vibrations of a string. 17xx Use adopted by Leonhard Euler (leading mathematician at the time). 17xx Daniel Bernoulli advocates use of infinite (as above) sums of sin and cos. 18xx Jean Baptiste Joseph Fourier used these infinite series to study heat flow. Developed theory. Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (3/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Fourier Series Trigonometric Least Squares Solution Fourier Series: First Observations For each positive integer n, the set of functions {Φ0, Φ1,..., Φ2n−1}, where 1 Φ0(x) = 2 Φk (x) = cos(kx), k = 1,..., n Φn+k (x) = sin(kx), k = 1,..., n − 1 is an Orthogonal set on the interval [−π, π] with respect to the weight function w(x)=1. Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (4/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Fourier Series Trigonometric Least Squares Solution Orthogonality Orthogonality follows from the fact that integrals over [−π, π] of cos(kx) and sin(kx) are zero (except cos(0)), and products can be rewritten as sums: cos(θ − θ ) − cos(θ + θ ) sin θ sin θ = 1 2 1 2 1 2 2 cos(θ1 − θ2) + cos(θ1 + θ2) cos θ1 cos θ2 = 2 sin(θ − θ ) + sin(θ + θ ) 1 2 1 2 sin θ1 cos θ2 = . 2 Let Tn be the set of all linear combinations of the functions {Φ0, Φ1,..., Φ2n−1}; this is the set of trigonometric polynomials of degree ≤ n. Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (5/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Fourier Series Trigonometric Least Squares Solution The Fourier Series, S(x) For f ∈ C[−π, π], we seek the continuous least squares approximation by functions in Tn of the form − a n 1 S (x) = 0 + a cos(nx) + (a cos(kx) + b sin(kx)) , n 2 n k k k=1 where, thanks to orthogonality 1 π 1 π ak = f (x) cos(kx) dx, bk = f (x) sin(kx) dx. π −π π −π Definition (Fourier Series) The limit S(x) = lim Sn(x) n→∞ is called the Fourier Series of f . Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (6/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Fourier Series Trigonometric Least Squares Solution Example: Approximating f (x)= |x| on [−π, π] 1 of 2 First we note that f (x) and cos(kx) are even functions on [−π, π] and sin(kx) are odd functions on [−π, π]. Hence, 1 π 2 π a0 = |x| dx = x dx = π. π −π π 0 Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (7/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Fourier Series Trigonometric Least Squares Solution Example: Approximating f (x)= |x| on [−π, π] 1 of 2 First we note that f (x) and cos(kx) are even functions on [−π, π] and sin(kx) are odd functions on [−π, π]. Hence, 1 π 2 π a0 = |x| dx = x dx = π. π −π π 0 1 π 2 π ak = |x| cos(kx) dx = x cos(kx) dx π −π π 0 2 sin(kx) π 2 π = x − 1 · sin(kx) dx k k π 0 π 0 0 2 2 = [cos( kπ) − cos(0)] = (−1)k − 1 . k2 k2 π π Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (7/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Fourier Series Trigonometric Least Squares Solution Example: Approximating f (x)= |x| on [−π, π] 1 of 2 First we note that f (x) and cos(kx) are even functions on [−π, π] and sin(kx) are odd functions on [−π, π]. Hence, 1 π 2 π a0 = |x| dx = x dx = π. π −π π 0 1 π 2 π ak = |x| cos(kx) dx = x cos(kx) dx π −π π 0 2 sin(kx) π 2 π = x − 1 · sin(kx) dx k k π 0 π 0 0 2 2 = [cos( kπ) − cos(0)] = (−1)k − 1 . k2 k2 π π 1 π bk = |x| sin(kx) dx = 0. π −π even × odd = odd. Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (7/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Fourier Series Trigonometric Least Squares Solution Example: Approximating f (x)= |x| on [−π, π] 2 of 2 n π 2 (−1)k − 1 We can write down Sn(x)= + cos(kx) 2 π k2 k=1 4 f(x) S0(x) 3 2 1 0 -2 0 2 Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (8/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Fourier Series Trigonometric Least Squares Solution Example: Approximating f (x)= |x| on [−π, π] 2 of 2 n π 2 (−1)k − 1 We can write down Sn(x)= + cos(kx) 2 π k2 k=1 4 f(x) S1(x) 3 2 1 0 -2 0 2 Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (8/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Fourier Series Trigonometric Least Squares Solution Example: Approximating f (x)= |x| on [−π, π] 2 of 2 n π 2 (−1)k − 1 We can write down Sn(x)= + cos(kx) 2 π k2 k=1 4 f(x) S3(x) 3 2 1 0 -2 0 2 Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (8/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Fourier Series Trigonometric Least Squares Solution Example: Approximating f (x)= |x| on [−π, π] 2 of 2 n π 2 (−1)k − 1 We can write down Sn(x)= + cos(kx) 2 π k2 k=1 4 f(x) S5(x) 3 2 1 0 -2 0 2 Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (8/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Fourier Series Trigonometric Least Squares Solution Example: Approximating f (x)= |x| on [−π, π] 2 of 2 n π 2 (−1)k − 1 We can write down Sn(x)= + cos(kx) 2 π k2 k=1 4 f(x) S7(x) 3 2 1 0 -2 0 2 Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (8/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Fourier Series Trigonometric Least Squares Solution Example: Approximating f (x)= |x| on [−π, π] 2 of 2 n π 2 (−1)k − 1 We can write down Sn(x)= + cos(kx) 2 π k2 k=1 4 f(x) S0(x) S1(x) 3 S3(x) S5(x) S7(x) 2 1 0 -2 0 2 Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (8/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Discrete Orthogonality of the Basis Functions Trigonometric Least Squares Solution The Discrete Fourier Transform: Introduction The discrete Fourier transform, a.k.a. the finite Fourier transform, is a transform on samples of a function. It, and its “cousins,” are the most widely used mathematical transforms; applications include: Signal Processing Image Processing Audio Processing Data compression A tool for partial differential equations etc... Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (9/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Discrete Orthogonality of the Basis Functions Trigonometric Least Squares Solution The Discrete Fourier Transform Suppose we have 2m data points, (xj , fj ), where jπ x = −π + , and f = f (x ), j = 0, 1,..., 2m − 1. j m j j The discrete least squares fit of a trigonometric polynomial Sn(x) ∈ Tn minimizes 2m−1 2 E(Sn)= [Sn(xj ) − fj ] . j=0 Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (10/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Discrete Orthogonality of the Basis Functions Trigonometric Least Squares Solution Orthogonality of the Basis Functions? We know that the basis functions 1 Φ0(x) = 2 Φk (x) = cos(kx), k = 1,..., n Φn+k (x) = sin(kx), k = 1,..., n − 1 are orthogonal with respect to integration over the interval. The Big Question: Are they orthogonal in the discrete case? Is the following true: 2m−1 Φk (xj )Φl (xj )= αk δk,l ??? j=0 Joe Mahaffy, [email protected] Trig. Polynomial Approx. — (11/22) Trigonometric Polynomial Approximation Introduction The Discrete Fourier Transform Discrete Orthogonality of the Basis Functions Trigonometric Least Squares Solution Orthogonality of the Basis Functions! (A Lemma)... Lemma If the integer r is not a multiple of 2m, then 2m−1 2m−1 cos(rxj )= sin(rxj ) = 0. j=0 j=0 Moreover, if r is not a multiple of m, then 2m−1 2m−1 2 2 [cos(rxj )] = [sin(rxj )] = m.