#%config InlineBackend.figure_format = 'svg'
from pylab import *
Periodic functions can be approximated by a series of sine and cosine functions. This leads us to the Fourier transform of a function defined on a bounded interval and we can think of this function being extended periodically to R \re R .
6.11.1 Fourier series ¶ Let f : [ − π , π ] → R f : [-\pi,\pi] \to \re f : [ − π , π ] → R be a function which is extended periodically to the whole real line. The Fourier series is defined as
S f ( x ) = a 0 + ∑ k = 1 ∞ [ a k cos ( k x ) + b k sin ( k x ) ] Sf(x) = a_0 + \sum_{k=1}^\infty [ a_k \cos(k x) + b_k \sin(k x) ] S f ( x ) = a 0 + k = 1 ∑ ∞ [ a k cos ( k x ) + b k sin ( k x )] where
a 0 = 1 2 π ∫ − π π f ( x ) d x a k = 1 π ∫ − π π f ( x ) cos ( k x ) d x , k = 1 , 2 , … b k = 1 π ∫ − π π f ( x ) sin ( k x ) d x , k = 1 , 2 , … \begin{align*}
a_0 &= \frac{1}{2\pi} \int_{-\pi}^\pi f(x) \ud x \\
a_k &= \frac{1}{\pi} \int_{-\pi}^\pi f(x) \cos(k x) \ud x, \qquad k=1, 2, \ldots \\
b_k &= \frac{1}{\pi} \int_{-\pi}^\pi f(x) \sin(k x) \ud x, \qquad k=1, 2, \ldots
\end{align*} a 0 a k b k = 2 π 1 ∫ − π π f ( x ) d x = π 1 ∫ − π π f ( x ) cos ( k x ) d x , k = 1 , 2 , … = π 1 ∫ − π π f ( x ) sin ( k x ) d x , k = 1 , 2 , … Due to periodicity k k k only takes integer values.
The Fourier series can be written as
S f ( x ) = ∑ k = − ∞ ∞ f ^ k e i k x , f ^ k = 1 2 π ∫ − π π f ( x ) e − i k x d x Sf(x) = \sum_{k=-\infty}^\infty \hat f_k \ee^{\ii k x}, \qquad \hat f_k = \frac{1}{2\pi} \int_{-\pi}^\pi f(x) \ee^{-\ii k x} \ud x S f ( x ) = k = − ∞ ∑ ∞ f ^ k e i k x , f ^ k = 2 π 1 ∫ − π π f ( x ) e − i k x d x where
f ^ 0 = a 0 , f ^ k = { 1 2 ( a k + i b k ) , k = − 1 , − 2 , … 1 2 ( a k − i b k ) , k = + 1 , + 2 , … \hat f_0 = a_0, \qquad \hat f_k = \begin{cases}
\half(a_k + \ii b_k), & k = -1, -2, \ldots \\
\half(a_k - \ii b_k), & k = +1, +2, \ldots
\end{cases} f ^ 0 = a 0 , f ^ k = { 2 1 ( a k + i b k ) , 2 1 ( a k − i b k ) , k = − 1 , − 2 , … k = + 1 , + 2 , … If f ( x ) f(x) f ( x ) is real, a k , b k a_k, b_k a k , b k are real and we have
f ^ − k = f ^ k ‾ , k = 1 , 2 , … \hat f_{-k} = \conj{\hat f_k}, \qquad k=1,2,\ldots f ^ − k = f ^ k , k = 1 , 2 , … We can take any interval of length 2 π 2\pi 2 π , e.g., [ 0 , 2 π ] [0,2\pi] [ 0 , 2 π ] . Some books like Tveito & Winther, 2005 use the interval [ − 1 , 1 ] [-1,1] [ − 1 , 1 ] with period of 2 to define the Fourier series.
Exercise 1 (Even and odd functions)
(1) If f : [ − π , π ] → R f : [-\pi,\pi] \to \re f : [ − π , π ] → R is an even function f ( − x ) = f ( x ) f(-x) = f(x) f ( − x ) = f ( x ) , then show that b k = 0 b_k = 0 b k = 0 and the Fourier series is a cosine series.
S f ( x ) = a 0 + ∑ k = 1 ∞ a k cos ( k x ) Sf(x) = a_0 + \sum_{k=1}^\infty a_k \cos(k x) S f ( x ) = a 0 + k = 1 ∑ ∞ a k cos ( k x ) (2) If f : [ − π , π ] → R f : [-\pi,\pi] \to \re f : [ − π , π ] → R is an odd function f ( − x ) = − f ( x ) f(-x) = -f(x) f ( − x ) = − f ( x ) , then show that a k = 0 a_k = 0 a k = 0 and the Fourier series is a sine series.
S f ( x ) = ∑ k = 1 ∞ b k sin ( k x ) Sf(x) = \sum_{k=1}^\infty b_k \sin(k x) S f ( x ) = k = 1 ∑ ∞ b k sin ( k x ) 6.11.2 Convergence of Fourier series ¶ When is f = S f f = Sf f = S f ? To talk of such questions, let us define the truncated series
S n f ( x ) = a 0 + ∑ k = 1 n [ a k cos ( k x ) + b k sin ( k x ) ] = ∑ k = − n n f ^ k e i k x S_n f(x) = a_0 + \sum_{k=1}^n [ a_k \cos(k x) + b_k \sin(k x) ] = \sum_{k=-n}^n \hat f_k \ee^{\ii k x} S n f ( x ) = a 0 + k = 1 ∑ n [ a k cos ( k x ) + b k sin ( k x )] = k = − n ∑ n f ^ k e i k x Note that we have an expansion in terms of an orthogonal basis ϕ k ( x ) = e i k x \phi_k(x) = \ee^{\ii k x} ϕ k ( x ) = e i k x , since
∫ − π π ϕ j ( x ) ϕ k ( x ) d x = 2 π δ j k \int_{-\pi}^\pi \phi_j(x) \phi_k(x) \ud x = 2 \pi \delta_{jk} ∫ − π π ϕ j ( x ) ϕ k ( x ) d x = 2 π δ jk There are three types of convergence wrt n → ∞ n \to \infty n → ∞ .
pointwise convergence
S n f ( x ) → f ( x ) , ∀ x S_n f(x) \to f(x), \qquad \forall x S n f ( x ) → f ( x ) , ∀ x uniform convergence
∥ S n f − f ∥ ∞ → 0 \norm{S_n f - f}_\infty \to 0 ∥ S n f − f ∥ ∞ → 0 mean square convergence
∥ S n f − f ∥ 2 → 0 \norm{S_n f - f}_2 \to 0 ∥ S n f − f ∥ 2 → 0 where the norms are defined as
∥ f ∥ ∞ = max x ∈ [ − π , π ] ∣ f ( x ) ∣ , ∥ f ∥ 2 = ( ∫ − π π ∣ f ( x ) ∣ 2 d x ) 1 2 \norm{f}_\infty = \max_{x \in [-\pi,\pi]} |f(x)|, \qquad \norm{f}_2 = \left( \int_{-\pi}^\pi |f(x)|^2 \ud x \right)^\half ∥ f ∥ ∞ = x ∈ [ − π , π ] max ∣ f ( x ) ∣ , ∥ f ∥ 2 = ( ∫ − π π ∣ f ( x ) ∣ 2 d x ) 2 1 Uniform convergence is the strongest property, and it implies pointwise and mean square convergence Tveito & Winther, 2005 .
Clearly we need ∣ f ^ k ∣ → 0 |\hat f_k| \to 0 ∣ f ^ k ∣ → 0 as ∣ k ∣ → ∞ |k| \to \infty ∣ k ∣ → ∞ for the series to converge and the rate of decay needs to be sufficiently fast. The rate of decay of f ^ k \hat f_k f ^ k depends on the smoothness of the function.
The function f : [ − π , π ] → R f : [-\pi,\pi] \to \re f : [ − π , π ] → R is said to be piecewise continuous if it is continuous at all but a finite number of points where both left and right limits exist.
The function f : [ − π , π ] → R f : [-\pi, \pi] \to \re f : [ − π , π ] → R is said to be piecewise differentiable if it is differentiable everywhere except for a finite number of points where the one-sided derivatives exist.
We say that f ∈ C p 0 [ − π , π ] f \in \cts_p^0[-\pi,\pi] f ∈ C p 0 [ − π , π ] if it is continuous and f ( − π ) = f ( π ) f(-\pi) = f(\pi) f ( − π ) = f ( π ) ; i.e., the periodic extension of f f f to R \re R is continuous.
We say that f ∈ C p ν [ − π , π ] f \in \cts_p^\nu[-\pi,\pi] f ∈ C p ν [ − π , π ] if it is ν-times continuously differentiable and
f ( s ) ( − π ) = f ( s ) ( π ) , s = 0 , 1 , … , ν f^{(s)}(-\pi) = f^{(s)}(\pi), \qquad s = 0,1,\ldots,\nu f ( s ) ( − π ) = f ( s ) ( π ) , s = 0 , 1 , … , ν i.e., the periodic extension of f f f to R \re R is in C ν ( R ) \cts^\nu(\re) C ν ( R ) .
Theorem 1 (Decay of Fourier coefficients)
(1) If f : [ − π , π ] → R f : [-\pi, \pi] \to \re f : [ − π , π ] → R is piecewise continuous then
∣ f ^ k ∣ = O ( 1 ∣ k ∣ ) , ∣ k ∣ → ∞ |\hat f_k| = \order{\frac{1}{|k|}}, \qquad |k| \to \infty ∣ f ^ k ∣ = O ( ∣ k ∣ 1 ) , ∣ k ∣ → ∞ (2) If f ∈ C p s − 1 [ − π , π ] f \in \cts_p^{s-1}[-\pi,\pi] f ∈ C p s − 1 [ − π , π ] and f ( s ) f^{(s)} f ( s ) is piecewise continuous for some s ≥ 1 s \ge 1 s ≥ 1 , then
∣ f ^ k ∣ = O ( 1 ∣ k ∣ s + 1 ) , ∣ k ∣ → ∞ |\hat f_k| = \order{\frac{1}{|k|^{s+1}}}, \qquad |k| \to \infty ∣ f ^ k ∣ = O ( ∣ k ∣ s + 1 1 ) , ∣ k ∣ → ∞ The term piecewise continuous can be replaced with bounded variation . The proof is based on an adaptation of Gander & Kwok, 2018 , Theorem 4.2.
(1a) First consider f ( x ) f(x) f ( x ) to be a step function
f ( x ) = y j , x ∈ ( x j − 1 , x j ) , 1 ≤ j ≤ m f(x) = y_j, \qquad x \in (x_{j-1},x_j), \qquad 1 \le j \le m f ( x ) = y j , x ∈ ( x j − 1 , x j ) , 1 ≤ j ≤ m for some partition { x 0 , x 1 , … , x m } \{x_0, x_1, \ldots, x_m\} { x 0 , x 1 , … , x m } of [ − π , π ] [-\pi,\pi] [ − π , π ] . Then
f ^ k = 1 2 π ∫ − π π f ( x ) e − i k x d x = 1 2 π i k [ y 1 + e − i k x 1 ( y 2 − y 1 ) + e − i k x 2 ( y 3 − y 2 ) + … + e − i k x n − 1 ( y m − y m − 1 ) − y m ] \begin{align}
\hat f_k
&= \frac{1}{2\pi} \int_{-\pi}^\pi f(x) \ee^{-\ii k x} \ud x \\
&= \frac{1}{2\pi \ii k} \left[ y_1 + \ee^{-\ii k x_1} (y_2 - y_1) + \ee^{-\ii k x_2} (y_3 - y_2) + \right. \\
& \qquad\qquad \left. \ldots + \ee^{-\ii k x_{n-1}} (y_m - y_{m-1}) - y_m \right]
\end{align} f ^ k = 2 π 1 ∫ − π π f ( x ) e − i k x d x = 2 π i k 1 [ y 1 + e − i k x 1 ( y 2 − y 1 ) + e − i k x 2 ( y 3 − y 2 ) + … + e − i k x n − 1 ( y m − y m − 1 ) − y m ] and hence
∣ f ^ k ∣ ≤ TV ( f ) + ∣ f ( π ) − f ( − π ) ∣ 2 π ∣ k ∣ = O ( 1 ∣ k ∣ ) |\hat f_k| \le \frac{\TV(f) + |f(\pi) - f(-\pi)|}{2 \pi |k|} = \order{ \frac{1}{|k|} } ∣ f ^ k ∣ ≤ 2 π ∣ k ∣ TV ( f ) + ∣ f ( π ) − f ( − π ) ∣ = O ( ∣ k ∣ 1 ) where
TV ( f ) = ∑ j = 2 m ∣ y j − y j − 1 ∣ < ∞ \TV(f) = \sum_{j=2}^m |y_j - y_{j-1}| < \infty TV ( f ) = j = 2 ∑ m ∣ y j − y j − 1 ∣ < ∞ (1b) Now let f ( x ) f(x) f ( x ) be a general piecewise continuous function; it is Riemann integrable and for any ϵ > 0 \epsilon > 0 ϵ > 0 , there is a partition P = { x 0 , x 1 , … , x m } P = \{ x_0, x_1, \ldots, x_m \} P = { x 0 , x 1 , … , x m } such that (Rudin, 1976 , Theorem 6.6)
U ( f , P ) − L ( f , P ) = ∑ j = 1 m M j ( x j − x j − 1 ) − ∑ j = 1 m m j ( x j − x j − 1 ) ≤ ϵ U(f,P) - L(f,P) = \sum_{j=1}^m M_j (x_j - x_{j-1}) - \sum_{j=1}^m m_j (x_j - x_{j-1}) \le \epsilon U ( f , P ) − L ( f , P ) = j = 1 ∑ m M j ( x j − x j − 1 ) − j = 1 ∑ m m j ( x j − x j − 1 ) ≤ ϵ where
m j = min x ∈ [ x j − 1 , x j ] f ( x ) = f ( ξ j ) , ξ j ∈ [ x j − 1 , x j ] M j = max x ∈ [ x j − 1 , x j ] f ( x ) \begin{align}
m_j &= \min_{x \in [x_{j-1},x_j]} f(x) = f(\xi_j), \qquad \xi_j \in [x_{j-1},x_j] \\
M_j &= \max_{x \in [x_{j-1},x_j]} f(x)
\end{align} m j M j = x ∈ [ x j − 1 , x j ] min f ( x ) = f ( ξ j ) , ξ j ∈ [ x j − 1 , x j ] = x ∈ [ x j − 1 , x j ] max f ( x ) Consider the step function
f ~ ( x ) = m j , x ∈ ( x j − 1 , x j ) \tilde f(x) = m_j, \qquad x \in (x_{j-1}, x_j) f ~ ( x ) = m j , x ∈ ( x j − 1 , x j ) for which
TV ( f ~ ) = ∑ j = 2 m ∣ f ( ξ j ) − f ( ξ j − 1 ) ∣ ≤ TV ( f ) \TV(\tilde f) = \sum_{j=2}^m |f(\xi_j) - f(\xi_{j-1})| \le \TV(f) TV ( f ~ ) = j = 2 ∑ m ∣ f ( ξ j ) − f ( ξ j − 1 ) ∣ ≤ TV ( f ) Now (Rudin, 1976 , Theorem 6.12, 6.13)
∣ ∫ − π π f ( x ) e − i k x d x − ∫ − π π f ~ ( x ) e − i k x d x ∣ ≤ ∫ − π π ∣ f ( x ) − f ~ ( x ) ∣ d x = ∑ j = 1 m ∫ x j − 1 x j ∣ f ( x ) − f ~ ( x ) ∣ d x = ∑ j = 1 m ∫ x j − 1 x j ( f ( x ) − m j ) d x ≤ ∑ j = 1 m ∫ x j − 1 x j ( M j − m j ) d x = U ( f , P ) − L ( f , P ) ≤ ϵ \begin{align}
\left| \int_{-\pi}^\pi f(x) \ee^{-\ii k x} \ud x - \int_{-\pi}^\pi \tilde f(x) \ee^{-\ii k x} \ud x \right|
&\le \int_{-\pi}^\pi |f(x) - \tilde f(x)| \ud x \\
&= \sum_{j=1}^m \int_{x_{j-1}}^{x_j} |f(x) - \tilde f(x)| \ud x \\
&= \sum_{j=1}^m \int_{x_{j-1}}^{x_j} (f(x) - m_j) \ud x \\
&\le \sum_{j=1}^m \int_{x_{j-1}}^{x_j} (M_j - m_j) \ud x \\
&= U(f,P) - L(f,P) \\
&\le \epsilon
\end{align} ∣ ∣ ∫ − π π f ( x ) e − i k x d x − ∫ − π π f ~ ( x ) e − i k x d x ∣ ∣ ≤ ∫ − π π ∣ f ( x ) − f ~ ( x ) ∣ d x = j = 1 ∑ m ∫ x j − 1 x j ∣ f ( x ) − f ~ ( x ) ∣ d x = j = 1 ∑ m ∫ x j − 1 x j ( f ( x ) − m j ) d x ≤ j = 1 ∑ m ∫ x j − 1 x j ( M j − m j ) d x = U ( f , P ) − L ( f , P ) ≤ ϵ Then the Fourier transform
f ^ k = 1 2 π ∫ − π π f ( x ) e − i k x d x ≈ 1 2 π ∫ − π π f ~ ( x ) e − i k x d x ≤ TV ( f ~ ) + ∣ f ~ ( π ) − f ~ ( − π ) ∣ 2 π ∣ k ∣ using Part (1a) ⪅ TV ( f ) + ∣ f ( π ) − f ( − π ) ∣ 2 π ∣ k ∣ = O ( 1 ∣ k ∣ ) \begin{align}
\hat f_k
&= \frac{1}{2\pi} \int_{-\pi}^\pi f(x) \ee^{-\ii k x} \ud x \\
&\approx \frac{1}{2\pi} \int_{-\pi}^\pi \tilde f(x) \ee^{-\ii k x} \ud x \\
&\le \frac{\TV(\tilde f) + |\tilde f(\pi) - \tilde f(-\pi)|}{2 \pi |k|} \qquad \textrm{using Part (1a)} \\
&\lessapprox \frac{\TV(f) + |f(\pi) - f(-\pi)|}{2 \pi |k|} \\
&= \order{\frac{1}{|k|}}
\end{align} f ^ k = 2 π 1 ∫ − π π f ( x ) e − i k x d x ≈ 2 π 1 ∫ − π π f ~ ( x ) e − i k x d x ≤ 2 π ∣ k ∣ TV ( f ~ ) + ∣ f ~ ( π ) − f ~ ( − π ) ∣ using Part (1a) ⪅ 2 π ∣ k ∣ TV ( f ) + ∣ f ( π ) − f ( − π ) ∣ = O ( ∣ k ∣ 1 ) (2) If f ∈ C p 0 [ − π , π ] f \in \cts^0_p[-\pi,\pi] f ∈ C p 0 [ − π , π ] and piecewise differentiable, i.e., s = 1 s=1 s = 1 , then using integration by parts
f ^ k = 1 2 π ∫ − π π f ( x ) e − i k x d x = − 1 2 π i k [ f ( x ) e − i k x ] − π π + 1 i k [ 1 2 π ∫ − π π f ′ ( x ) e − i k x d x ] Using the result of Part (1) in the second term above = − cos ( k π ) 2 π i k [ f ( π ) − f ( − π ) ] + 1 i k O ( 1 k ) = O ( 1 k 2 ) , since f ( − π ) = f ( π ) \begin{align}
\hat f_k
&= \frac{1}{2\pi} \int_{-\pi}^\pi f(x) \ee^{-\ii k x} \ud x \\
&= -\frac{1}{2 \pi \ii k} \left[ f(x) \ee^{-\ii k x} \right]_{-\pi}^\pi + \frac{1}{\ii k} \left[ \frac{1}{2 \pi} \int_{-\pi}^\pi f'(x) \ee^{-\ii k x} \ud x \right] \\
& \qquad \textrm{Using the result of Part (1) in the second term above} \\
&= -\frac{\cos(k\pi)}{2 \pi \ii k} [f(\pi) - f(-\pi)] + \frac{1}{\ii k} \order{\frac{1}{k}} \\
&= \order{\frac{1}{k^2}}, \qquad \textrm{since } f(-\pi) = f(\pi)
\end{align} f ^ k = 2 π 1 ∫ − π π f ( x ) e − i k x d x = − 2 π i k 1 [ f ( x ) e − i k x ] − π π + i k 1 [ 2 π 1 ∫ − π π f ′ ( x ) e − i k x d x ] Using the result of Part (1) in the second term above = − 2 π i k cos ( kπ ) [ f ( π ) − f ( − π )] + i k 1 O ( k 1 ) = O ( k 2 1 ) , since f ( − π ) = f ( π ) We see that every time we do an integration by parts, we get a factor of 1 / k 1/k 1/ k . For any s > 1 s > 1 s > 1 , we can perform several integration by parts and reach the conclusion of Part (2).
Example 3 (Infinitely differentiable but not periodic)
f ( x ) = sin ( x / 2 ) , x ∈ [ 0 , 2 π ] f(x) = \sin(x/2), \qquad x \in [0,2\pi] f ( x ) = sin ( x /2 ) , x ∈ [ 0 , 2 π ] f = lambda x: sin(x/2)
df= lambda x: cos(x/2)/2
x = linspace(0,2*pi,500)
plot(x,f(x),label='f(x)')
plot(x,df(x),label='f\'(x)')
legend(), grid(True), xlabel('x');
Its Fourier coefficients are
f ^ k = 2 π ( 1 − 4 k 2 ) , ∣ f ^ k ∣ = O ( 1 k 2 ) , ∣ k ∣ → ∞ \hat f_k = \frac{2}{\pi(1 - 4 k^2)}, \qquad |\hat f_k| = \order{\frac{1}{k^2}}, \qquad |k| \to \infty f ^ k = π ( 1 − 4 k 2 ) 2 , ∣ f ^ k ∣ = O ( k 2 1 ) , ∣ k ∣ → ∞ Now f ( 0 ) = f ( 2 π ) f(0) = f(2\pi) f ( 0 ) = f ( 2 π ) but
f ′ ( 0 ) = 1 2 cos ( 0 ) = 1 2 ≠ f ′ ( 2 π ) = 1 2 cos ( π ) = − 1 2 f'(0) = \half \cos(0) = \half \qquad\ne\qquad f'(2\pi) = \half \cos(\pi) = -\half f ′ ( 0 ) = 2 1 cos ( 0 ) = 2 1 = f ′ ( 2 π ) = 2 1 cos ( π ) = − 2 1 and hence f ∈ C p 0 [ 0 , 2 π ] f \in \cts^0_p[0,2\pi] f ∈ C p 0 [ 0 , 2 π ] but f ∉ C p 1 [ 0 , 2 π ] f \notin \cts^1_p[0,2\pi] f ∈ / C p 1 [ 0 , 2 π ] . This corresponds to Part (1) of Theorem 1 with s = 1 s=1 s = 1 .
We can see this with integration-by-parts;
f ^ k = 1 2 π ∫ 0 2 π f ( x ) e − i k x d x = 1 2 π i k ∫ 0 2 π f ′ ( x ) e − i k x d x since f ( 0 ) = f ( 2 π ) = O ( 1 k 2 ) [ f ′ ( 2 π ) − f ′ ( 0 ) ] + 1 2 π ( i k ) 2 ∫ 0 2 π f ′ ′ ( x ) e − i k x d x \begin{align}
\hat f_k
&= \frac{1}{2\pi} \int_{0}^{2\pi} f(x) \ee^{-\ii k x} \ud x \\
&= \frac{1}{2 \pi \ii k} \int_{0}^{2\pi} f'(x) \ee^{-\ii k x} \ud x \qquad \textrm{since } f(0) = f(2\pi) \\
&= \order{\frac{1}{k^2}} [ f'(2\pi) - f'(0)] + \frac{1}{2 \pi (\ii k)^2} \int_{0}^{2\pi} f''(x) \ee^{-\ii k x} \ud x
\end{align} f ^ k = 2 π 1 ∫ 0 2 π f ( x ) e − i k x d x = 2 π i k 1 ∫ 0 2 π f ′ ( x ) e − i k x d x since f ( 0 ) = f ( 2 π ) = O ( k 2 1 ) [ f ′ ( 2 π ) − f ′ ( 0 )] + 2 π ( i k ) 2 1 ∫ 0 2 π f ′′ ( x ) e − i k x d x Though we can perform more integrations giving rise to terms of order 1 / ∣ k ∣ 3 , 1 / ∣ k ∣ 4 , … 1/|k|^3, 1/|k|^4, \ldots 1/∣ k ∣ 3 , 1/∣ k ∣ 4 , … ,
∣ f ^ k ∣ = O ( 1 k 2 ) [ f ′ ( 2 π ) − f ′ ( 0 ) ] + O ( 1 ∣ k ∣ 3 ) + O ( 1 ∣ k ∣ 4 ) + … |\hat f_k| = \order{\frac{1}{k^2}} [ f'(2\pi) - f'(0)] + \order{\frac{1}{|k|^3}} + \order{\frac{1}{|k|^4}} + \ldots ∣ f ^ k ∣ = O ( k 2 1 ) [ f ′ ( 2 π ) − f ′ ( 0 )] + O ( ∣ k ∣ 3 1 ) + O ( ∣ k ∣ 4 1 ) + … the size of ∣ f ^ k ∣ |\hat f_k| ∣ f ^ k ∣ is O ( 1 / k 2 ) \order{1/k^2} O ( 1/ k 2 ) for ∣ k ∣ → ∞ |k| \to \infty ∣ k ∣ → ∞ , since f ′ ( 0 ) ≠ f ′ ( 2 π ) f'(0) \ne f'(2\pi) f ′ ( 0 ) = f ′ ( 2 π ) .
Example 4 (Infinitely differentiable and periodic)
f ( x ) = 3 5 − 4 cos x , x ∈ [ 0 , 2 π ] f(x) = \frac{3}{5 - 4\cos x}, \qquad x \in [0,2\pi] f ( x ) = 5 − 4 cos x 3 , x ∈ [ 0 , 2 π ] f = lambda x: 3.0/(5.0 - 4.0*cos(x))
x = linspace(0,2*pi,500)
plot(x,f(x))
grid(True), xlabel('x'), ylabel('f(x)');
Its Fourier coefficients are
f ^ k = 1 2 ∣ k ∣ \hat f_k = \frac{1}{2^{|k|}} f ^ k = 2 ∣ k ∣ 1 f ∈ C p s [ 0 , 2 π ] f \in \cts^s_p[0,2\pi] f ∈ C p s [ 0 , 2 π ] for every s ≥ 0 s \ge 0 s ≥ 0 , and the Fourier coefficients decay faster than any power of 1 / ∣ k ∣ 1/|k| 1/∣ k ∣ , which is consistent with exponential decay.
Theorem 2 (Convergence of Fourier series)
(1) If f : [ − π , π ] → R f : [-\pi,\pi] \to \re f : [ − π , π ] → R is piecewise continuous, then
lim n → ∞ ∥ S n f − f ∥ 2 = 0 \lim_{n \to \infty} \norm{S_n f - f}_2 = 0 n → ∞ lim ∥ S n f − f ∥ 2 = 0 Moreover, Parseval’s relation holds
∑ k = − ∞ ∞ ∣ f ^ k ∣ 2 = ∥ f ∥ 2 2 \sum_{k=-\infty}^\infty |\hat f_k|^2 = \norm{f}_2^2 k = − ∞ ∑ ∞ ∣ f ^ k ∣ 2 = ∥ f ∥ 2 2 (2) If f ∈ C p 0 [ − π , π ] f \in \cts_p^0[-\pi,\pi] f ∈ C p 0 [ − π , π ] and f ′ f' f ′ is piecewise continuous, then the Fourier series converges absolutely and uniformly,
lim n → ∞ ∥ S n f − f ∥ ∞ = 0 \lim_{n \to \infty} \norm{S_n f - f}_\infty = 0 n → ∞ lim ∥ S n f − f ∥ ∞ = 0 Moreover, the Fourier transform of g = f ′ g=f' g = f ′ is
g ^ k = i k f ^ k \hat g_k = \ii k \hat f_k g ^ k = i k f ^ k Example 5 (Continuation of
Example 1 )
Here are the truncated Fourier series for the square hat function.
def fn(x,n):
f = 0.5 * ones_like(x)
for k in range(1,n,2):
e1 = (-1)**(( k+1)//2) * exp( 1j*k*x) / ( k*pi)
e2 = (-1)**((-k+1)//2) * exp(-1j*k*x) / (-k*pi)
f += real(e1 + e2)
return f
x = linspace(0,2*pi,1000)
f = (x > 0.5*pi)*(x < 1.5*pi)*(1) + 0.0
for i,n in enumerate([10,20,30,50]):
subplot(2,2,i+1)
plot(x, f, x, fn(x,n))
text(pi,0.5,'n = ' + str(n),ha='center')
grid(True);
As n n n increases, we see that the errors do not decrease around the discontinuities and there is no convergence in maximum norm, but there is convergence in 2-norm as stated in Part (1) of Theorem 2 .
We have observed this kind of Gibbs oscillations when we interpolate a discontinuous function with polynomials.
Moreover, it looks like there is pointwise convergence away from the discontinuities, and this is the case, see next Theorem.
Let f f f be piecewise continuous and its periodic extension be one-sided differentiable for all x ∈ R x \in \re x ∈ R . Then
( S n f ) ( x ) → 1 2 [ f ( x − ) + f ( x + ) ] , x ∈ R (S_n f)(x) \to \half [f (x-) + f(x+)], \qquad x \in \re ( S n f ) ( x ) → 2 1 [ f ( x − ) + f ( x + )] , x ∈ R Hence, if f f f is continuous at x x x , then ( S n f ) ( x ) → f ( x ) (S_n f)(x) \to f(x) ( S n f ) ( x ) → f ( x ) .
Compute the Fourier transform of the triangular hat function in Example 2 . Verify the Fourier transform of the functions in the other examples also.
Plot the truncated Fourier series ( S n f ) ( x ) (S_n f)(x) ( S n f ) ( x ) of all the functions in the above examples for a few values of n n n as we did for the square hat function.
To test convergence as n → ∞ n \to \infty n → ∞ , compute S n f S_n f S n f on a uniform grid { x j } \{ x_j \} { x j } of say m = 1000 m = 1000 m = 1000 points and measure the error as
∥ S n f − f ∥ ∞ ≈ max j ∣ S n f ( x j ) − f ( x j ) ∣ ∥ S n f − f ∥ 2 ≈ ( 2 π m ∑ j [ S n f ( x j ) − f ( x j ) ] 2 ) 1 2 \begin{align}
\norm{S_n f - f}_\infty &\approx \max_{j} |S_n f(x_j) - f(x_j)| \\
\norm{S_n f - f}_2 &\approx \left( \frac{2\pi}{m} \sum_{j} [S_n f(x_j) - f(x_j)]^2 \right)^\half
\end{align} ∥ S n f − f ∥ ∞ ∥ S n f − f ∥ 2 ≈ j max ∣ S n f ( x j ) − f ( x j ) ∣ ≈ ( m 2 π j ∑ [ S n f ( x j ) − f ( x j ) ] 2 ) 2 1 Plot error versus n n n in loglog scale or semilogy scale; choose the scale according to the smoothness of the function.
Tveito, A., & Winther, R. (2005). Introduction to Partial Differential Equations (Vol. 29). Springer-Verlag. 10.1007/b138016 Davis, P. J. (1963). Interpolation and Approximation . Dover Publications. Shen, J., Tang, T., & Wang, L.-L. (2011). Spectral Methods: Algorithms, Analysis and Applications (Vol. 41). Springer Berlin Heidelberg. 10.1007/978-3-540-71041-7 Gander, M. J., & Kwok, F. (2018). Numerical Analysis of Partial Differential Equations Using Maple and MATLAB . Society for Industrial. 10.1137/1.9781611975314 Rudin, W. (1976). Principles of Mathematical Analysis (3rd ed.). McGraw Hill.