PHYS 0 HOMEWORK #9-- SOLUTIONS. We are asked to use Dirichlet' s theorem to determine the value of f (x) as defined below at x = 0, ± /, ± f(x) = 0, - < x <, < x < Dirichlet's theorem tells us that the Fourier series will converge to the value of f(x) for those values of x where f is continuous, and will converge to the midoint of f(x) at discontinuities. The Fourier series for this function is: f x = Å 4 -Å Å cos x - cos x + cos 5 x 5 -... + sin x sin x - + sin x + sin 5 x - sin 6 x +... 5 6 Let' s lot a few cycles of this grah to show it is eriodic and to see where the discontinuities lie. I will lot this using the analytical exression for the Fourier coefficients a 0, a n, and b n which you can find easily from integrating the simle ste function.
hys0-009hw9s.nb Plot 4 Sum Sin n Cos n x n, n,, 5 Sum ^ n Cos n Sin n x n, n,, 5, x,,.0 0.8 0.6 0.4 0. -5 5 The function is continuous at x = 0, so the Fourier series converges to the value of function. We know from the definition of the function above that f (0) = 0. Recalling that cos 0 = and sin 0 = 0, this imlies : f 0 = 0 = Å 4 -Å -Å +Å 5 -Å 7 +... Which imlies that : Å 4 = -Å +Å 5 -Å 7 -... A result that we obtained in class and is shown on. 58 of Boas. The function is discontinuous at x = /; the midoint of the jum is /, so the value of f (/) = /. All of the cos terms in this Fourier series will be zero since cos (n /) = 0 for odd values of n, and sin (n /) is zero for even values of n, and is either + or - deending on whether n=,5,9,... or n=,7,... These results imly:
hys0-009hw9s.nb f Å = Å = Å 4 +Å -Å +Å 5 -Å 7 +... A result we already know. We can see that the function is discontinuous at x = ± by lotting several cycles of this function: The value of x at x= ± is just the midoint of the jum, so that the value of the function at ± is simly /. You should do the exercise of substituting + and - into the Fourier series exression to show that your resulting value is in fact /. Similarly, the function is continuous at x=-/, so f(-/)=0.. We need only to do the function defined in a).we will first calculate the sine/cos series, then the comlex series, then lot the function defined below. Our function is: f x = x, - < x < To find the Fourier coefficients : a 0 = Å x dx = Å - x = Å - = Å a n = Å x cos nx dx = Å - x n sin nx -Å n x sin nx dx - - = Å x n sin nx -Å n -x n cos nx - - n Å cos nx - - = Å 0 +Å n Å cos n - - cos -n + 0 = n 4 cos n n = 4 - n n To calculate b n, we could either exlicitly integrate the aroriate Fourier integral, or we can aeal to the symmetry of the functions involved. We know that x is an even function, and sin (n x) is an odd function. The roduct of an even and odd function is itself an odd function, and
4 hys0-009hw9s.nb the value of the integral of an odd function between limits symmetric across the origin is zero. In other words: -L Lf odd function dx = 0 Thus, by using the symmetry of these functions, we know that b n is 0. Therefore, we can write the sin/cos Fourier series for this function as: f x = + 4 S - n cos nx n= n To find the comlex series, find the comlex coefficients, c n : c n = f x e -inx dx = - x e -inx dx - In the case that n = 0, we obtain simly for c 0 : c 0 = x dx = - We solve this integral by arts; for ease of tying I will omit limits and aly those at the end. c n = x e -inx = -x in e-inx + in xe -inx dx = -x in + in -x in e-inx + in e -inx dx = e -inx in x + nx - i n - = - n 4 n In making the final evaluation, we make use of the fact that : e -in = cos (n ) - i sin(n ) = cos(n ) = - n.
hys0-009hw9s.nb 5 Finally, we lot three cycles of the Fourier Series using the Fourier coefficients defined above : Plot 4 Sum n Cos n x n^, n,, 7, x,, 0 8 6 4-5 5. We are asked to find the Fourier series for the function : f x = e x, - < x < Finding the Fourier coefficients : a 0 = Å e x dx = - Å e - e - To find the Fourier coefficients a n and b n, lease refer to roblem 7 of HW 7 in which we solved an integral very similar to what you will need here. Quoting only the results: e x cos nx dx = - n sinh a n = Å - n + where sinh is the hyerbolic sine function defined as : sinh x = ex - e -x.
6 hys0-009hw9s.nb The cosh function is similarly : cosh x = ex + e -x e x sin nx dx = - - n n sinh b n = Å - n + So that our Fourier series is : f x = sinh sinh + sinh S + -cos x + cos x 5 - n S - n n sin nx cos nx - = n + n + - cos x 0 +... + sin x - sin x 5 + sin x 0 +... () () Plotting this Fourier series over cycles : Plot Sinh Sum n Sinh Cos n x n^, n,, 9 Sum n n Sinh Sin n x n^, n,, 9, x,, 5 0 5 0 5-5 5 And now lotting the Fourier Series from - to and overlaying two oints which we know to be on the curve; this Fourier series aears to be a very good fit to the function e x.
hys0-009hw9s.nb 7 g Plot Sinh Sum n Sinh Cos n x n^, n,, 9 Sum n n Sinh Sin n x n^, n,, 9, x,,, Eilog Red, PointSize Large, Point, Ex,, Ex 5 0 5 0 5 - - - Comlex Fourier Series : We now solve the coefficients for the comlex Fourier series. We need to comute : c 0 = e x dx and c n = - e x e -inx dx - These are both very easy integrals to evaluate : c 0 = e x dx = - e - e - = sinh c n = e x e -inx dx = - e x -in dx = - - in e e -in - e - e in = cos n + in e - e - + n = - n sinh n + + in - n sinh + n = - n sinh -Å n n + i In reducing this exression, we recognize that e in = cos n ±i sin n = cos(n ) since sin n is always zero for integer values of n. Additionally, we
8 hys0-009hw9s.nb multily numerator and denominator by the comlex conjugate of the term (-i n). In the last ste, we make use of the relationshi i = -, so that i = -/i. The comlex Fourier series is written as: f x = S cn e inx n=- where the index n now runs from minus infinity to lus infinity. If we grou terms as : f x = c 0 + c e ix + c - e - ix + c e ix + c e -ix +... we can write this comlex Fourier series as : f x = sinh + -e ix + eix i - e -ix - e-ix i + e ix 5 - eix 5 i + e-ix 5 - e-ix 5 i... = sinh + - cos x + sin x + cos x - sin x +... 5 5 We roduce the final equation in () by recalling the definitions of cos nx and sin nx : cos nx = einx + e -inx and sin n x = einx - e -inx i And we find, as we exect, that the exression in () matches the exression in (). () 4. We wish to roduce the Fourier Series for the function : f x = - x on - < x < This is our first encounter with eriodic Fourier series on an interval other than. In this case, we use the following versions of Fourier equations : f x = a 0 + S an cos n x n= L + b n sin n x L
hys0-009hw9s.nb 9 where the coefficients are : a n = Lf L x cos n x -L L dx and b n = Lf L x sin n x -L L dx In our current case, L =, and so we roceed : a 0 = Å - x dx = 4 - a n = Å - x cos n x - dx = Integrate x Cos n x, x,,, Assumtions Element n, Integers 0 To find the b n coefficients: b n = Å - x sin n x - dx = Integrate x Sin n x, x,,, Assumtions Element n, Integers 4 n n We then write the Fourier series on this interval as : f x = +Å 4 S - n sin n x n= n = (4) +Å 4 sin x -sin x + - sin x +... (5) Plotting this series over three cycles :
0 hys0-009hw9s.nb Plot 4 Sum ^n Sin n x n, n,, 5, x, 6, 6 4-6 -4-4 6 We can also check Dirichlet' s theorem by using our series in eq. (4) by solving for the value of the function at the jum at x =. We have from equation (4) : f x = +Å 4 S - n sin n x n= n f = +Å 4 S - n sin n n = fl since all sin (n ) terms are zero for integer values of n. This result equals the midoint of the jum at x =, and is consistent with Dirichlet' s theorem. Comlex Fourier Series The comlex Fourier series is given by (Boas,. 6) : f x = inx L S cn e n=- where the comlex coefficients are determined from : c 0 = Lf L x dx c n = L -L L f x e -inx L dx -L for this function, L =, f (x) = - x, and our integrals become : c 0 = Å 4 - x dx = -
hys0-009hw9s.nb c n = Å 4 - x e -inx dx = - Integrate x Ex n x, x,,, Assumtions Element n, Integers 4 Abs n n n n i where use the relationshi i = -/i in the last ste. We can then write the comlex Fourier series as : f x = + i - n S n=- n Look at the inut statement above. In articular, notice how we write the imaginary number in Mathematica code. If you use a simle "i" keystroke, Mathematica will assume "i" reresents a new variable name; in order to indicate the imaginary number, you enter the  iiâ; in other words, hit the escae key, the "i" key twice, followed by the escae key, with no intervening saces. We can use our comuted coefficients to write the first several terms of the comlex Fourier series : f x = c 0 + c e i x + c e -i x + c e ix + c e -ix + c e ix + c - e -ix +... = + i -ei x + e -i x + ei x - ei x + -ei x + e-i x +... = + Å sin x - sin x + sin x - +... (6) which matches the Fourier exansion in eqs. (4) and (5) 5. Find the Fourier series for : f x = sin x on the interval -Å < x < Å Here, L = /, so we have :
hys0-009hw9s.nb a 0 = sin xdx = - cos - cos - = 0 - a n = sin x cos n x dx = 0 - b n = sin x sin nx dx = - Integrate Sin x Sin n x, x,,, Assumtions Element n, Integers 8 n n 4n and to be sure that we cover all ossible cases, we exlicitly evaluate the case for n = : Integrate Sin x Sin x, x,, 8 The Fourier series for this function is then : f x = Å 8 S - n n sin nx = Å 8 n= - 4 n sin x - sin 4 x 5 + sin 6 x 5 -... Plotting cycles of this function gives us : Plot 8 Sum ^n n Sin n x 4 n, n,, 5, x,,.0 0.5 -.5 -.0-0.5 0.5.0.5-0.5 -.0 How well does this Fourier series aroximate sin ( x) on the interval (-/./)? Let' s lot the Fourier exansion and the curve for sin( x) on the same set of axes (with the sin ( x) grah lotted as a thick urle line and the Fourier series lotted with a blue, thick, dashed line) :
hys0-009hw9s.nb Plot Sin x, 8 Sum ^n n Sin n x 4 n, n,, 5, x,,, PlotStyle Thick, Purle, Blue, Thick, Dashed.0 0.5-0.4-0. 0. 0.4-0.5 -.0 And the first 5 terms of the Fourier series converge very closely to the curve of sin ( x). The Comlex Fourier series We find the coefficients : c 0 = sin x dx = - cos - cos - = 0 - c n = sin x e - inx dx = - Integrate Sin x Ex n x, x,,, Assumtions Element n, Integers 4 n n 4n We can write the result in outut line [8] as : -4i - n n - 4 n = 4 - n n i - 4 n so that our comlex Fourier series is : f x = Å 4 S - n n - i - 4 n ein x