Fourier Series January 26, 2009

Outline • Review last class • Fourier series as expansions in periodic Larry Caretto functions Mechanical Engineering 501B – Comparison to expansions Seminar in Engineering Analysis • Odd and even functions January 26, 2009 • Periodic extensions of non-periodic functions • Complex Fourier series

2

Review Last Lecture Review Orthogonal Functions

• Discussed Sturm-Liouville Problem • Defined in terms of inner product • Solutions are a set of orthogonal • Norm of two like ||y || b i eigenfunctions, ym(x) that can be used to y , y = y*(x)y (x) p(x)dx = y 2δ ()i j ∫ i j i ij express other functions, f(x) a • p(x) is ∞ • Orthonormal eigenfunctions f (x) = a y (x) b ∑ m m * weight m=0 ()f , f = f (x) f (x) p(x)dx = δ function b i j ∫ i j ij p(x)y (x) f (x)dx a • Have to (y , f ) ∫ m • Convert orthogonal eigenfunctions to a = m = a m b orthonormal eigenfunctions compute ()ym , ym p(x)ym (x)ym (x)dx am ∫ yi a fi = 3 yi 4

Review Sturm-Liouville Review Sturm-Liouville Results

General equation whose solutions provide • Eigenvalues are real orthogonal eigenfunctions • Eigenfunctions defined over a region a ≤ – Defined for a ≤ x ≤ b with p(x), q(x) and r(x) continuous and p(x) > 0 x ≤ b form an orthogonal set over that region. – (Homogenous) differential equation and boundary conditions shown below • Eigenfunctions form a complete set over dy an infinite-dimensional d ⎛ dy ⎞ k1 y(a) + k2 = 0 ⎜r(x) ⎟ + dx x=a • We can expand any function over the dx dx ⎝ ⎠ dy region in which the Sturm-Liouville problem is defined in terms of the []q(x) + λp(x) y = 0 l1 y(b) + l 2 = 0 dx x=b eigenfunctions for that problem 5 6

ME 501B – Engineering Analysis 1 Fourier Series January 26, 2009

Review Eigenfunction Expansions Review Expansion of f(x) = x ∞ • Start with general equation for a • Eigenfunction f (x) = a y (x) m ∑ m m • Use y = sin(m x) over 0 x 1 which expansion formula m=0 m π ≤ ≤ is a Sturm-Liouville solution

• Equation for am coefficients in • Weight function p(x) = 1 eigenfunction expansion of f(x) 1 1 b xsin(mπx)dx xsin(mπx)dx ∫ ∫ m+1 (ym , f ) 0 0 2(−1) p(x)ym (x) f (x)dx a = = = = (y , f ) ∫ m ()y , y 1 1 mπ m a m m sin2 (mπx)dx 2 am = = b ∫ ()y , y 0 m m p(x)y (x)y (x)dx ∫ m m 2 ⎡sin(πx) sin(2πx) sin(3πx) sin(4πx) ⎤ a f (x) = x = ⎢ − + − +L⎥ π ⎣ 1 2 3 4 ⎦ 7 8

Review Partial Sums – Small Review Partial Sums – Large

1.1 1.2

1.1 1

1 0.9

0.9 0.8

0.8 0.7 Exa ct 0.7 s m 1 term 0.6 2 terms Exact 0.6 3 terms 10 terms 0.5 25 terms 5 terms Series sum Series su Series 0.5 10 terms 50 terms 0.4 100 terms 0.4

0.3 0.3

0.2 0.2

0.1 0.1

0 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 9 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 10 x x

Fourier Series Fourier Series

• Have same basic idea as eigenfunction • Equations for series and coefficients expansions defined for –L < x < L – Represent other functions, f(x), as a series ∞ ⎡ ⎛ nπx ⎞ ⎛ nπx ⎞⎤ of sines and cosines f (x) = a0 + ∑⎢an cos⎜ ⎟ + bn sin⎜ ⎟⎥ – Compute coefficients in a similar way to n=1 ⎣ ⎝ L ⎠ ⎝ L ⎠⎦ eigenfunction expansions L L 1 1 ⎛ nπx ⎞ – Fourier series based on periodicity of a0 = f (x)dx a = f (x)cos⎜ ⎟dx 2L ∫ n ∫ trigonometric functions −L L −L ⎝ L ⎠ L 1 ⎛ nπx ⎞ b = f (x)sin dx n ∫ ⎜ ⎟ 11 L −L ⎝ L ⎠ 12

ME 501B – Engineering Analysis 2 Fourier Series January 26, 2009

Basis for Fourier Series Even and Odd Functions • Odd function: • Applies to periodic functions cosine • Must be piecewise continuous f(–x) = – f(x) (like sine) • Derivative must exist at all points in the sine period • Even function • At discontinuity both left-hand and right- g(–x) = g(x) (like hand derivatives exist cosine) L • Fourier series converges to f(x) • For odd f(x) ∫ f (x)dx = 0 −L • At discontinuity the series converges to L L average of f(x-) and f(x+) • For even g(x) ∫ g(x)dx = 2∫ g(x)dx 13 −L 0 14

Even and Odd Functions II Even and Odd Functions III 1 L • The product of an even function, g(x) = • For odd functions, a = f (x)dx 0 ∫ g(–x) and an odd function f(–x) = –f(x) is the Fourier series 2L −L an odd function coefficients a L 0 1 ⎛ nπx ⎞ • Proof: define h(x) = f(x) · g(x) and an are zero an = f (x)cos⎜ ⎟dx L ∫ ⎝ L ⎠ • h(–x) = f(–x) · g(–x) = –f(x) · g(x) = –h(x) −L L • Can have half-range expansions that 1 ⎛ nπx ⎞ b = f (x)sin dx • Fourier coefficient n ∫ ⎜ ⎟ consider only 0 < x < L L −L ⎝ L ⎠ • Apply to non periodic functions to get • Since sine is an odd function, bn = 0 if f(x) is even, i.e., f(–x) = f(–x) “periodic extensions” 15 16

Even and Odd Fourier Series Odd Function Sine Series

• We can use relations for even and odd • f(x) is an odd function f(–x) = –f(x) functions to transform Fourier coefficient • Sine only series defined for –L ≤ x ≤ L equations •b computed as from 0 to L • For odd functions, f(–x) = –f(x) we have n ∞ only sine terms with coefficients bn ⎛ nπx ⎞ f (x) = ∑bn sin⎜ ⎟ • Even functions have only cosine (and n=1 ⎝ L ⎠ constant) terms with coefficients a and 0 1 L nπx 2 L nπx an ⎛ ⎞ ⎛ ⎞ bn = ∫ f (x)sin⎜ ⎟dx = ∫ f (x)sin⎜ ⎟dx • Next chart shows series and coefficients L −L ⎝ L ⎠ L 0 ⎝ L ⎠

17 18

ME 501B – Engineering Analysis 3 Fourier Series January 26, 2009

Even Function Cosine Series Half-interval series

• f(x) is an even function f(–x) = f(x) • Based on equations for sine series for • Cosine only series defined for –L ≤ x ≤ L odd functions and cosine series for even functions •an evaluated by integral from 0 to L ∞ ⎛ nπx ⎞ • Either the sine or cosine series can apply f (x) = a0 + ∑an cos⎜ ⎟ to any function n=1 ⎝ L ⎠ – Can use sines to expand even functions 1 L 1 L a = f (x)dx = f (x)dx – Can use cosines to expand odd functions 0 ∫ ∫ 2L −L L 0 • Each series defined for 0 ≤ x ≤ L L L 1 ⎛ nπx ⎞ 2 ⎛ nπx ⎞ • Behavior outside region 0 ≤ x ≤ L a = f (x)cos dx = f (x)cos dx n ∫ ⎜ ⎟ ∫ ⎜ ⎟ depends on the function L −L ⎝ L ⎠ L 0 ⎝ L ⎠ 19 20

Fourier Sine Series for f(x) = x

Half-interval Series Example 1.1 1.0 0.9 • Last class computed series for f(x) 0.8 0.7 = x in terms of sin(nπx/L) with L = 0.6 ∞ 0.5 1 for 0 ≤ x ≤ L ⎛ nπx ⎞ 0.4 f (x) = ∑bn sin⎜ ⎟ 0.3 n=1 ⎝ L ⎠ 0.2 Exact 0.1 1 term

• Would get same coefficients from ) 0.0 2 terms f(x equations for Fourier sine series -0.1 5 terms -0.2 10 terms -0.3 • Get correct result for –L ≤ x ≤ L -0.4 -0.5 with periodic extensions -0.6 L L n+1 -0.7 2 ⎛ nπx ⎞ 2 ⎛ nπx ⎞ 2L()−1 -0.8 bn = ∫ f (x)sin⎜ ⎟dx = ∫ xsin⎜ ⎟dx = -0.9 L ⎝ L ⎠ L ⎝ L ⎠ nπ -1.0 0 0 -1.1 -1.0 -0.8 -0.6 -0.4 -0.2 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 21 x

Cosine Series for f(x) = x Cosine Series for f(x) = x

• Set f(x) = x in equations for a0 and an • Result for an is zero for even n values L L L ⎡ 2 ⎤ 2 L 1 1 1 x L 2 ⎡⎛ L ⎞ ⎛ nπx ⎞ x ⎛ nπx ⎞⎤ a0 = f (x)dx = xdx = ⎢ ⎥ = L ∫ L ∫ L 2 2 an = ⎢⎜ ⎟ cos⎜ ⎟ + sin⎜ ⎟⎥ 0 0 ⎣ ⎦0 L ⎝ nπ ⎠ ⎝ L ⎠ nπ ⎝ L ⎠ L L ⎣⎢ ⎦⎥0 2 ⎛ nπx ⎞ 2 ⎛ nπx ⎞ 2 an = ∫ f (x)cos⎜ ⎟dx = ∫ xcos⎜ ⎟dx 2 ⎛ L ⎞ ⎛ L ⎞ L ⎝ L ⎠ L ⎝ L ⎠ = ⎜ ⎟ []cos()nπ − cos(0) + ⎜ ⎟[Lsin()nπ 0 0 L ⎝ nπ ⎠ ⎝ nπ ⎠ 2 L 2 ⎡⎛ L ⎞ ⎛ nπx ⎞ x ⎛ nπx ⎞⎤ 2L()cos()nπ −1 4L = cos + sin − (0)sin(0)]= 2 = − 2 (odd n) ⎢⎜ ⎟ ⎜ ⎟ ⎜ ⎟⎥ ()nπ ()nπ L ⎣⎢⎝ nπ ⎠ ⎝ L ⎠ nπ ⎝ L ⎠⎦⎥ 0 23 24

ME 501B – Engineering Analysis 4 Fourier Series January 26, 2009

Cosine series for f(x) = x

Cosine Series for f(x) = x 1.0

0.9 • Final series, shown below, uses n = 2m+1 to get odd values of n only 0.8 ∞ ⎛ nπx ⎞ L 4L ∞ 1 ⎛ nπx ⎞ 0.7 f (x) = a + a cos = − cos 0 ∑ n ⎜ ⎟ 2 ∑ 2 ⎜ ⎟ 0.6 Exact n=1 L 2 π n=1,3,5, n L ⎝ ⎠ K ⎝ ⎠ 1 term ) 0.5 2 terms f(x ∞ 5 terms L 4L 1 ⎛ (2m +1)πx ⎞ 10 terms 0.4 f (x) = − 2 ∑ 2 cos⎜ ⎟ 2 π m=0 ()2m +1 L ⎝ ⎠ 0.3

L 4L ⎡ ⎛πx ⎞ 1 ⎛ 3πx ⎞ 1 ⎛ 5πx ⎞ ⎤ 0.2 = − cos + cos + cos + 2 ⎢ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ L⎥ 2 π ⎣ ⎝ L ⎠ 9 ⎝ L ⎠ 25 ⎝ L ⎠ ⎦ 0.1

0.0 25 -1.0 -0.8 -0.6 -0.4 -0.2 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 x

Complex Fourier Series Summary

• Euler relationship eix = cos(x) + i sin(x) • Fourier series is alternative approach to • Setting x = -x gives e-ix = cos(-x) + i sin(-x) Sturm-Liouville for developing series = cos(x) - i sin(x) expansions in sines and cosines • Based on periodic functions • Get result for f(x) and coefficient cn ∞ L • Can use half-interval expansions to f (x) = c einx 1 −inx show application to any function ∑ n cn = f (x)e n=−∞ 2L ∫ −L • Basic approach similar to eigenfunction expansions: find the coefficients

27 28

ME 501B – Engineering Analysis 5