# Advanced engineering mathematics with matlab

Showing page : 1 of 986
This preview has blurred sections. Sign up to view the full version!
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ADVANCED ENGINEERING MATHEMATICS with MATLAB SECOND EDITION ADVANCED ENGINEERING MATHEMATICS with MATLAB SECOND EDITION Dean G.Duffy CHAPMAN & HALL/CRC A CRC Press Company Boca Raton London New York Washington, D.C. This edition published in the Taylor & Francis e-Library, 2009. To purchase your own copy of this or any of Taylor & Francis or Routledge's collection of thousands of eBooks please go to www.eBookstore.tandf.co.uk. This book contains information obtained from authentic and highly regarded sources. Reprinted material is quoted with permission, and sources are indicated. A wide variety of references are listed. Reasonable efforts have been made to publish reliable data and information, but the author and the publisher cannot assume responsibility for the validity of all materials or for the consequences of their use. Neither this book nor any part may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, microfilming, and recording, or by any information storage or retrieval system, without prior permission in writing from the publisher. The consent of CRC Press LLC does not extend to copying for general distribution, for promotion, for creating new works, or for resale. Specific permission must be obtained in writing from CRC Press LLC for such copying. Direct all inquiries to CRC Press LLC, 2000 N.W. Corporate Blvd., Boca Raton, Florida 33431. Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation, without intent to infringe. Visit the CRC Press Web site at www.crcpress.com 2003 by Chapman & Hall/CRC No claim to original U.S. Government works ISBN 0-203-00877-4 Master e-book ISBN International Standard Book Number 1-58488-349-9 Contents Dedication Acknowledgments Introduction 1 Complex Variables 1.1 Complex Numbers 1.2 Finding Roots 1.3 The Derivative in the Complex Plane: The Cauchy-Riemann Equations 1.4 Line Integrals 1.5 The Cauchy-Goursat Theorem 1.6 Cauchy's Integral Formula 1.7 Taylor and Laurent Expansions and Singularities 1.8 Theory of Residues 1.9 Evaluation of Real Definite Integrals 1.10 Cauchy's Principal Value Integral 2 First-Order Ordinary Differential Equations 2.1 Classification of Differential Equations 2.2 Separation of Variables 2.3 Homogeneous Equations 2.4 Exact Equations 2.5 Linear Equations 2.6 Graphical Solutions 2.7 Numerical Methods 3 Higher-Order Ordinary Differential Equations 3.1 Homogeneous Linear Equations with Constant Coefficients 3.2 Simple Harmonic Motion 3.3 Damped Harmonic Motion 3.4 Method of Undetermined Coefficients 3.5 Forced Harmonic Motion 3.6 Variation of Parameters 1 1 7 11 23 29 33 37 46 52 63 70 70 74 90 92 95 111 114 125 130 141 148 154 162 172 vi Contents 3.7 Euler-Cauchy Equation 3.8 Phase Diagrams 3.9 Numerical Methods 182 188 193 200 200 215 225 232 235 241 251 268 268 280 283 299 316 321 333 333 342 349 359 362 373 378 383 406 413 423 424 432 4 Fourier Series 4.1 Fourier Series 4.2 Properties of Fourier Series 4.3 Half-Range Expansions 4.4 Fourier Series with Phase Angles 4.5 Complex Fourier Series 4.6 The Use of Fourier Series in the Solution of Ordinary Differential Equations 4.7 Finite Fourier Series 5 The Fourier Transform 5.1 Fourier Transforms 5.2 Fourier Transforms Containing the Delta Function 5.3 Properties of Fourier Transforms 5.4 Inversion of Fourier Transforms 5.5 Convolution 5.6 Solution of Ordinary Differential Equations by Fourier Transforms 6 The Laplace Transform 6.1 Definition and Elementary Properties 6.2 The Heaviside Step and Dirac Delta Functions 6.3 Some Useful Theorems 6.4 The Laplace Transform of a Periodic Function 6.5 Inversion by Partial Fractions: Heaviside's Expansion Theorem 6.6 Convolution 6.7 Integral Equations 6.8 Solution of Linear Differential Equations with Constant Coefficients 6.9 Transfer Functions, Green's Function, and Indicial Admittance 6.10 Inversion by Contour Integration 7 The Z-Transform 7.1 The Relationship of the Z-Transform to the Laplace Transform 7.2 Some Useful Properties Contents 7.3 Inverse Z-Transforms 7.4 Solution of Difference Equations 7.5 Stability of Discrete-Time Systems 8 The Hilbert Transform 8.1 Definition 8.2 Some Useful Properties 8.3 Analytic Signals 8.4 Causality: The Kramers-Kronig Relationship 9 The Sturm-Liouville Problem 9.1 Eigenvalues and Eigenfunctions 9.2 Orthogonality of Eigenfunctions 9.3 Expansion in Series of Eigenfunctions 9.4 A Singular Sturm-Liouville Problem: Legendre's Equation 9.5 Another Singular Sturm-Liouville Problem: Bessel's Equation 10 The Wave Equation 10.1 The Vibrating String 10.2 Initial Conditions: Cauchy Problem 10.3 Separation of Variables 10.4 D'Alembert's Formula 10.5 The Laplace Transform Method 10.6 Numerical Solution of the Wave Equation 11 The Heat Equation 11.1 Derivation of the Heat Equation 11.2 Initial and Boundary Conditions 11.3 Separation of Variables 11.4 The Laplace Transform Method 11.5 The Fourier Transform Method 11.6 The Superposition Integral 11.7 Numerical Solution of the Heat Equation 12 Laplace's Equation 12.1 Derivation of Laplace's Equation 12.2 Boundary Conditions 12.3 Separation of Variables vii 442 456 466 473 473 486 493 497 501 501 515 519 526 547 569 569 573 573 597 607 632 645 645 647 648 700 720 728 744 754 754 757 757 viii Contents 12.4 The Solution of Laplace's Equation on the Upper Half-Plane 12.5 Poisson's Equation on a Rectangle 12.6 The Laplace Transform Method 12.7 Numerical Solution of Laplace's Equation 13 Vector Calculus 13.1 Review 13.2 Divergence and Curl 13.3 Line Integrals 13.4 The Potential Function 13.5 Surface Integrals 13.6 Green's Lemma 13.7 Stokes' Theorem 13.8 Divergence Theorem 14 Linear Algebra 14.1 Fundamentals of Linear Algebra 14.2 Determinants 14.3 Cramer's Rule 14.4 Row Echelon Form and Gaussian Elimination 14.5 Eigenvalues and Eigenvectors 14.6 Systems of Linear Differential Equations Answers to the Odd-Numbered Problems Index 805 808 812 816 823 823 832 839 844 847 855 859 868 879 879 888 894 897 910 920 929 953 Dedicated to the Brigade of Midshipmen and the Corps of Cadets Acknowledgments I would like to thank the many midshipmen and cadets who have taken engineering mathematics from me. They have been willing or unwilling guinea pigs in testing out many of the ideas and problems in this book. Special thanks go to Dr. Mike Marcozzi for his many useful and often humorous suggestions for improving this book. Many of the plots and calculations were done using MATLAB. MATLAB is a registered trademark of The MathWorks Inc. 24 Prime Park Way Natick, MA 017601500 Phone: (508) 6477000 Email: info@mathworks.com www.mathworks.com Finally, I would like to express my appreciation to all those authors and publishers who allowed me the use of their material from the scientific and engineering literature. Introduction This book is an updated and expanded version of my Advanced Engineering Mathematics. I have taken this opportunity to correct misprints, rewrite some of the text, and include new examples, problems, and projects. Of equal importance, however, is the addition of three new chapters so that the book can now be used in a wide variety of differential equations and engineering mathematics courses. These courses normally occur after classes on the calculus of single, multivariable, and vector-valued functions. The book begins with complex variables. All students need to know how to do simple arithmetic operations involving complex numbers; this is presented in the first two sections of Chapter 1. The remaining portions of this chapter focus on contour integration. This material should be taught if the course is devoted to transform methods. After this introduction, subsequent chapters or sections follow from the goals of the course. In its broadest form, there are two general tracks: Differential Equations Course: Most courses on differential equations cover three general topics: fundamental techniques and concepts, Laplace transforms, and separation of variable solutions to partial differential equations. The course begins with first- and higher-order ordinary differential equations, Chapters 2 and 3, respectively. After some introductory remarks, Chapter 2 devotes itself to presenting general methods for solving first-order ordinary differential equations. These methods include separation of variables, employing the properties of homogeneous, linear, and exact differential equations, and finding and using integrating factors. The reason most students study ordinary differential equations is for their use in elementary physics, chemistry, and engineering courses. Because these differential equations contain constant coefficients, we focus on how to solve them in Chapter 3, along with a detailed analysis of the simple, damped, and forced harmonic oscillator. Furthermore, we include the commonly employed techniques of undetermined coefficients and variation of parameters for finding particular solutions. Finally, the special equation of Euler and Cauchy is included because of its use in solving partial differential equations in spherical coordinates. After these introductory chapters, the course would next turn to Laplace transforms. Laplace transforms are useful in solving nonhomogeneous differential equations where the initial conditions have been specified and the forcing function "turns on and off." The general properties are explored in 6.1 to 6.7; the actual solution technique is presented in 6.8 and 6.9. Most differential equations courses conclude with a taste of partial differential equations via the method of separation of variables. This topic usually begins with a quick introduction to Fourier series, 4.1 to 4.4, followed by separation of variables as it applies to the heat (11.111.3), wave (10.1 10.3), or Laplace's equation (12.1 12.3). The exact equation that is studied depends upon the future needs of the students. Engineering Mathematics Course: This book can be used in a wide variety of engineering mathematics classes. In all cases the student should have seen most of the material in Chapters 2 and 3. There are at least three possible combinations: Introduction xv Option A: The course is a continuation of a calculus reform sequence where elementary differential equations have been taught. This course begins with Laplace transforms and separation of variables techniques for the heat, wave, and/or Laplace equations, as outlined above. The course then concludes with either vector calculus or linear algebra. Vector calculus is presented in Chapter 13 and focuses on the gradient operator as it applies to line integrals, surface integrals, the divergence theorem, and Stokes' theorem. Chapter 14 presents linear algebra as a method for solving systems of linear equations and includes such topics as matrices, determinants, Cramer's rule, and the solution of systems of ordinary differential equations via the classic eigenvalue problem. Option B: This is the traditional situation where the student has already studied differential equations in another course before he takes engineering mathematics. Here separation of variables is retaught from the general viewpoint of eigenfunction expansions. Sections 9.19.3 explain how any piecewise continuous function can be reexpressed in an eigenfunction expansion using eigenfunctions from the classic Sturm-Liouville problem. Furthermore, we include two sections which focus on Bessel functions (9.4) and Legendre polynomials (9.5). These eigenfunctions appear in the solution of partial differential equations in cylindrical and spherical coordinates, respectively. The course then covers linear algebra and vector calculus as given in Option A. Option C: I originally wrote this book for an engineering mathematics course given to sophomore and junior communication, systems, and electrical engineering majors at the U.S. Naval Academy. In this case, you would teach all of Chapter 1 with the possible exception of 1.10 on Cauchy principalvalue integrals. This material was added to prepare the student for Hilbert transforms. Because most students come to this course with a good knowledge of differential equations, we begin with Fourier series, Chapter 4, and proceed through Chapter 8. Chapter 5 generalizes the Fourier series to aperiodic functions and introduces the Fourier transform in Chapter 5. This leads naturally to Laplace transforms, Chapter 6. Throughout these chapters, I make use of complex variables in the treatment and inversion of the transforms. With the rise of digital technology and its associated difference equations, a version of the Laplace transform, the z-transform, was developed. Chapter 7 introduces the ztransform by first giving its definition and then developing some of its general properties. We also illustrate how to compute the inverse by long division, partial fractions, and contour integration. Finally, we use z-transforms to solve difference equations, especially with respect to the stability of the system. Finally, I added a new chapter on the Hilbert transform. With the explosion of interest in communications, today's engineer must have a command of this transform. The Hilbert transform is introduced in 8.1 and its properties are explored in 8.2. Two important applications of Hilbert transforms are introduced in 8.3 and 8.4, namely the concept of analytic signals and the Kramer-Kronig relationship. In addition to the revisions of the text and topics covered in this new addition, I now incorporate the mathematical software package MATLAB to reinforce the concepts that are taught. The power of MATLAB is its ability to quickly and easily present results in a graphical format. I have exploited this aspect and now included code (scripts) so that the student can explore the solution for a wide variety of parameters and different prospectives. xvi Introduction Of course this book still continues my principle of including a wealth of examples from the scientific and engineering literature. The answers to the odd problems are given in the back of the book while worked solutions to all of the problems are available from the publisher. Most of the MATLAB scripts may be found at www.crcpress.com under Electronic Products Downloads & Updates. Chapter 1 Complex Variables The theory of complex variables was originally developed by mathematicians as an aid in understanding functions. Functions of a complex variable enjoy many powerful properties that their real counterparts do not. That is not why we will study them. For us they provide the keys for the complete mastery of transform methods and differential equations. In this chapter all of our work points to one objective: integration on the complex plane by the method of residues. For this reason we minimize discussions of limits and continuity which play such an important role in conventional complex variables in favor of the computational aspects. We begin by introducing some simple facts about complex variables. Then we progress to differential and integral calculus on the complex plane. 1.1 COMPLEX NUMBERS A complex number is any number of the form a+bi, where a and b are real and We denote any member of a set of complex numbers by the complex variable z=x+iy. The real part of z, usually denoted by Re(z), is x while the imaginary part of z, Im(z), is y. The complex conjugate, or z*, of the complex number a+bi is a bi. Complex numbers obey the fundamental rules of algebra. Thus, two complex numbers a+bi and c+di are equal if and only if a=c and b=d. Just as real numbers have the fundamental operations of addition, subtraction, multiplication, and division, so too do complex numbers. These operations are defined: Addition (a+bi)+(c+di)=(a+c)+(b+d)i Subtraction (a+bi) (c+di)=(a c)+(b d)i Multiplication (a+bi)(c+di)=ac+bci+adi+i2bd=(ac bd)+(ad+bc)i (1.1.3) (1.1.2) (1.1.1) 2 Advanced Engineering Mathematics with MATLAB Division (1.1.4) The absolute value or modulus of a complex number a+bi, written |a+bi|, equals Additional properties include: (1.1.5) (1.1.6) (1.1.7) and (1.1.8) The use of inequalities with complex variables has meaning only when they involve absolute values. It is often useful to plot the complex number x+iy as a point (x, y) in the xy-plane, now called the complex plane. Figure 1.1.1 illustrates this representation. This geometrical interpretation of a complex number suggests an alternative method of expressing a complex number: the polar form. From the polar representation of x and y, x=r cos( ) and y=r sin( ), is the modulus, amplitude, or absolute value of z and where argument or phase, we have that z=x+iy=r[cos( )+i sin( )]. (1.1.9) is the (1.1.10) Complex Variables 3 Figure 1.1.1: The complex plane. However, from the Taylor expansion of the exponential in the real case, (1.1.11) Expanding (1.1.11), (1.1.12) =cos( )+i sin( ). (1.1.13) Equation (1.1.13) is Euler's formula. Consequently, we may express (1.1.10) as z=rei , (1.1.14) which is the polar form of a complex number. Furthermore, because zn=rnein (1.1.15) 4 Advanced Engineering Mathematics with MATLAB by the law of exponents, zn=rn[cos(n )+i sin(n )]. Equation (1.1.16) is De Moi re's theorem. Example 1.1.1 Let us simplify the following complex number: (1.1.17) (1.1.16) Example 1.1.2 Let us reexpress the complex number 1 in polar form. From (1.1.9) lies in and =tan (b/a)= = /6 or 7 /6. Because the third quadrant of the complex plane, =7 /6 and (1.1.18) Note that (1.1.18) is not a unique representation because 2n may be added to 7 /6 and we still have the same complex number since ei( 2n ) =cos( 2n )+i sin( 2n )=cos( )+i sin( )=ei . (1.1.19) For uniqueness we often choose n=0 and define this choice as the principal branch. Other branches correspond to different values of n. Example 1.1.3 Find the curve described by the equation |z z0|=a. From the definition of the absolute value, (1.1.20) Complex Variables or (x x0)2+(y y0)2=a2. 5 (1.1.21) Equation (1.1.21), and hence |z z0|=a, describes a circle of radius a with its center located at (x0, y0). Later on, we shall use equations such as this to describe curves in the complex plane. Example 1.1.4 As an example in manipulating complex numbers, let us show that (1.1.22) We begin by simplifying (1.1.23) Therefore, (1.1.24) MATLAB can also be used to solve this problem. Typing the commands syms a b real abs ( (a+b*i) / (b+a*i) ) yields ans = 1 Note that you must declare a and b real in order to get the final result. Problems Simplify the following complex numbers. Represent the solution in the Cartesian form a+bi. Check your answers using MATLAB. 1. 6 Advanced Engineering Mathematics with MATLAB 2. 3. 4. (1 i)4 5. Represent the following complex numbers in polar form: 6. i 7. 4 8. 9. 5+5i 10. 22i 11. 12. By the law of exponents, ei( + )=ei ei . Use Euler's formula to obtain expressions for cos( + ) and sin( + ) in terms of sines and cosines of and . 13. Using the property that and the geometric series obtain the following sums of trigonometric functions: and These results are often called Lagrange's trigonometric identities. 14. (a) Using the property that series show that if |q|<1, and the geometric and Complex Variables (b) Let where >0. Show that 7 1.2 FINDING ROOTS The concept of finding roots of a number, which is rather straightforward in the case of real numbers, becomes more difficult in the case of complex numbers. By finding the roots of a complex number, we wish to find all of the solutions of the equation n=z, where n is a positive integer for a given z. We begin by writing z in the polar form: z=rei, while we write =Rei (1.2.2) (1.2.1) for the unknown. Consequently, n =Rnein =rei =z. (1.2.3) We satisfy (1.2.3) if Rn=r and n = +2k , k=0, 1, 2,..., (1.2.4) because the addition of any multiple of 2 to the argument is also a solution. Thus, R=r1/n, where R is the uniquely determined real positive root, and (1.2.5) Because solutions: k = kn , it is sufficient to take k=0, 1, 2,..., n 1. Therefore, there are exactly n 8 Advanced Engineering Mathematics with MATLAB (1.2.6) with k=0, 1, 2,..., n 1. They are the n roots of z. Geometrically we can locate these solutions wk on a circle, centered at the point (0, 0), with radius R and separated from each other by 2 /n radians. These roots also form the vertices of a regular polygon of n sides inscribed inside of a circle of radius R. (See Example 1.2.1.) In summary, the method for finding the n roots of a complex number z0 is as follows. First, write z0 in its polar form: z0=rei . Then multiply the polar form by e2i k. Using the law of exponents, take the 1/n power of both sides of the equation. Finally, using Euler's formula, evaluate the roots for k=0, 1,..., n 1. Example 1.2.1 Let us find all of the values of z for which z5= 32 and locate these values on the complex plane. Because 32=32e i=25e i, (1.2.7) (1.2.8) or (1.2.9) (1.2.10) z2=2e i= 2, (1.2.11) (1.2.12) Complex Variables and 9 (1.2.13) Figure 1.2.1 shows the location of these roots in the complex plane. Example 1.2.2 Let us find the cube roots of 1+i and locate them graphically. Because 1+i= (1.2.14) 5 Figure 1.2.1: The zeros of z = 32. or (1.2.15) (1.2.16) 10 Advanced Engineering Mathematics with MATLAB and (1.2.17) Figure 1.2.2 gives the location of these zeros on the complex plane. Example 1.2.3 The routine solve in MATLAB can also be used to compute the roots of complex numbers. For example, let us find all of the roots of z4= 4. The MATLAB commands are as follows: syms a z solve(z^4+a^4) This yields the solution ans= [(1/2*2^(1/2)+1/2*i*2^(1/2))*a] [(-1/2*2^(1/2)+1/2*i*2^(1/2))*a] [(1/2*2^(1/2)-1/2*i*2^(1/2))*a] Figure 1.2.2: The zeros of z3= 1+i. [(-1/2*2^(1/2)-1/2*i*2^(1/2))*a] Problems Extract all of the possible roots of the following complex numbers. Verify your answer using MATLAB. Complex Variables 11 1. 81/6 2. ( 1)1/3 3. ( i)1/3 4. ( 27i)1/6 5. Find algebraic expressions for the square roots of a bi, where a>0 and b>0. 6. Find all of the roots for the algebraic equation z4 3iz2 2=0. Then check your answer using solve in MATLAB. 7. Find all of the roots for the algebraic equation z4+6iz2+16=0. Then check your answer using solve in MATLAB. 1.3 THE DERIVATIVE IN THE COMPLEX PLANE: THE CAUCHYRIEMANN EQUATIONS In the previous two sections, we introduced complex arithmetic. We are now ready for the concept of function as it applies to complex variables. We already defined the complex variable z=x+iy, where x and y are variable. We now introduce another complex variable w=u+i so that for each value of z there corresponds a value of w=f(z). From all of the possible complex functions that we might invent, we focus on those functions where for each z there is one, and only one, value of w. These functions 2 Figure 1.3.1: The complex function =z . are single alued. They differ from functions such as the square root, logarithm, and inverse sine and cosine, where there are multiple answers for each z. These multivalued functions do arise in various problems. However, they are beyond the scope of this book and we shall always assume that we are dealing with single-valued functions. A popular method for representing a complex function involves drawing some closed domain in the z-plane and then showing the corresponding domain in the -plane. This procedure is called mapping and the z-plane illustrates the domain of the function while the -plane illustrates its image or range. Figure 1.3.1 shows the z-plane and -plane for =z2; a pie-shaped wedge in the z-plane maps into a semicircle on the -plane. 12 Advanced Engineering Mathematics with MATLAB Example 1.3.1 Given the complex function From Euler's formula, (1.3.1) let us find the corresponding u(x, y) and (x,y) Therefore, by inspection, (1.3.2) Note that there is no i in the expression for (x, y). The function =f(z) is single-valued because for each distinct value of z, there is an unique value of u(x, y) and (x, y). Example 1.3.2 As counterpoint, let us show that We begin by writing z=re i +2 ik is a multivalued function. , where r= and = tan 1(y/x). Then, (1.3.3) or (1.3.4) Therefore, (1.3.5) and (1.3.6) Complex Variables Each solution w0 or w1 is a branch of the multivalued function We can make 13 single-valued by restricting ourselves to a single branch, say w0. In that case, the Re(w)>0 if we restrict < < . Although this is not the only choice that we could have made, it is a popular one. For example, most digital computers use this definition in their complex square root function. The point here is our ability to make a multivalued function singlevalued by defining a particular branch. Although the requirement that a complex function be single-valued is important, it is still too general and would cover all functions of two real variables. To have a useful theory, we must introduce additional constraints. Because an important property associated with most functions is the ability to take their derivative, let us examine the derivative in the complex plane. Following the definition of a derivative for a single real variable, the derivative of a complex function w=f(z) is defined as (1.3.7) A function of a complex variable that has a derivative at every point within a region of the complex plane is said to be analytic (or regular or holomorphic) over that region. If the function is analytic everywhere in the complex plane, it is entire. Because the derivative is defined as a limit and limits are well behaved with respect to elementary algebraic operations, the following operations carry over from elementary calculus: (1.3.8) (1.3.9) (1.3.10) (1.3.11) (1.3.12) 14 Advanced Engineering Mathematics with MATLAB Another important property that carries over from real variables is l'Hspital rule: Let f(z) and g(z) be analytic at z0, where f(z) has a zero1 of order m and g(z) has a zero of order n. Then, if m>n, (1.3.13) if m=n, (1.3.14) and if m<n, (1.3.15) Example 1.3.3 Let us evaluate limzi (z10+1)/(z6+1). From l'Hspital rule, (1.3.16) So far, we introduced the derivative and some of its properties. But how do we actually know whether a function is analytic or how do we compute its derivative? At this point we must develop some relationships involving the known quantities u(x, y) and (x, y). We begin by returning to the definition of the derivative. Because z= x+i y, there is an infinite number of different ways of approaching the limit z0. Uniqueness of that limit requires that (1.3.7) must be independent of the manner in which z approaches zero. A simple example is to take z in the x-direction so that z= x; another is to take z in the y-direction so that z=i y. These examples yield (1.3.17) 1 An analytic function f(z) has a zero of order m at z0 if and only if f(z0)=f (z0)= ...=f(m 1)(z0)=0 and f(m)(z0) 0. Complex Variables 15 Figure 1.3.2: Although educated as an engineer, Augustin-Louis Cauchy (17891857) would become a mathematician's mathematician, publishing 789 papers and 7 books in the fields of pure and applied mathematics. His greatest writings established the discipline of mathematical analysis as he refined the notions of limit, continuity, function, and convergence. It was this work on analysis that led him to develop complex function theory via the concept of residues. (Portrait courtesy of the Archives de l'Acadmie des sciences, Paris.) and (1.3.18) In both cases we are approaching zero from the positive side. For the limit to be unique and independent of path, (1.3.17) must equal (1.3.18), or (1.3.19) These equations which u and must both satisfy are the Cauchy-Riemann equations. They are necessary but not sufficient to ensure that a function is differentiable. The following example illustrates this. 16 Advanced Engineering Mathematics with MATLAB Example 1.3.4 Consider the complex function (1.3.20) Figure 1.3.3: Despite his short life, (Georg Friedrich) Bernhard Riemann's (18261866) mathematical work contained many imaginative and profound concepts. It was in his doctoral thesis on complex function theory (1851) that he introduced the Cauchy-Riemann differential equations. Riemann's later work dealt with the definition of the integral and the foundations of geometry and non-Euclidean (elliptic) geometry. (Portrait courtesy of Photo AKG, London.) The derivative at z=0 is given by (1.3.21) provided that this limit exists. However, this limit does not exist because, in general, the numerator depends upon the path used to approach zero. For example, if z=re i/4 with r0, d /dz= 1. On the other hand, if z=re i/2 with r0, d /dz=1. Are the Cauchy-Riemann equations satisfied in this case? To check this, we first compute Complex Variables 17 (1.3.22) (1.3.23) (1.3.24) and (1.3.25) Hence, the Cauchy-Riemann equations are satisfied at the origin. Thus, even though the derivative is not uniquely defined, (1.3.21) happens to have the same value for paths taken along the coordinate axes so that the CauchyRiemann equations are satisfied. In summary, if a function is differentiable at a point, the Cauchy-Riemann equations hold. Similarly, if the Cauchy-Riemann equations are not satisfied at a point, then the function is not differentiable at that point. This is one of the important uses of the Cauchy-Riemann equations: the location of nonanalytic points. Isolated nonanalytic points of an otherwise analytic function are called isolated singularities. Functions that contain isolated singularities are called meromorphic. The Cauchy-Riemann condition can be modified so that it is sufficient for the derivative to exist. Let us require that ux, uy, x, and y be continuous in some region surrounding a point z0 and satisfy the Cauchy-Riemann equations there. Then f(z) f(z0)=[u(z)] u(z0)]+i[ (z) (z0)] (1.3.26) (1.3.27) (1.3.28) where we used the Cauchy-Riemann equations and as x, y 0. 18 Advanced Engineering Mathematics with MATLAB Hence, (1.3.29) because | x| | z| and | y| | z|. Using (1.3.29) and the CauchyRiemann equations, we can obtain the derivative from any of the following formulas: (1.3.30) and (1.3.31) Furthermore, f (z0) is continuous because the partial derivatives are. Example 1.3.5 Let us show that sin(z) is an entire function. (1.3.32) (1.3.33) =sin(z) u+i =sin(x+iy)=sin(x) cos(iy)+cos(x) sin(iy) =sin(x) cosh(y)+i cos(x) sinh(y), because (1.3.34) (1.3.35) Complex Variables 19 and (1.3.36) so that u(x, y)=sin(x) cosh(y), and (x, y)=cos(x) sinh(y). (1.3.37) Differentiating both u(x, y) and (x, y) with respect to x and y, we have that (1.3.38) (1.3.39) and u(x, y) and (x, y) satisfy the Cauchy-Riemann equations for all values of x and y. Furthermore, ux, uy, x , and y are continuous for all x and y. Therefore, the function =sin(z) is an entire function. Example 1.3.6 Consider the function =1/z. Then (1.3.40) Therefore, (1.3.41) 20 Advanced Engineering Mathematics with MATLAB Now (1.3.42) (1.3.43) (1.3.44) and (1.3.45) The function is analytic at all points except the origin because the function itself ceases to exist when both x and y are zero and the modulus of becomes infinite. Example 1.3.7 Let us find the derivative of sin(z). Using (1.3.30) and (1.3.34), (1.3.46) =cos(x) cosh(y) i sin(x) sinh(y) (1.3.47) =cos(x+iy)=cos(z). (1.3.48) Similarly, (1.3.49) Complex Variables 21 (1.3.50) The results in the above examples are identical to those for z real. As we showed earlier, the fundamental rules of elementary calculus apply to complex differentiation. Consequently, it is usually simpler to apply those rules to find the derivative rather than breaking f(z) down into its real and imaginary parts, applying either (1.3.30) or (1.3.31), and then putting everything back together. An additional property of analytic functions follows by cross differentiating the Cauchy-Riemann equations or (1.3.51) and (1.3.52) Any function that has continuous partial derivatives of second order and satisfies Laplace's equation (1.3.51) or (1.3.52) is called a harmonic function. Because both u(x, y) and (x, y) satisfy Laplace's equation if f(z)=u+i is analytic, u(x, y) and (x, y) are called conjugate harmonic functions. Example 1.3.8 Given that u(x, y)=e x[x sin(y) y cos(y)], let us show that u is harmonic and find a conjugate harmonic function (x, y) such that f(z)=u+i is analytic. Because (1.3.53) and (1.3.54) it follows that uxx+uyy=0. Therefore, u(x, y) is harmonic. From the Cauchy-Riemann equations, 22 Advanced Engineering Mathematics with MATLAB (1.3.55) and (1.3.56) Integrating (1.3.55) with respect to y, (x, y)=ye x sin(y)+xe x cos(y)+g(x). (1.3.57) Using (1.3.56), x = ye =e x x sin(y) xe x x cos(y)+e x x cos(y)+g (x) (1.3.58) cos(y) xe cos(y) ye sin(x). Therefore, g (x)=0 or g(x)=constant. Consequently, (x, y)=e x[y sin(y)+xcos(y)]+constant. (1.3.59) Hence, for our real harmonic function u(x, y), there are infinitely many harmonic conjugates (x, y) which differ from each other by an additive constant. Problems Show that the following functions are entire: 1. f(z)=iz+2 2. f(z)=e z 3. f(z)=z3 4. f(z)=cosh(z) Find the derivative of the following functions: 5. f(z)=(1+z2)3/2 6. f(z)=(z+2z1/2)1/3 7. f(z)=(1+4i)z2 3z 2 8. f(z)=(2z i)/(z+2i) 9. f(z)=(iz 1) 3 Complex Variables Evaluate the following limits: 10. 11. 12. Show that the function f(z)=z* is nowhere differentiable. For each of the following u(x, y), show that it is harmonic and then find a corresponding (x, y) such that f(z)=u+i is analytic. 13. u(x, y)=x2 y2 14. u(x, y)=x46x2y2+y4+x 15. u(x, y)=x cos(x)e y y sin (x)e y 16. u(x, y)=(x2 y2) cos(y)ex 2xy sin(y)ex 1.4 LINE INTEGRALS 23 So far, we discussed complex numbers, complex functions, and complex differentiation. We are now ready for integration. Just as we have integrals involving real variables, we can define an integral that involves complex variables. Because the z-plane is two-dimensional there is clearly greater freedom in what we mean by a complex integral. For example, we might ask whether the integral of some function between points A and B depends upon the curve along which we integrate. (In general it does.) Consequently, an important ingredient in any complex integration is the contour that we follow during the integration. The result of a line integral is a complex number or expression. Unlike its counterpart in real variables, there is no physical interpretation for this quantity, such as area under a curve. Generally, integration in the complex plane is an intermediate process with a physically realizable quantity occurring only after we take its real or imaginary part. For example, in potential fluid flow, the lift and drag are found by taking the real and imaginary part of a complex integral, respectively. How do we compute C f(z) dz? Let us deal with the definition; we illustrate the actual method by examples. A popular method for evaluating complex line integrals consists of breaking everything up into real and imaginary parts. This reduces the integral to line integrals of real-valued functions which we know how to handle. Thus, we write f(z)=u(x, y)+i (x, y) as usual, and because z=x+iy, formally dz=dx+i dy. Therefore, (1.4.1) (1.4.2) 24 Advanced Engineering Mathematics with MATLAB The exact method used to evaluate (1.4.2) depends upon the exact path specified. From the definition of the line integral, we have the following self-evident properties: (1.4.3) where C is the contour C taken in the opposite direction of C and (1.4.4) Example 1.4.1 Let us evaluate C z*dz from z=0 to z=4+2i along two different contours. The first consists of the parametric equation z=t2+it. The second consists of two "dog legs": the first leg runs along the imaginary axis from z=0 to z=2i and then along a line parallel to the x-axis from z=2i to z=4 +2i. See Figure 1.4.1. For the first case, the points z=0 and z=4+2i on C1 correspond to t=0 and t=2, respectively. Then the line integral equals (1.4.5) Figure 1.4.1: Contour used in Example 1.4.1. The line integral for the second contour C2 equals (1.4.6) Complex Variables 25 where C2a denotes the integration from z=0 to z=2i while C2b denotes the integration from z=2i to z=4+2i. For the first integral, (1.4.7) because x=0 and dx=0 along C2a. On the other hand, along C2b, y=2 and dy=0 so that (1.4.8) Thus the value of the entire C2 contour integral equals the sum of the two parts or 10 8i. The point here is that integration along two different paths has given us different results even though we integrated from z=0 to z=4+2i both times. This result foreshadows a general result that is extremely important. Because the integrand contains nonanalytic points along and inside the region enclosed by our two curves, as shown by the CauchyRiemann equations, the results depend upon the path taken. Since complex integrations often involve integrands that have nonanalytic points, many line integrations depend upon the contour taken. Example 1.4.2 Let us integrate the entire function f(z)=z2 along the two paths from z=0 to z=2+i shown in Figure 1.4.2. For the first integration, x=2y Figure 1.4.2: Contour used in Example 1.4.2. 26 Advanced Engineering Mathematics with MATLAB while along the second path we have two straight paths: z=0 to z=2 and z=2 to z=2+i. For the first contour integration, (1.4.9) (1.4.10) (1.4.11) (1.4.12) (1.4.13) For our second integration, (1.4.14) Along C2a we find that y=dy=0 so that (1.4.15) and (1.4.16) Complex Variables because x=2 and dx=0. Consequently, 27 (1.4.17) Figure 1.4.3: Contour used in Example 1.4.3. In this problem we obtained the same results from two different contours of integration. Exploring other contours, we would find that the results are always the same; the integration is path-independent. But what makes these results path-independent while the integration in Example 1.4.1 was not? Perhaps it is the fact that the integrand is analytic everywhere on the complex plane and there are no nonanalytic points. We will explore this later. Finally, an important class of line integrals involves closed contours. We denote this special subclass of line integrals by placing a circle on the integral sign: the following examples: Example 1.4.3 Let us integrate f(z)=z around the closed contour shown in Figure 1.4.3. From Figure 1.4.3, (1.4.18) Consider now Now (1.4.19) 28 Advanced Engineering Mathematics with MATLAB (1.4.20) and (1.4.21) where we used z=e integral equals zero. i around the portion of the unit circle. Therefore, the closed line Example 1.4.4 Let us integrate f(z)=1/(z a) around any circle centered on z=a. The Cauchy-Riemann equations show that f(z) is a meromorphic function. It is analytic everywhere except at the isolated singularity z=a. If we introduce polar coordinates by letting z a=re i and dz=ire id , (1.4.22) Note that the integrand becomes undefined at z=a. Furthermore, the answer is independent of the size of the circle. Our example suggests that when we have a closed contour integration it is the behavior of the function within the contour rather than the exact shape of the closed contour that is of importance. We will return to this point in later sections. Problems 1. Evaluate around the circle |z|=1 taken in the counterclockwise direction. around the square with vertices at (0, 0), (1, 0), (1, 1), and (0, 1) 2. Evaluate taken in the counterclockwise direction. 3. Evaluate 4. Evaluate 5. Evaluate C |z|dz along the right half of the circle |z|=1 from z= i to z=i. along the line y=x from ( 1, 1) to (1, 1). along the line y=x2 from (0, 0) to (1, 1). 6. Evaluate where C is (a) the upper semicircle |z|=1 and (b) the lower semicircle |z|=1. If z=re i, restrict < < . Take both contours in the counterclockwise direction. Complex Variables 1.5 THE CAUCHY-GOURSAT THEOREM 29 In the previous section we showed how to evaluate line integrations by brute-force reduction to real-valued integrals. In general, this direct approach is quite difficult and we would like to apply some of the deeper properties of complex analysis to work smarter. In the remaining portions of this chapter we introduce several theorems that will do just that. Figure 1.5.1: Diagram used in proving the Cauchy-Goursat theorem. If we scan over the examples worked in the previous section, we see considerable differences when the function was analytic inside and on the contour and when it was not. We may formalize this anecdotal evidence into the following theorem: Cauchy-Goursat theorem2: Let f(z) be analytic in a domain D and let C be a simple Jordan cur e3 inside D so that f(z) is analytic on and inside of C. Then Proof: Let C denote the contour around which we will integrate =f(z). We divide the region within C into a series of infinitesimal rectangles. See Figure 1.5.1. The integration around each rectangle equals the product of the average value of on each side and its length, (1.5.1) 2 Goursat, E., 1900: Sur la dfinition gnirale des fonctions analytiques, d'aprs Cauchy. Trans. Am. Math. Soc., 1, 1416. 3 A Jordan curve is a simply closed curve. It looks like a closed loop that does not cross itself. See Figure 1.5.2. 30 Advanced Engineering Mathematics with MATLAB Substituting =u+i into (1.5.1), (1.5.2) Figure 1.5.2: Examples of a (a) simply closed curve and (b) not simply closed curve. Because the function is analytic, the right side of (1.5.1) and (1.5.2) equals zero. Thus, the integration around each of these rectangles also equals zero. We note next that in integrating around adjoining rectangles we transverse each side in opposite directions, the net result being equivalent to integrating around the outer curve C. We therefore arrive at the result where f(z) is analytic within and on the closed contour. The Cauchy-Goursat theorem has several useful implications. Suppose that we have a domain where f(z) is analytic. Within this domain let us evaluate a line integral from point A to B along two different contours C1 and C2. Then, the integral around the closed contour formed by integrating along C1 and then back along C2, only in the opposite direction, is (1.5.3) Complex Variables or 31 (1.5.4) Because C1 and C2 are completely arbitrary, we have the result that if, in a domain, f(z) is analytic, the integral between any two points within the domain is path independent. One obvious advantage of path independence is the ability to choose the contour so that the computations are made easier. This obvious choice immediately leads to The principle of deformation of contours: The value of a line integral of an analytic function around any simple closed contour remains unchanged if we deform the contour in such a manner that we do not pass over a nonanalytic point. Example 1.5.1 Let us integrate f(z)=z 1 around the closed contour C in the counterclockwise direction. This contour consists of a square, centered on the origin, with vertices at (1, 1), (1, 1), ( 1, 1), and ( 1, 1). The direct integration of around the original contour is very cumbersome. However, because the integrand is analytic everywhere except at the origin, we may deform the origin contour into a circle of radius r, centered on the origin. Then, z=re i and dz=rie i d so that (1.5.5) The point here is that no matter how bizarre the contour is, as long as it encircles the origin and is a simply closed contour, we can deform it into a circle and we get the same answer for the contour integral. This suggests that it is not the shape of the closed contour that makes the difference but whether we enclose any singularities [points where f(z) becomes undefined] that matters. We shall return to this idea many times in the next few sections. Finally, suppose that we have a function f(z) such that f(z) is analytic in some domain. Furthermore, let us introduce the analytic function F(z) such that f(z)=F (z). We would like to evaluate in terms of F(z). We begin by noting that we can represent F, f as F(z)=U+iV and f(z)=u+i . From (1.3.30) we have that u=Ux and =Vx. Therefore, (1.5.6) 32 Advanced Engineering Mathematics with MATLAB (1.5.7) (1.5.8) (1.5.9) or (1.5.10) Equation (1.5.10) is the complex variable form of the fundamental theorem of calculus. Thus, if we can find the antiderivative of a function f(z) that is analytic within a specific region, we can evaluate the integral by evaluating the antiderivative at the endpoints for any curves within that region. Example 1.5.2 Let us evaluate z sin(z2) dz. cos(z2). The integrand f(z)=z sin(z2) is an entire function and has the antiderivative Therefore, (1.5.11) Problems For the following integrals, show that they are path independent and determine the value of the integral: 1. 2. 3. Complex Variables 4. 33 1.6 CAUCHY'S INTEGRAL FORMULA In the previous section, our examples suggested that the presence of a singularity within a contour really determines the value of a closed contour integral. Continuing with this idea, let us consider a class of closed contour integrals that explicitly contain a single singularity within the contour, namely where g(z)=f(z)/(z z0), and f(z) is analytic within and on the contour C. We closed the contour in the positive sense where the enclosed area lies to your left as you move along the contour. We begin by examining a closed contour integral where the closed contour consists of the C1, C2, C3, and C4 as shown in Figure 1.6.1. The gap or cut between C2 and C4 is very small. Because g(z) is analytic within and on the closed integral, we have that (1.6.1) It can be shown that the contribution to the integral from the path C2 going into the singularity cancels the contribution from the path C4 going away from the singularity as the gap between them vanishes. Because f(z) is analytic at z0, we can approximate its value on C3 by f(z)=f(z0)+ (z), where is a small quantity. Substituting into (1.6.1), (1.6.2) Figure 1.6.1: Diagram used to prove Cauchy's integral formula. 34 Advanced Engineering Mathematics with MATLAB Consequently, as the gap between C2 and C4 vanishes, the contour C1 becomes the closed contour C so that (1.6.2) may be written (1.6.3) and where we set Let M denote the value of the integral on the right side of (1.6.3) and greatest value of the modulus of along the circle. Then equal the (1.6.4) As the radius of the circle diminishes to zero, also diminishes to zero. Therefore, |M|, which is positive, becomes less than any finite quantity, however small, and M itself equals zero. Thus, we have that (1.6.5) This equation is Cauchy's integral formula. By taking n derivatives of (1.6.5), we can extend Cauchy's integral formula4 to (1.6.6) for n=1, 2, 3.... For computing integrals, it is convenient to rewrite (1.6.6) as (1.6.7) 4 See Carrier, G.F., M.Krook, and C.E.Pearson, 1966: Functions of a Complex Variable: Theory and Technique. McGraw-Hill, pp. 3940 for the proof. Complex Variables Example 1.6.1 Let us find the value of the integral 35 (1.6.8) where C is the circle |z|=5. Using partial fractions, (1.6.9) and (1.6.10) By Cauchy's integral formula with z0=2 and z0=1, (1.6.11) and (1.6.12) because z0=1 and z0=2 lie inside C and cos( z) is analytic there. Thus the required integral has the value (1.6.13) Example 1.6.2 Let us use Cauchy's integral formula to evaluate (1.6.14) We need to convert (1.6.14) into the form (1.6.7). To do this, we rewrite (1.6.14) as 36 Advanced Engineering Mathematics with MATLAB (1.6.15) Therefore, f(z)=ez/(z 3), n=1 and z0=1. The function f(z) is analytic within the closed contour because the point z=3 lies outside of the contour. Applying Cauchy's integral formula, (1.6.16) (1.6.17) (1.6.18) Problems Use Cauchy's integral formula to evaluate the following integrals. Assume all of the contours are in the positive sense. 1. 2. 3. 4. 5. 6. 7. 8. 9. Complex Variables 37 10. Project: Computing Derivatives of Any Order of a Complex or Real Function The most common technique for computing a derivative is finite differencing. Recently Mahajerin and Burgess5 showed how Cauchy's integral formula can be used to compute the derivatives of any order of a complex or real function via numerical quadrature. In this project you will derive the algorithm, write code implementing it, and finally test it. Step 1: Consider the complex function f(z)=u+i which is analytic inside the closed circular contour C of radius R centered at z0. Using Cauchy's integral formula, show that where x=x0+Rcos( ), and y=y0+Rsin( ). Step 2: Using five-point Gaussian quadrature, write code to implement the results from Step 1. Step 3: Test out this scheme by finding the first, sixth, and eleventh derivative of f(x)=8x/(x2+4) for x=2. The exact answers are 0, 2.8125, and 1218.164, respectively. What is the maximum value of R? How does the accuracy vary with the number of subdivisions used in the numerical integration? Is the algorithm sensitive to the value of R and the number of subdivisions? For a fixed number of subdivisions, is there an optimal R? 1.7 TAYLOR AND LAURENT EXPANSIONS AND SINGULARITIES In the previous section we showed what a crucial role singularities play in complex integration. Before we can find the most general way of computing a closed complex integral, our understanding of singularities must deepen. For this, we employ power series. One reason why power series are so important is their ability to provide locally a general representation of a function even when its arguments are complex. For example, when we were introduced to trigonometric functions in high school, it was in the context of a right triangle and a real angle. However, when the argument becomes complex this geometrical description disappears and power series provide a formalism for defining the trigonometric functions, regardless of the nature of the argument. Let us begin our analysis by considering the complex function f(z) which is analytic everywhere on the boundary and the interior of a circle whose center is at z=z0. Then, if z denotes any point within the circle, we have from Cauchy's integral formula that Reprinted from Computers & Struct., 49, E.Mahajerin and G.Burgess, An algorithm for computing derivatives of any order of a complex or real function, 385387, 1993, with permission from Elsevier Science. 5 38 Advanced Engineering Mathematics with MATLAB (1.7.1) where C denotes the closed contour. Expanding the bracketed term as a geometric series, we find that (1.7.2) Applying Cauchy's integral formula to each integral in (1.7.2), we finally obtain (1.7.3) or the familiar formula for a Taylor expansion. Consequently, we can expand any analytic function into a Taylor series. Interestingly, the radius of convergence6 of this series may be shown to be the distance between z0 and the nearest nonanalytic point of f(z). Example 1.7.1 Let us find the expansion of f(z)=sin(z) about the point z0=0. Because f(z) is an entire function, we can construct a Taylor expansion anywhere on the complex plane. For z0=0, (1.7.4) Because f(0)=0, f (0)=1, f (0)=0, f (0)= 1 and so forth, (1.7.5) Because sin(z) is an entire function, the radius of convergence is |z 0|< , i.e., all z. 6 A positive number h such that the series diverges for |z z0|>h but converges absolutely for |z z0|h. Complex Variables Example 1.7.2 Let us find the expansion of f(z)=1/(1 z) about the point z0=0. From the formula for a Taylor expansion, 39 (1.7.6) Because f (n) (0)=n!, we find that (1.7.7) Equation (1.7.7) is the familiar result for a geometric series. Because the only nonanalytic point is at z=1, the radius of convergence is |z 0|<1, the unit circle centered at z=0. Consider now the situation where we draw two concentric circles about some arbitrary point z0; we denote the outer circle by C while we denote the inner circle by C1. See Figure 1.7.1. Let us assume that f(z) is analytic inside the annulus between the two circles. Outside of this area, the function may or may not be analytic. Within the annulus we pick a point z and construct a small circle around it, denoting the circle by C2. As the gap or cut in the annulus becomes infinitesimally small, the line integrals that connect Figure 1.7.1: Contour used in deriving the Laurent expansion. 40 Advanced Engineering Mathematics with MATLAB the circle C2 to C1 and C sum to zero, leaving (1.7.8) Because f( ) is analytic everywhere within C2, (1.7.9) Using the relationship: (1.7.10) (1.7.8) becomes (1.7.11) Now, (1.7.12) (1.7.13) where |z z0|/| z0|<1 and (1.7.14) (1.7.15) Complex Variables where | z0|/|z z0|<1. Upon substituting these expressions into (1.7.11), 41 (1.7.16) or (1.7.17) Equation (1.7.17) is a Laurent expansion.7 If f(z) is analytic at z0, then 1 = 2=...=an=...=0 and the Laurent expansion reduces to a Taylor expansion. If z0 is a singularity of f(z), then the Laurent expansion includes both positive and negative powers. The coefficient of the (z z0) 1 term, a1, is the residue, for reasons that will appear in the next section. Unlike the Taylor series, there is no straightforward method for obtaining a Laurent series. For the remaining portions of this section we illustrate their construction. These techniques include replacing a function by its appropriate power series, the use of geometric series to expand the denominator, and the use of algebraic tricks to assist in applying the first two methods. Example 1.7.3 Laurent expansions provide a formalism for the classification of singularities of a function. Isolated singularities fall into three types; they are Laurent, M., 1843: Extension du thorme de M.Cauchy relatif la convergence du dveloppement d'une fonction suivant les puissances ascendantes de la variable x. C. R. l'Acad. Sci., 17, 938942. 7 42 Advanced Engineering Mathematics with MATLAB Essential Singularity: Consider the function f(z)=cos(1/z). Using the expansion for cosine, (1.7.18) for 0<|z|< . Note that this series never truncates in the inverse powers of z. Essential singularities have Laurent expansions which have an infinite number of inverse powers of z z0. The value of the residue for this essential singularity at z=0 is zero. Removable Singularity: Consider the function f(z)=sin(z)/z. This function has a singularity at z=0. Upon applying the expansion for sine, (1.7.19) (1.7.20) for all z, if the division is permissible. We made f(z) analytic by defining it by (1.7.20) and, in the process, removed the singularity. The residue for a removable singularity always equals zero. Pole of order n: Consider the function (1.7.21) This function has two singularities: one at z=1 and the other at z= 1. We shall only consider the case z=1. After a little algebra, (1.7.22) (1.7.23) (1.7.24) (1.7.25) Complex Variables 43 for 0<|z 1|<2. Because the largest inverse (negative) power is three, the singularity at z=1 is a third-order pole; the value of the residue is 1/8. Generally, we refer to a first-order pole as a simple pole. Example 1.7.4 Let us find the Laurent expansion for (1.7.26) about the point z=1. We begin by rewriting f(z) as (1.7.27) (1.7.28) (1.7.29) (1.7.30) provided 0<|z 1|<2. Therefore we have a simple pole at z=1 and the value of the residue is 1/2. A similar procedure would yield the Laurent expansion about z=3. Example 1.7.5 Let us find the Laurent expansion for (1.7.31) about the point z=0. We begin by rewriting f(z) as 44 Advanced Engineering Mathematics with MATLAB (1.7.32) Because (1.7.33) if |z|<e and (1.7.34) if |z|<e , (1.7.35) if |z|<e . Clearly we have a nth-order pole at z=0. The residue, the coefficient of all of the z 1 terms in (1.7.35), is found directly and equals (1.7.36) For complicated complex functions, it is very difficult to determine the nature of the singularities by finding the complete Laurent expansion and we must try another method. We shall call it "a poor man's Laurent expansion." The idea behind this method is the fact that we generally need only the first few terms of the Laurent expansion to discover its nature. Consequently, we compute these terms through the application of power series where we retain only the leading terms. Consider the following example. Example 1.7.6 Let us discover the nature of the singularity at z=0 of the function (1.7.37) Complex Variables 45 where a and t are real. We begin by replacing the exponential and hyperbolic sine by their Taylor expansion about z=0. Then (1.7.38) Factoring out az in the denominator, (1.7.39) Within the parentheses all of the terms except the leading one are small. Therefore, by long division, we formally have that (1.7.40) (1.7.41) (1.7.42) Thus, we have a second-order pole at z=0 and the residue equals t/a. Problems 1. Find the Taylor expansion of f(z)=(1 z) 2 about the point z=0. 2. Find the Taylor expansion of f(z)=(z 1)ez about the point z=1. [Hint: Don't find the expansion by taking derivatives.] By constructing a Laurent expansion, describe the type of singularity and give the residue at z0 for each of the following functions: 3. f(z)=z10e 4. f(z)=z 3 1/z ; z0=0 sin (z); z0=0 2 46 Advanced Engineering Mathematics with MATLAB 5. 6. 7. 8. 9. 10. 1.8 THEORY OF RESIDUES Having shown that around any singularity we may construct a Laurent expansion, we now use this result in the integration of closed complex integrals. Consider a closed contour in which the function f(z) has a number of isolated singularities. As we did in the case of Cauchy's integral formula, we introduce a new contour C which excludes all of the singularities because they are isolated. See Figure 1.8.1. Therefore, (1.8.1) Figure 1.8.1: Contour used in deriving the residue theorem. Consider now the mth integral, where 1 m n. Constructing a Laurent expansion for the function f(z) at the isolated singularity z=zm, this integral equals Complex Variables 47 (1.8.2) Because (z zm)k is an entire function if k 0, the integrals equal zero for each term in the second summation. We use Cauchy's integral formula to evaluate the remaining terms. The analytic function in the numerator is 1. Because dk 1(1)/dzk 1=0 if k>1, all of the terms vanish except for k=1. In that case, the integral equals 2 i 1, where a1 is the value of the residue for that particular singularity. Applying this approach to each of the singularities, we obtain Cauchy's residue theorem8: If f(z) is analytic inside and on a closed contour C (taken in the positive sense) except at points z1, z2,..., zn where f(z) has singularities, then (1.8.3) where Res[f(z); zj] denotes the residue of the jth isolated singularity of f(z) located at z=zj. Example 1.8.1 Let us compute by the residue theorem, assuming that we take the contour in the positive sense. Because the contour is a circle of radius 2, centered on the origin, the singularity at z= 1 lies within the contour. If the singularity were not inside the contour, then the integrand would have been analytic inside and on the contour C. In this case, the answer would then be zero by the Cauchy-Goursat theorem. Returning to the original problem, we construct the Laurent expansion for the integrand around the point z=1 by noting that (1.8.4) 8 See Mitrinovi , D.S., and J.D.Kef ki , 1984: The Cauchy Method of Residues: Theory and Applications. D.Reidel Publishing, 361 pp. Section 10.3 gives the historical development of the residue theorem. 48 Advanced Engineering Mathematics with MATLAB The singularity at z= 1 is a simple pole and by inspection the value of the residue equals 1. Therefore, (1.8.5) As it presently stands, it would appear that we must always construct a Laurent expansion for each singularity if we wish to use the residue theorem. This becomes increasingly difficult as the structure of the integrand becomes more complicated. In the following paragraphs we show several techniques that avoid this problem in practice. We begin by noting that many functions that we will encounter consist of the ratio of two polynomials, i.e., rational functions: f(z)=g(z)/h(z). Generally, we can write h(z) as (z z1)m1(z z2)m2.... Here we assumed that we divided out any common factors between g(z) and h(z) so that g(z) does not vanish at z1, z2,.... Clearly z1, z2,..., are singularities of f(z). Further analysis shows that the nature of the singularities are a pole of order m1 at z=z1, a pole of order m2 at z=z2, and so forth. Having found the nature and location of the singularity, we compute the residue as follows. Suppose that we have a pole of order n. Then we know that its Laurent expansion is (1.8.6) Multiplying both sides of (1.8.6) by (z z0)n, F(z)=(z z0)nf(z) = n+an 1(z z0)+...+b0(z z0)n+b1(z z0)n+1+.... Because F(z) is analytic at z=z0, it has the Taylor expansion (1.8.7) (1.8.8) Matching powers of z z0 in (1.8.7) and (1.8.8), the residue equals (1.8.9) Complex Variables Substituting in F(z)=(z z0)nf(z), we can compute the residue of a pole of order n by 49 (1.8.10) For a simple pole (1.8.10) simplifies to (1.8.11) Quite often, f(z)=p(z)/q(z). From l'Hspital's rule, it follows that (1.8.11) becomes (1.8.12) Remember that these formulas work only for finite-order poles. For an essential singularity we must compute the residue from its Laurent expansion; however, essential singularities are very rare in applications. Example 1.8.2 Let us evaluate (1.8.13) where C is any contour that includes both z= i and is in the positive sense. From Cauchy's residue theorem, (1.8.14) The singularities at z= i are simple poles. The corresponding residues are and (1.8.15) 50 Advanced Engineering Mathematics with MATLAB (1.8.16) Consequently, (1.8.17) Example 1.8.3 Let us evaluate (1.8.18) where C includes all of the singularities and is in the positive sense. The integrand has a second-order pole at z=0 and two simple poles at z= 1i which are the roots of z2+2z+2=0. Therefore, the residue at z=0 is (1.8.19) (1.8.20) The residue at z= 1+i is (1.8.21) (1.8.22) (1.8.23) Complex Variables Similarly, the residue at z= 1 i is 51 (1.8.24) (1.8.25) (1.8.26) Then by the residue theorem, (1.8.27) (1.8.28) (1.8.29) Problems Assuming that all of the following closed contours are in the positive sense, use the residue theorem to evaluate the following integrals: 1. 2. 3. 4. 5. 52 Advanced Engineering Mathematics with MATLAB 6. 7. 8. 1.9 EVALUATION OF REAL DEFINITE INTEGRALS One of the important applications of the theory of residues consists in the evaluation of certain types of real definite integrals. Similar techniques apply when the integrand contains a sine or cosine. See 3.4. Example 1.9.1 Let us evaluate the integral (1.9.1) This integration occurs along the real axis. In terms of complex variables we can rewrite (1.9.1) as (1.9.2) where the contour C1 is the line Im(z)=0. However, the use of the residue theorem requires an integration along a closed contour. Let us choose the one pictured in Figure 1.9.1. Then (1.9.3) where C denotes the complete closed contour and C2 denotes the integration path along a semicircle at infinity. Clearly we want the second integral on the right side of (1.9.3) to vanish; otherwise, our choice of the contour C2 is poor. Because z=Re i and dz=iRe i d , (1.9.4) Complex Variables which tends to zero as R . On the other hand, the residue theorem gives 53 (1.9.5) Therefore, (1.9.6) Figure 1.9.1: Contour used in evaluating the integral (1.9.1). Note that we only evaluated the residue in the upper half-plane because it is the only one inside the contour. This example illustrates the basic concepts of evaluating definite integrals by the residue theorem. We introduce a closed contour that includes the real axis and an additional contour. We must then evaluate the integral along this additional contour as well as the closed contour integral. If we properly choose our closed contour, this additional integral vanishes. For certain classes of general integrals, we shall now show that this additional contour is a circular arc at infinity. Theorem: If, on a circular arc CR with a radius R and center at the origin, zf(z)0 uniformly with and as R , then (1.9.7) The proof is as follows: If |zf(z)| MR, then |f(z)| MR/R. Because the length of CR is R, where is the subtended angle, (1.9.8) because MR0 as R . 54 Advanced Engineering Mathematics with MATLAB Example 1.9.2 A simple illustration of this theorem is the integral (1.9.9) A quick check shows that z/(z2+z+1) tends to zero uniformly as R . Therefore, if we use the contour pictured in Figure 1.9.1, (1.9.10) (1.9.11) Figure 1.9.2: Contour used in evaluating the integral (1.9.13). Example 1.9.3 Let us evaluate (1.9.12) In place of an infinite semicircle in the upper half-plane, consider the icir following integral Complex Variables 55 (1.9.13) where we show the closed contour in Figure 1.9.2. We chose this contour for two reasons. First, we only have to evaluate one residue rather than the three enclosed in a traditional upper half-plane contour. Second, the contour integral along C3 simplifies to a particularly simple and useful form. Because the only enclosed singularity lies at z=e i/6 , (1.9.14) (1.9.15) Let us now evaluate (1.9.12) along each of the legs of the contour: (1.9.16) (1.9.17) because of (1.9.7) and (1.9.18) since z=re i/3. Substituting into (1.9.15), (1.9.19) 56 Advanced Engineering Mathematics with MATLAB or (1.9.20) Example 1.9.4 Rectangular closed contours are best for the evaluation of integrals that involve hyperbolic sines and cosines. To illustrate9 this, let us evaluate the integral (1.9.21) (1.9.22) where a>0 and b>1. We begin by determining the value of about the closed contour shown in Figure 1.9.3. Writing this contour integral in terms of the four line segments that constitute the closed contour, we have (1.9.23) Because the integrand behaves as e the other hand, R as R , the integrals along C2 and C4 vanish. On (1.9.24) This is a slight variation on a problem solved by Spyrou, K.J., B.Cotton, and B.Gurd, 2002: Analytical expressions of capsize boundary for a ship with roll bias in beam waves. J.Ship Res., 46, 167174. Reprinted with the permission of the Society of Naval Architects and Marine Engineers (SNAME). 9 Complex Variables 57 Figure 1.9.3: Rectangular closed contour used to obtain (1.9.32). and (1.9.25) because cosh(x+2 i)=cosh(x) and sinh(x+2 i)=sinh(x). Within the closed contour C, we have a single singularity where b+ cosh(zs)=0 or or To discover the nature of this singularity, we expand b+cosh(z) in a Taylor expansion and find that (1.9.26) Therefore, we have a second-order pole at z=zs. Therefore, the value of the residue there is (1.9.27) (1.9.28) 58 Advanced Engineering Mathematics with MATLAB Therefore, (1.9.29) (1.9.30) because (1.9.31) Substituting (1.9.30) into (1.9.22) yields (1.9.32) Example 1.9.5 The method of residues is also useful in the evaluation of definite integrals of the form F[sin( ),cos( )]d , where F is a quotient of polynomials in sin( ) and cos( ). For example, let us evaluate the integral10 (1.9.33) We begin by introducing the complex variable z=ei . This substitution yields the closed contour integral (1.9.34) where C is a circle of radius 1 taken in the positive sense. The integrand of (1.9.34) has five singularities: a second-order pole at z5=0 and simple poles located at (1.9.35) Complex Variables 59 (1.9.36) Only the singularities z2, z3, and z5 lie within C. Consequently, the value of I equals 2 i times the sum of the residues at these three singularities. The residues equal (1.9.37) (1.9.38) (1.9.39) (1.9.40) (1.9.41) (1.9.42) Simplified version of an integral presented by Jiang, Q.F., and R.B.Smith, 2000: V-waves, bow shocks, and wakes in supercritical hydrostatic flow. J.Fluid Mech., 406, 2753. Reprinted with the permission of Cambridge University Press. 10 60 Advanced Engineering Mathematics with MATLAB and (1.9.43) (1.9.44) = 0. Summing the residues, we obtain 0. Therefore, (1.9.45) (1.9.46) Problems Use the residue theorem to verify the following integrals: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. a, b>0 Complex Variables 11. 12. 13. 14. Hint: 61 15. Hint: See Example 1.7.5. 16. Show that where a is real and not equal to zero. Hint: Show that the poles of are simple and equal If |a|=2, we have second-order poles at zn=i. 17. Show that 62 Advanced Engineering Mathematics with MATLAB Hint: Evaluate the closed contour integral where C is a rectangular contour with vertices at ( , 0), ( 18. Show11 that , 0), ( , /b), and ( , /b). Hint: Evaluate the closed contour integral where C is a rectangular contour with vertices at ( , 0), ( , 0), ( , ), and ( 19. During an electromagnetic calculation, Strutt12 needed to prove that , ). Verify his proof by doing the following: Step 1: Using the residue theorem, show that where CN is a circular contour that includes the poles z= and zn= i(n+ ), n=0, 1, 2,..., N. Step 2: Show that in the limit of N , the contour integral vanishes. [Hint: Examine the behavior of z sinh(xz)/[(z ) cosh( z)] as |z| . Use (1.9.7) where CR is the circular contour.] 11 Reprinted with permission from Yan, J.R., X.H.Yan, J.Q.You, and J.X.Zhong, 1993: On the interaction between two nonpropagating hydrodynamic solitons. Phys. Fluids A, 5, 16511656. 1993, American Institute of Physics. Strutt, M.J.O., 1934: Berechmmg des hochfrequenten Feldes einer Kreiszylinderspule in einer konzentrischen leitenden Schirmhlle mit ebenen Deckeln. Hochfrequenztechn. Elecktroak., 43, 121123. 12 Complex Variables 63 Step 3: Break the infinite series in Step 1 into two parts and simplify. In the chapter on Fourier series, we shall show how we can obtain the same series by direct integration. 1.10 CAUCHY'S PRINCIPAL VALUE INTEGRAL The conventional definition of the integral of a function f(x) of the real variable x over a finite interval a x b assumes that f(x) has a definite finite value at each point within the interval. We shall now extend this definition to cover cases when f(x) is infinite at a finite number of points within the interval. Consider the case when there is only one point c at which f(x) becomes infinite. If c is not an endpoint of the interval, we take two small positive numbers and and examine the expression (1.10.1) If (1.10.1) exists and tends to a unique limit as and tend to zero independently, we say that the improper integral of f(x) over the interval exists, its value being defined by (1.10.2) If, however, the expression does not tend to a limit as it may still happen that and tend to zero independently, (1.10.3) exists. When this is the case, we call this limit the Cauchy principal value of the improper integral and denote it by (1.10.4) Finally, if f(x) becomes infinite at an endpoint, say a, of the range of integration, we say that f(x) is integrable over a x b if exists. (1.10.5) 64 Advanced Engineering Mathematics with MATLAB Example 1.10.1 Consider the integral dx/x. This integral does not exist in the ordinary sense because of the strong singularity at the origin. However, the integral would exist if (1.10.6) existed and had a unique value as limit equals and independently approach zero. Because this (1.10.7) our integral would have the value of ln(2) if This particular limit is the Cauchy principal value of the improper integral which we express as (1.10.8) We can extend these ideas to complex integrals used to determine the value or principal value of an improper integral by Cauchy's residue theorem when the integrand has a singularity on the contour of integration. We avoid this difficulty by deleting from the area within the contour that portion which also lies within a small circle and then integrate around the boundary of the remaining region. This process is called indenting the contour. The integral around the indented contour is calculated by the theorem of residues and then the radius of each indentation is made to tend to zero. Figure 1.10.1: Contour C used in Example 1.10.2. Complex Variables 65 This process give the Cauchy principal value of the improper integral. The details of this method are shown in the following examples. Example 1.10.2 Let us show that (1.10.9) Consider the integral (1.10.10) where the closed contour C consists of the real axis from R to R and a semicircle in the upper half of the z-plane where this segment is its diameter. See Figure 1.10.1. Because the integrand has poles at z= , which lie on this contour, we modify C by making an indentation of radius at a and another of radius at a. The integrand is now analytic within and on C and (1.10.10) equals zero by the Cauchy-Goursat theorem. Evaluating each part of the integral (1.10.10), we have that (1.10.11) where C1 and C2 denote the integrals around the indentations at a and a, respectively. The modulus of the first term on the left side of (1.10.11) is less than R/(R2 a2) so that along C1, this term tends to zero as R . To evaluate C1, we observe that where decreases from Hence, to 0. (1.10.12) (1.10.13) 66 Advanced Engineering Mathematics with MATLAB (1.10.14) Similarly, (1.10.15) as tends to zero. Upon letting R , and 0, we find that (1.10.16) Finally, equating the real and imaginary parts, we obtain (1.10.17) Example 1.10.3 Let us show that (1.10.18) Consider the integral (1.10.19) where the closed contour C consists of the real axis from R to R and a semicircle in the upper half of the z-plane where this segment is its diameter. Because the integrand has a pole at z=0, which lies on the contour, we modify C by making an indentation of radius at z=0. See Figure 1.10.2. Because eiz/z is analytic along C, (1.10.20) Complex Variables 67 Figure 1.10.2: Contour C used in Example 1.10.3. Since e R sin( ) <e R for 0< < , (1.10.21) which tends to zero as R . Therefore, (1.10.22) Now, (1.10.23) in the limit because Consequently, in the limit of (1.10.24) Upon separating the real and imaginary parts, we obtain (1.10.25) 68 Advanced Engineering Mathematics with MATLAB Problems 1. Noting that and show that 2. Using f(z)=ei z/2 /(z21), show that 3. Show that Use a rectangular contour with vertices at ( R, 0), (R, 0), ( R, ), and (R, ) with a semicircle indentation at the origin. 4. Show13 that 13 Reprinted with permission from Ko, S.H., and A.H.Nuttall, 1991: Analytical evaluation of flush-mounted hydrophone array response to the Corcos turbulent wall pressure spectrum. J. Acoust. Soc. Am., 90, 579588. 1991, Acoustical Society of America. Complex Variables 69 where a, , and are real. Use a semicircular contour of infinite radius with the real axis as its diameter. 5. Using the complex function eimz/(z a) and a closed contour similar to that shown in Figure 1.10.2, show that where m>0 and a is real. 6. Using a closed contour similar to that shown in Figure 1.10.2 except that we now have two small semicircles around the singularities on the real axis, show that and 7. Redo Example 1.10.3 except the contour is now a rectangle with vertices at R and R+Ri indented at the origin. 8. Let the function f(z) possess a simple pole with a residue Res[f(z);c] on a simply closed contour C. If C is indented at c, show that the integral of f(z) around the indentation tends to Res[f(z);c] i as the radius of the indentation tends to zero, being the internal angle between the two parts of C meeting at c. Chapter 2 First-Order Ordinary Differential Equations A differential equation is any equation that contains the derivatives or differentials of one or more dependent variables with respect to one or more independent variables. Because many of the known physical laws are expressed as differential equations, a sound knowledge of how to solve them is essential. In the next two chapters we present the fundamental methods for solving ordinary differential equations--a differential equation which contains only ordinary derivatives of one or more dependent variables. Later, in 5.6 and 6.8 we show how transform methods can be used to solve ordinary differential equations while systems of linear ordinary differential equations are treated in 14.6. Solutions for partial differential equations--a differential equation involving partial derivatives of one or more dependent variables of two or more independent variables--are given in Chapters 10, 11 and 12. 2.1 CLASSIFICATION OF DIFFERENTIAL EQUATIONS Differential equations are classified three ways: by type, order, and linearity. There are two types: ordinary and partial differential equations which have already been defined. Examples of ordinary differential equations include (2.1.1) (x y)dx+4y dy=0, (2.1.2) (2.1.3) and (2.1.4) First-Order Ordinary Differential Equations 71 On the other hand, examples of partial differential equations include (2.1.5) (2.1.6) and (2.1.7) In the examples that we have just given, we have explicitly written out the differentiation operation. However, from calculus we know that dy/dx can also be written y . Similarly the partial differentiation operator 4u/ x2 y2 is sometimes written uxxyy. We will also use this notation from time to time. The order of a differential equation is given by the highest-order derivative. For example, (2.1.8) is a third-order ordinary differential equation. Because we can rewrite (x+y)dy x dx=0 (2.1.9) as (2.1.10) by dividing (2.1.9) by dx, we have a first-order ordinary differential equation here. Finally (2.1.11) 72 Advanced Engineering Mathematics with MATLAB is an example of a fourth-order partial differential equation. In general, we can write a nth-order, ordinary differential equation as (2.1.12) The final classification is according to whether the differential equation is linear or nonlinear. A differential equation is linear if it can be written in the form: (2.1.13) Note that the linear differential equation (2.1.13) has two properties: (1) The dependent variable y and all of its derivatives are of first degree (the power of each term involving y is 1). (2) Each coefficient depends only on the independent variable x. Examples of linear first-, second-, and third-order ordinary differential equations are (x+1) dy ydx=0, (2.1.14) y +3y +2y=ex, (2.1.15) and (2.1.16) respectively. If the differential equation is not linear, then it is nonlinear. Examples of nonlinear first-, second-, and third-order, ordinary differential equations are (2.1.17) (2.1.18) First-Order Ordinary Differential Equations 73 and yy +2y=ex, (2.1.19) respectively.. At this point it is useful to highlight certain properties that all differential equations have in common regardless of their type, order and whether they are linear or not. First, it is not obvious that just because we can write down a differential equation that a solution exists. The existence of a solution to a class of differential equations constitutes an important aspect of the theory of differential equations. Because we are interested in differential equations that arise from applications, their solution should exist. In 2.2 we address this question further. Quite often a differential equation has the solution y=0, a trivial solution. For example, if f(x)=0 in (2.1.13), a quick check shows that y=0 is a solution. Trivial solutions are generally of little value. Another important question is how many solutions does a differential equation have? In physical applications uniqueness is not important because, if we are lucky enough to actually find a solution, then its ties to a physical problem usually suggest uniqueness. Nevertheless, the question of uniqueness is of considerable importance in the theory of differential equations. Uniqueness should not be confused with the fact that many solutions to ordinary differential equations contain arbitrary constants much as indefinite integrals in integral calculus. A solution to a differential equation that has no arbitrary constants is called a particular solution. Example 2.1.1 Consider the differential equation (2.1.20) This condition y(1)=2 is called an initial condition and the differential equation plus the initial condition constitute an initial-value problem. Straightforward integration yields (2.1.21) Equation (2.1.21) is the general solution to the differential equation (2.1.20) because (2.1.21) is a solution to the differential equation for every choice of C. However, if we now satisfy the initial condition y(1)=2, we obtain a particular solution. This is done by substituting the corresponding values of x and y into (2.1.21) or (2.1.22) Therefore, the solution to the initial-value problem (2.1.20) is the particular solution 74 Advanced Engineering Mathematics with MATLAB y(x)=(x+1)2/2. (2.1.23) Finally, it must be admitted that most differential equations encountered in the "real" world cannot be written down either explicitly or implicitly. For example, the simple differential equation y =f(x) does not have an analytic solution unless you can integrate f(x). This begs the question of why it is useful to learn analytic techniques for solving differential equations that often fail us. The answer lies in the fact that differential equations that we can solve share many of the same properties and characteristics of differential equations which we can only solve numerically. Therefore, by working with and examining the differential equations that we can solve exactly, we develop our intuition and understanding about those that we can only solve numerically. Problems Find the order and state whether the following ordinary differential equations are linear or nonlinear: 1. y /y=x2+x 2. y2y =x+3 3. sin(y )=5y 4. y =y 5. y =3x2 6. (y3) =1 3y 7. y =y3 8. y 4y +5y=sin(x) 9. y +xy=cos(y ) 10. (2x+y)dx+(x 3y) dy=0 11. (1+x2)y =(1+y)2 12. yy =x(y2+1) 13. y +y+y2=x+ex 14. y +cos(x)y +y=0 15. x2y +x1/2(y )3+y=ex 16. y +xy +ey=x2 2.2 SEPARATION OF VARIABLES The simplest method of solving a first-order ordinary differential equation, if it works, is separation of variables. It has the advantage of handling both linear and nonlinear problems, especially autonomous equations.1 From integral calculus, we already met this technique when we solved the first-order differential equation First-Order Ordinary Differential Equations 75 (2.2.1) By multiplying both sides of (2.2.1) by dx, we obtain dy=f(x) dx. (2.2.2) At this point we note that the left side of (2.2.2) contains only y while the right side is purely a function of x. Hence, we can integrate directly and find that (2.2.3) For this technique to work, we must be able to rewrite the differential equation so that all of the y dependence appears on one side of the equation while the x dependence is on the other. Finally we must be able to carry out the integration on both sides of the equation. One of the interesting aspects of our analysis is the appearance of the arbitrary constant C in (2.2.3). To evaluate this constant we need more information. The most common method is to require that the dependent variable give a particular value for a particular value of x. Because the independent variable x often denotes time, this condition is usually called an initial condition, even in cases when the independent variable is not time. Example 2.2.1 Let us solve the ordinary differential equation (2.2.4) Because we can separate variables by rewriting (2.2.4) as (2.2.5) its solution is simply 1 An autonomous equation is a differential equation where the independent variable does not explicitly appear in the equation, such as y =f(y). 76 Advanced Engineering Mathematics with MATLAB ye y e y=ln |x|+C (2.2.6) by direct integration. Example 2.2.2 Let us solve (2.2.7) subject to the initial condition y(0)=1. Multiplying (2.2.7) by dx, we find that dy+y dx=xexy dx, (2.2.8) or (2.2.9) A quick check shows that the left side of (2.2.9) contains only the dependent variable y while the right side depends solely on x and we have separated the variables onto one side or the other. Finally, integrating both sides of (2.2.9), we have ln(y)=xex ex x+C. (2.2.10) Since y(0)=1, C=1 and y(x)=exp[(x 1)ex+1 x]. (2.2.11) In addition to the tried-and-true method of solving ordinary differential equation by hand, scientific computational packages such as MATLAB provide symbolic toolboxes that are First-Order Ordinary Differential Equations 77 designed to do the work for you. In the present case, typing dsolve('Dy+y=x*exp(x)*y','y(0)=1','x') yields ans = 1/exp( 1)*exp( x+x*exp(x) exp(x)) which is equivalent to (2.2.11). Our success here should not be overly generalized. Sometimes these toolboxes give the answer in a rather obscure form or they fail completely. For example, in the previous example, MATLAB gives the answer ans = lambertw((1og (x) +C1)*exp( 1)) 1 The MATLAB function lambertw is Lambert's W function, where w=lambertw(x) is the solution to wew=x. Using this definition, we can construct the solution as expressed in (2.2.6). Example 2.2.3 Consider the nonlinear differential equation x2y +y2=0. (2.2.12) Separating variables, we find that (2.2.13) Equation (2.2.13) shows the wide variety of solutions possible for an ordinary differential equation. For example, if we require that y(0)=0, then there are infinitely many different solutions satisfying this initial condition because C can take on any value. On the other hand, if we require that y(0)=1, there is no solution because we cannot choose any constant C such that y(0)=1. Finally, if we have the initial condition that y(1)=2, then there is only one possible solution corresponding to Consider now the trial solution y=0. Does it satisfy (2.2.12)? Yes, it does. On the other hand, there is no choice of C which yields this solution. The solution y=0 is called a singular solution to (2.2.12). Singular solutions are solutions to a differential equation which cannot be obtained from a solution with arbitrary constants. 78 Advanced Engineering Mathematics with MATLAB Figure 2.2.1: The solution to (2.2.13) when C= 2, 0, 2, 4. Finally, we illustrate (2.2.13) using MATLAB. This is one of MATLAB's strengths--the ability to convert an abstract equation into a concrete picture. Here the MATLAB script clear hold on x = 5:0.5:5; for c = 2:2:4 y = x ./ (c*x 1); if (c== 2) subplot(2,2,1), plot(x,y,'*') axis tight; title('c = 2'); ylabel ('y','Fontsize',20); end if (c== 0) subplot(2,2,2), plot(x,y,'^') axis tight; title('c = 0'); end if (c== 2) subplot(2,2,3), plot(x,y,'s') axis tight; title ('c = 2'); xlabel('x' ,'Fontsize',20); ylabel ('y','Fontsize',20); end if (c== 4) subplot(2,2,4), plot(x,y,'h') axis tight; title ('c = 4'); xlabel ('x','Fontsize',20); end end yields Figure 2.2.1 which illustrates (2.2.13) when C= 2, 0, 2, and 4. The previous example showed that first-order ordinary differential equations may have a unique solution, no solution, or many solutions. From a complete study2 of these equations, we have the following theorem: 2 The proof of the existence and uniqueness of first-order ordinary differential equations is beyond the scop of this book. See Ince, E.L., 1956: Ordinary Differential Equations. Dover Publications, Inc., Chapter 3. First-Order Ordinary Differential Equations 79 Theorem: Existence and Uniqueness Suppose some real-valued function f(x, y) is continuous on some rectangle in the xy-plane containing the point (a, b) in its interior. Then the initial alue problem (2.2.14) has at least one solution on the same open interval I containing the point x=a. Furthermore, if the partial derivati e f/ y is continuous on that rectangle, then the solution is unique on some (perhaps smaller) open inter al I0 containing the point x=a. Example 2.2.4 Consider the initial-value problem y =3y1/3/2 with y(0)=1. Here f(x, y)=3y1/3/2 and fy=y 2/3/2. Because fy is continuous over a small rectangle containing the point (0, 1), there is a unique solution around x=0, namely y=(x+1)3/2, which satisfies the differential equation and the initial condition. On the other hand, if the initial condition reads y(0)=0, then fy is not continuous on any rectangle containing the point (0, 0) and there is no unique solution. For example, two solutions to this initial-value problem, valid on any open interval that includes x=0, are y1(x)=x3/2 and (2.2.15) Example 2.2.5: Hydrostatic equation Consider an atmosphere where its density varies only in the vertical direction. The pressure at the surface equals the weight per unit horizontal area of all of the air from sea level to outer space. As you move upward, the amount of air remaining above decreases and so does the pressure. This is why we experience pressure sensations in our ears when ascending or descending in an elevator or airplane. If we rise the small distance dz, there must be a corresponding small decrease in the pressure, dp. This pressure drop must equal the loss of weight in the column per unit area, g dz. Therefore, the pressure is governed by the differential equation dp= g dz, commonly called the hydrostatic equation. (2.2.16) 80 Advanced Engineering Mathematics with MATLAB To solve (2.2.16), we must express in terms of pressure. For example, in an isothermal atmosphere at constant temperature Ts, the ideal gas law gives p= RTs, where R is the gas constant. Substituting this into (2.2.16) and separating variables yields (2.2.17) Integrating (2.2.17) gives (2.2.18) Thus, the pressure (and density) of an isothermal atmosphere decreases exponentially with height. In particular, it decreases by e 1 over the distance RTs/g, the so-called "scale height." Example 2.2.6: Terminal velocity As an object moves through a fluid, its viscosity resists the motion. Let us find the motion of a mass m as it falls toward the earth under the force of gravity when the drag varies as the square of the velocity. From Newton's second law, the equation of motion is (2.2.19) where denotes the velocity, g is the gravitational acceleration, and CD is the drag coefficient. We choose the coordinate system so that a downward velocity is positive. Equation (2.2.19) can be solved using the technique of separation of variables if we change from time t as the independent variable to the distance traveled x from the point of release. This modification yields the differential equation (2.2.20) First-Order Ordinary Differential Equations 81 since =dx/dt. Separating the variables leads to (2.2.21) or (2.2.22) where k=CD/m and =0 for x=0. Taking the inverse of the natural logarithm, we finally obtain (2.2.23) Thus, as the distance that the object falls increases, so does the velocity and it eventually approaches a constant value commonly known as the terminal velocity. Because the drag coefficient CD varies with the superficial area of the object while the mass depends on the volume, k increases as an object becomes smaller, resulting in a smaller terminal velocity. Consequently, although a human being of normal size will acquire a terminal velocity of approximately 120 mph, a mouse, on the other hand, can fall any distance without injury. Example 2.2.7: Interest rate Consider a bank account that has been set up to pay out a constant rate of P dollars per year for the purchase of a car. This account has the special feature that it pays an annual interest rate of r on the current balance. We would like to know the balance in the account at any time t. Although financial transactions occur at regularly spaced intervals, an excellent approximation can be obtained by treating the amount in the account x(t) as a continuous function of time governed by the equation x(t+ t) x(t)+rx(t) t P t, (2.2.24) where we have assumed that both the payment and interest are paid in time increments of t. As the time between payments tends to zero, we obtain the first-order ordinary differential equation 82 Advanced Engineering Mathematics with MATLAB (2.2.25) If we denote the initial deposit into this account by x(0), then at any subsequent time x(t)=x(0)ert P (ert 1)/r. (2.2.26) Although we could compute x(t) as a function of P, r, and x(0), there are only three separate cases that merit our close attention. If P/r>x(0), then the account will eventually equal zero at rt=ln{P/[P rx(0)]}. On the other hand, if P/r<x(0), the amount of money in the account will grow without bound. Finally, the case x(0)=P/r is the equilibrium case where the amount of money paid out balances the growth of money due to interest so that the account always has the balance of P/r. Example 2.2.8: Steady-state flow of heat When the inner and outer walls of a body, for example the inner and outer walls of a house, are maintained at different constant temperatures, heat will flow from the warmer wall to the colder one. When each surface parallel to a wall has attained a constant temperature, the flow of heat has reached a steady state. In a steady state flow of heat, each surface parallel to a wall, because its temperature is now constant, is referred to as an isothermal surface. Isothermal surfaces at different distances from an interior wall will have different temperatures. In many cases the temperature of an isothermal surface is only a function of its distance x from the interior wall, and the rate of flow of heat Q in a unit time across such a surface is proportional both to the area A of the surface and to dT/dx, where T is the temperature of the isothermal surface. Hence, (2.2.27) where is called the thermal conductivity of the material between the walls. In place of a flat wall, let us consider a hollow cylinder whose inner and outer surfaces are located at r=r1 and r=r2, respectively. At steady state, (2.2.27) becomes (2.2.28) assuming no heat generation within the cylindrical wall. We can find the temperature distribution inside the cylinder by solving (2.2.28) along with the appropriate conditions on T(r) at r=r1 and r=r2 (the boundary conditions). To First-Order Ordinary Differential Equations 83 illustrate the wide choice of possible boundary conditions, let us require that inner surface is maintained at the temperature T1. Along the outer surface we assume that heat is lost by convection to the environment which has the temperature T . This heat loss is usually modeled by the equation (2.2.29) where h>0 is the convective heat transfer coefficient. Upon integrating (2.2.28), (2.2.30) where Qr is also an unknown. Substituting (2.2.30) into the boundary conditions, we obtain (2.2.31) with (2.2.32) As r2 increases, the first term in the denominator of (2.2.32) decreases while the second term increases. Therefore, Qr has its largest magnitude when the denominator is smallest, assuming a fixed numerator. This occurs at the critical radius rcr=k/h, where (2.2.33) Example 2.2.9: Logistic equation The study of population dynamics yields an important class of first-order, nonlinear, ordinary differential equations: the logistic equation. This equation arose in Pierre Franois Verhulst's (18041849) study of animal populations.3 If x(t) denotes the number of species in the population and k is the (constant) environment capacity (the number of species that can simultaneously live in the geographical region), then the logistic or Verhulst's equation is Verhulst, P.F., 1838: Notice sur la loi que la population suit dans son accroissement. Correspond. Math. Phys., 10, 113121. 3 84 Advanced Engineering Mathematics with MATLAB x =ax(k x)/k, (2.2.34) where a is the population growth rate for a small number of species. To solve (2.2.34), we rewrite it as (2.2.35) Integration yields ln |x| ln|1 x/k|=rt+ln(C), (2.2.36) or (2.2.37) If x(0)=x0, (2.2.38) As t , x(t)k, the asymptotically stable solution. Example 2.2.10: Chemical reactions Chemical reactions are often governed by first-order ordinary differential equations. For example, first-order reactions, which describe reactions of the form yield the differential equation (2.2.39) First-Order Ordinary Differential Equations 85 where k is the rate at which the reaction is taking place. Because for every molecule of A that disappears one molecule of B is produced, a=1 and (2.2.39) becomes (2.2.40) Integration of (2.2.40) leads to (2.2.41) If we denote the initial value of [A] by [A]0, then integration yields ln[A]=kt ln[A]0, or [A]=[A]0e kt. (2.2.43) (2.2.42) The exponential form of the solution suggests that there is a time constant which is called the decay time of the reaction. This quantity gives the time required for the concentration of decrease by 1/e of its initial value [A]0. It is given by =1/k. Turning to second-order reactions, there are two cases. The first is a reaction between two identical species: A+A products. The rate expression here is (2.2.44) The second case is an overall second-order reaction between two unlike species, given by A+B X. In this case, the reaction is first order in each of the reactants A and B and the rate expression is (2.2.45) 86 Advanced Engineering Mathematics with MATLAB Turning to (2.2.44) first, we have by separation of variables (2.2.46) or (2.2.47) Therefore, a plot of the inverse of A versus time will yield a straight line with slope equal to 2k and intercept 1/[A]0. With regard to (2.2.45), because an increase in X must be at the expense of A and B, it is useful to express the rate equation in terms of the concentration of X, [X]=[A]0 [A]= [B]0 [B], where [A]0 and [B]0 are the initial concentrations. Then, (2.2.45) becomes (2.2.48) Separation of variables leads to (2.2.49) To integrate the left side, we rewrite the integral (2.2.50) Carrying out the integration, (2.2.51) Again the reaction rate constant k can be found by plotting the data in the form of the left side of (2.2.51) against t. First-Order Ordinary Differential Equations 87 Problems For Problems 110, solve the following ordinary differential equations by separation of variables. Then use MATLAB to plot your solution. Try and find the symbolic solution using MATLAB's dsolve. 1. 2. (1+y2)dx (1+x2)dy=0 3. 4. 5. 6. 7. 8. 9. Solve the initial-value problem where a and b are constants. 10. Setting u=y x, solve the first-order ordinary differential equation 11. Using the hydrostatic equation, show that the pressure within an atmosphere where the temperature decreases uniformly with height, T(z)= T0 z, varies as where p0 is the pressure at z=0. 12. Using the hydrostatic equation, show that the pressure within an atmosphere with the temperature distribution is 88 Advanced Engineering Mathematics with MATLAB where p0 is the pressure at z=0. 13. The voltage V as a function of time t within an electrical circuit4 consisting of a capacitor with capacitance C and a diode in series is governed by the firstorder ordinary differential equation where R and S are positive constants. If the circuit initially has a voltage V0 at t=0, find the voltage at subsequent times. 14. A glow plug is an electrical element inside a reaction chamber which either ignites the nearby fuel or warms the air in the chamber so that the ignition will occur more quickly. An accurate prediction of the wire's temperature is important in the design of the chamber. Assuming that heat convection and conduction are not important,5 the temperature T of the wire is governed by where A equals the specific heat of the wire times its mass, B equals the product of the emissivity of the surrounding fluid times the wire's surface area times the StefanBoltzmann constant, Ta is the temperature of the surrounding fluid, and P is the power input. The temperature increases due to electrical resistance and is reduced by radiation to the surrounding fluid. Show that the temperature is given by 4 5 See Aiken, C.B., 1938: Theory of the diode voltmeter. Proc. IRE, 26, 859876. Taken from Clark, S.K., 1956: Heat-up time of wire glow plugs. Jet Propulsion, 26, 278279. First-Order Ordinary Differential Equations 89 and T0 is the initial temperature of the wire. where 4=P/B+ 15. Let us denote the number of tumor cells by N(t). Then a widely used deterministic umor growth law6 is where K is the largest tumor size and 1/b is the length of time required for the specific growth to decrease by 1/e. If the initial value of N(t) is N(0), find N(t) at any subsequent time t. 16. The drop in laser intensity in the direction of propagation x due to one and two-photon absorption in photosensitive glass is governed7 by where I is the laser intensity, and are the single-photon and two-photon coefficients, respectively. Show that the laser intensity distribution is where I(0) is the laser intensity at the entry point of the media, x=0. 17. The third-order reaction is governed by the kinetics equation where [A]0, [B]0, and [C]0 denote the initial concentration of A, B, and C, respectively. Find how [X] varies with time t. 18. The reversible reaction 6 is described by the kinetics equation8 Reprinted from Math. Biosci., 61, F.B.Hanson and C.Tier, A stochastic model of tumor growth, 73100, 1982, with permission from Elsevier Science. 7 Reprinted with permission from Weitzman, P.S., and U.sterberg, 1996: Two-photon absorption and photoconductivity in photosensitive glasses. J. Appl Phys., 79, 86488655. 1996, American Institute of Physics. 8 See Kster, F.W., 1895: Ueber den Verlauf einer umkehrbaren Reaktion erster Ordnung in homogenem System. Zeit. Physik. Chem., 18, 171179. 90 Advanced Engineering Mathematics with MATLAB where [X] denotes the increase in the concentration of B while [A]0 and [B]0 are the initial concentrations of A and B, respectively. Find [X] as a function of time t. Hint: Show that this differential equation can be written 2.3 HOMOGENEOUS EQUATIONS A homogeneous ordinary differential equation is a differential equation of the form M(x, y) dx+N(x, y) dy=0, (2.3.1) where both M(x, y) and N(x, y) are homogeneous functions of the same degree n. That means: M(tx, ty)=tnM(x, y) and N(tx, ty)=tnN(x, y). For example, the ordinary differential equation (x2+y2) dx+(x2 xy) dy=0 (2.3.2) is a homogeneous equation because both coefficients are homogeneous functions of degree 2: M(tx, ty)=t2x2+t2y2=t2(x2+y2)=t2M(x, y), and N(tx, ty)=t2x2 t2xy=t2(x2 xy)=t2N(x, y). (2.3.4) (2.3.3) Why is it useful to recognize homogeneous ordinary differential equations? Let us set y=ux so that (2.3.2) becomes (x2+u2x2) dx+(x2 ux2)(u dx+x du)=0. (2.3.5) First-Order Ordinary Differential Equations 91 Then, x2(1+u) dx+x3(1 u) du=0, (2.3.6) (2.3.7) or (2.3.8) Integrating (2.3.8), u+2ln|1+u|+ln|x|=ln|c|, (2.3.9) (2.3.10) (2.3.11) or (x+y)2=cxey/x. (2.3.12) Problems First show that the following differential equations are homogeneous and then find their solution. Then use MATLAB to plot your solution. Try and find the symbolic solution using MATLAB's dsolve. 92 Advanced Engineering Mathematics with MATLAB 1. 2. 3. 4. 5. 6. 7. 8. y =sec(y/x)+y/x y =ey/x+y/x. 2.4 EXACT EQUATIONS Consider the multivariable function z=f(x, y). Then the total derivative is (2.4.1) If the solution to a first-order ordinary differential equation can be written as f(x, y)=c, then the corresponding differential equation is M(x, y)dx+N(x, y) dy=0. (2.4.2) How do we know if we have an exact equation (2.4.2)? From the definition of M(x, y) and N(x, y), (2.4.3) if M(x, y) and N(x, y) and their first-order partial derivatives are continuous. Consequently, if we can show that our ordinary differential equation is exact, we can integrate First-Order Ordinary Differential Equations 93 (2.4.4) to find the solution f(x, y)=c. Example 2.4.1 Let us check and see if [y2 cos(x) 3x2y 2x] dx+[2y sin(x) x3+ln(y)] dy=0 (2.4.5) is exact. Since M (x, y)=y2 cos(x) 3x2y 2x, and N(x, y)=2y sin(x) x3+ln(y), we find that (2.4.6) and (2.4.7) Because Nx=My, (2.4.5) is an exact equation. Example 2.4.2 Because (2.4.5) is an exact equation, let us find its solution. Starting with (2.4.8) direct integration gives f(x, y)=y2sin(x) x3y x2+g(y). Substituting (2.4.9) into the equation fy=N, we obtain (2.4.9) 94 Advanced Engineering Mathematics with MATLAB (2.4.10) Thus, g (y)=ln(y), or g(y)=y ln(y) y+C. Therefore, the solution to the ordinary differential equation (2.4.5) is y2 sin(x) x3y x2+y ln(y) y=c. (2.4.11) Example 2.4.3 Consider the differential equation (x+y)dx+x ln(x) dy=0 (2.4.12) on the interval (0, ). A quick check shows that (2.4.12) is not exact since (2.4.13) However, if we multiply (2.4.12) by 1/x so that it becomes (2.4.14) then this modified differential equation is exact because (2.4.15) Therefore, the solution to (2.4.12) is x+y ln(x)=C. (2.4.16) This mysterious function that converts an inexact differential equation into an exact one is called an integrating factor. Unfortunately there is no general rule for finding one unless the equation is linear. First-Order Ordinary Differential Equations 95 Problems Show that the following equations are exact. Then solve them, using MATLAB to plot them. Finally try and find the symbolic solution using MATLAB's dsolve. 1. 2xyy =x2 y2 2. (x+y)y +y=x 3. (y2 1) dx+[2xy sin(y)] dy=0 4. [sin(y) 2xy+x2] dx+[x cos(y) x2] dy=0 5. y dx/x2+(1/x+1/y) dy=0 6. (3x2 6xy) dx (3x2+2y) dy=0 7. y sin(xy) dx+x sin(xy) dy=0 8. (2xy2+3x2) dx+2x2y dy=0 9. (2xy3+5x4y) dx+(3x2y2+x5+1) dy=0 10. (x3+y/x) dx+[y2+ln(x)] dy=0 11. [x+e y+x ln(y)] dy+[y ln(y)+ex] dx=0 12. cos(4y2) dx 8xy sin(4y2) dy=0 13. sin2(x+y) dx cos2(x+y) dy=0 14. Show that the integrating factor for (x y)y + y(1 y)=0 is (y)= ya/(1 y)a+2, a+1=1/ . Then show that the solution is 2.5 LINEAR EQUATIONS In the case of first-order ordinary differential equations, any differential equation of the form (2.5.1) is said to be linear. Consider now the linear ordinary differential equation (2.5.2) 96 Advanced Engineering Mathematics with MATLAB or (2.5.3) Let us now multiply (2.5.3) by x 4. (How we knew that it should be x 4 and not something else will be addressed shortly.) This magical factor is called an integrating factor because (2.5.3) can be rewritten (2.5.4) or (2.5.5) Thus, our introduction of the integrating factor x 4 allows us to use the differentiation product rule in reverse and collapse the right side of (2.5.4) into a single x derivative of a function of x times y. If we had selected the incorrect integrating factor, the right side would not have collapsed into this useful form. With (2.5.5), we may integrate both sides and find that (2.5.6) or (2.5.7) or y=x4(x 1)ex+Cx4. (2.5.8) From this example, it is clear that finding the integrating factor is crucial to solving firstorder, linear, ordinary differential equations. To do this, let us first rewrite (2.5.1) by dividing through by a1(x) so that it becomes First-Order Ordinary Differential Equations 97 (2.5.9) or dy+[P(x)y Q(x)] dx=0. (2.5.10) If we denote the integrating factor by (x), then (x)dy+ (x)[P(x)y Q(x)] dx=0. (2.5.11) Clearly, we can solve (2.5.11) by direct integration if it is an exact equation. If this is true, then (2.5.12) or (2.5.13) Integrating (2.5.13), (2.5.14) Note that we do not need a constant of integration in (2.5.14) because (2.5.11) is unaffected by a constant multiple. It is also interesting that the integrating factor only depends on P(x) and not Q(x). We can summarize our findings in the following theorem. Theorem: Linear First-Order Equation If the functions P(x) and Q(x) are continuous on the open interval I containing the point x0, then the initial-value problem 98 Advanced Engineering Mathematics with MATLAB has a unique solution y(x) on I, given by with an appropriate value of C and (x) is defined by (2.5.14). The procedure for implementing this theorem is as follows: Step 1: If necessary, divide the differential equation by the coefficient of dy/dx. This gives an equation of the form (2.5.9) and we can find P(x) by inspection. Step 2: Find the integrating factor by (2.5.14). Step 3: Multiply the equation created in Step 1 by the integrating factor. Step 4:Run the derivative product rule in reverse, collapsing the left side of the differential equation into the form d[ (x)y]/dx. If you are unable to do this, you have made a mistake. Step 5: Integrate both sides of the differential equation to find the solution. The following examples illustrate the technique. Example 2.5.1 Let us solve the linear, first-order ordinary differential equation xy y=4x ln(x). (2.5.15) We begin by dividing through by x to convert (2.5.15) into its canonical form. This yields (2.5.16) From (2.5.16), we see that P(x)=1/x. Consequently, from (2.5.14), we have that (2.5.17) Multiplying (2.5.16) by the integrating factor, we find that (2.5.18) First-Order Ordinary Differential Equations 99 or (2.5.19) Integrating both sides of (2.5.19), (2.5.20) Multiplying (2.5.20) through by x yields the general solution y=2x ln2(x)+Cx. (2.5.21) Although it is nice to have a closed form solution, considerable insight can be gained by graphing the solution for a wide variety of initial conditions. To illustrate this, consider the MATLAB script clear % use symbolic toolbox to solve (2.5.15) y = dsolve('x*Dy y=4*x*log(x)' , 'y(1) = c','x'); % take the symbolic version of the solution % and convert it into executable code solution = inline(vectorize(y),'x','c'); close all; axes; hold on % now plot the solution for a wide variety of initial conditions x = 0.1:0.1:2; for c = 2:4 if (c= = 2) plot(x, solution(x,c),'.'); end if (c= = 1) plot(x, solution(x, c),'o'); end if (c= = 0) plot(x, solution(x, c),'x'); end if (c= = 1) plot(x, solution(x, c),'+'); end if (c= = 2) plot(x, solution(x, c),'*'); end if (c= = 3) plot(x, solution(x, c),'s'); end if (c= = 4) plot(x, solution(x, c),'d'); end end axis tight xlabel ('x','Fontsize ',20); ylabel ('y','Fontsize',20) legend ('c = 2','c = 1','c = 0','c = 1',... 'c = 2','c = 3','c = 4'); legend boxoff This script does two things. First, it uses MATLAB's symbolic toolbox to solve (2.5.15). Alternatively we could have used (2.5.21) and introduced it as a function. The second portion of this script plots this solution for y(1)=C where C= 2, 1, 0, 1, 2, 3, 4. Figure 2.5.1 shows the results. As x0, we note how all of the solutions behave like 2x ln2(x). 100 Advanced Engineering Mathematics with MATLAB Figure 2.5.1: The solution to (2.5.15) when the initial condition is y(1)=c. Example 2.5.2 Let us solve the first-order ordinary differential equation (2.5.22) subject to the initial condition y(2)=6. Beginning as before, we rewrite (2.5.22) in the canonical form (y x)y y=0. (2.5.23) Examining (2.5.23) more closely, we see that it is a nonlinear equation in y. On the other hand, if we treat x as the dependent variable and y as the independent variable, we can write (2.5.23) as the linear equation (2.5.24) Proceeding as before, we have that P(y)=1/y and (y)=y so that (2.5.24) can be rewritten (2.5.25) First-Order Ordinary Differential Equations 101 or (2.5.26) Introducing the initial condition, we find that C= 6. Solving for y, we obtain (2.5.27) Figure 2.5.2: Schematic diagram for an electric circuit that contains a resistor of resistance R and an inductor of inductance L. We must take the positive sign in order that y(2)=6 and (2.5.28) Example 2.5.3: Electric circuits A rich source of first-order differential equations is the analysis of simple electrical circuits. These electrical circuits are constructed from three fundamental components: the resistor, the inductor, and the capacitor. Each of these devices gives the following voltage drop: In the case of a resistor, the voltage drop equals the product of the resistance R times the current I. For the inductor, the voltage drop is L dI/dt, where L is called the inductance, while the voltage drop for a capacitor equals Q/C, where Q is the instantaneous charge and C is called the capacitance. How are these voltage drops applied to mathematically describe an electrical circuit? This question leads to one of the fundamental laws in physics, Kirchhoff's law: The algebraic sum of all the voltage drops around an electric loop or circuit is zero. To illustrate Kirchhoff's law, consider the electrical circuit shown in Figure 2.5.2. By Kirchhoff's law, the electromotive force E, provided by a battery, for example, equals the sum of the voltage drops across the resistor RI and L dI/dt. Thus the (differential) equation that governs this circuit is 102 Advanced Engineering Mathematics with MATLAB (2.5.29) Assuming that E, I, and R are constant, we can rewrite (2.5.29) as (2.5.30) Integrating both sides of (2.5.30), (2.5.31) Figure 2.5.3: The temporal evolution of current I(t) inside an electrical circuit shown in Figure 2.5.2 with a constant electromotive force E. or (2.5.32) To determine C1, we apply the initial condition. Because the circuit is initially dead, I(0)=0, and (2.5.33) Figure 2.5.3 illustrates (2.5.33) as a function of time. Initially the current increases rapidly but the growth slows with time. Note that we could also have solved this problem by separation of variables. First-Order Ordinary Differential Equations 103 Quite often, the solution is separated into two parts: the steady-state solution and the transient solution. The steady-state solution is that portion of the solution which remains as t . It can equal zero. Presently it equals the constant value, E/R. The transient solution is that portion of the solution that vanishes as time increases. Here it equals Ee Rt/L/R. Although our analysis is a useful approximation to the real world, a more realistic one would include the nonlinear properties of the resistor.9 To illustrate this, consider the case of a RL circuit without any electromotive source (E=0) where the initial value for the current is I0. Equation (2.5.29) now reads (2.5.34) Separating the variables, (2.5.35) Figure 2.5.4: The variation of current I/I0 as a function of time Rt/L with different values of aI . 0 9 For the analysis of see Fairweather, A., and J.Ingham, 1941: Subsidence transients in circuits containing a non-linear resistor, with reference to the problem of spark-quenching. J. IEE, Part 1, 88, 330339. 104 Advanced Engineering Mathematics with MATLAB Upon integrating and applying the initial condition, we have that (2.5.36) Figure 2.5.4 shows I(t) for various values of a. As the nonlinearity reduces resistance, the decay in the current is reduced. If aI0>1, (2.5.36) predicts that the current would grow with time. The point here is that nonlinearity can have a dramatic influence on a physical system. Consider now the electrical circuit shown in Figure 2.5.5 which contains a resistor with resistance R and a capacitor with capacitance C. Here the voltage drop across the resistor is still RI while the voltage drop across the capacitor is Q/C. Therefore, by Kirchhoff 's law, (2.5.37) Equation (2.5.37) is not a differential equation. However, because current is the time rate of change in charge I=dQ/dt, (2.5.37) becomes (2.5.38) which is the differential equation for the instantaneous charge. Let us solve (2.5.38) when the resistance and capacitance is constant but the electromotive force equals E0 cos( t). The corresponding differential equation is now (2.5.39) First-Order Ordinary Differential Equations 105 Figure 2.5.5: Schematic diagram for an electric circuit that contains a resistor of resitance R and a capacitor of capacitance C. The differential equation has the integrating factor et/(RC) so that it can be rewritten (2.5.40) Integrating (2.5.40), (2.5.41) or (2.5.42) If we take the initial condition as Q(0)=0, then the final solution is (2.5.43) Figure 2.5.6 illustrates (2.5.43). Note how the circuit eventually supports a purely oscillatory solution (the steady-state solution) as the exponential term decays to zero (the transient solution). Indeed the purpose of the transient solution is to allow the system to adjust from its initial condition to the final steady state. Example 2.5.4: Terminal velocity When an object passes through a fluid, the viscosity of the fluid resists the motion by exerting a force on the object proportional to its velocity. Let us find the motion of a mass m that is initially thrown upward with the speed 0. 106 Advanced Engineering Mathematics with MATLAB If we choose the coordinate system so that it increases in the vertical direction, then the equation of motion is (2.5.44) Figure 2.5.6: The temporal evolution of the nondimensional charge (1+R2C2 2)Q(t) /(CE0) in the electric circuit shown in Figure 2.5.4 as a function of nondimensional time t when the circuit is driven by the electromotive force E0 cos( t) and RC =2. with (0)= equation 0 and k>0. Rewriting (2.5.44), we obtain the first-order linear differential (2.5.45) Its solution in nondimensional form is (2.5.46) The displacement from its initial position is First-Order Ordinary Differential Equations 107 (2.5.47) As t , the velocity tends to a constant downward value, mg/k, the so-called "terminal velocity," where the aerodynamic drag balances the gravitational acceleration. This is the steady-state solution. Why have we written (2.5.46)(2.5.47) in this nondimensional form? There are two reasons. First, the solution reduces to three fundamental variables, a nondimensional displacement x*=k2x(t)/(m2g), velocity * * = k (t)/(mg), and time t*=kt/m, rather than the six original parameters and variables: g, k, m, t, , and x. Indeed, if we had substituted t*, , and x* into (2.5.45), we would have obtained the following simplified initialvalue problem: (2.5.48) Figure 2.5.7: The nondimensional displacement k2x(t)/(m2g) as a function of nondimensional time kt/m of an object of mass m thrown upward at the initial nondimensional speed =k 0/(mg) in a fluid which retards its motion as k . right from the start. The second advantage of the nondimensional form is the compact manner in which the results can be displayed as Figure 2.5.7 shows. From (2.5.46)(2.5.47), the trajectory of the ball is as follows: If we define the coordinate system so that x0=0, then the object will initially rise to the height H given by 108 Advanced Engineering Mathematics with MATLAB (2.5.49) at the time (2.5.50) when (tmax)=0. It will then fall toward the earth. Given sufficient time kt/m1, it would achieve terminal velocity. Example 2.5.5: The Bernoulli equation Bernoulli's equation, (2.5.51) is a first-order, nonlinear differential equation. This equation can be transformed into a first-order, linear differential equation by introducing the change of variable z=y1 n. Because (2.5.52) the transformed Bernoulli equation becomes (2.5.53) This is now a first-order linear differential equation for z and can be solved using the methods introduced in this section. Once z is known, the solution is found by transforming back from z to y. To illustrate this procedure, consider the nonlinear ordinary differential equation (2.5.54) or First-Order Ordinary Differential Equations 109 (2.5.55) Equation (2.5.55) is a Bernoulli equation with p(x)= 1/x, q(x)=1/x2, and n= 1. Introducing z=y2, it becomes (2.5.56) This first-order linear differential equation has the integrating factor (x)= 1/x2 and (2.5.57) Integration gives (2.5.58) Therefore, the general solution is (2.5.59) Problems Find the solution for the following differential equations. State the interval on which the general solution is valid. Then use MATLAB to examine their behavior for a wide class of initial conditions. 1. y +y=ex 2. y +2xy=x 3. x2y +xy=1 4. (2y+x2) dx=x dy 5. y 3y/x=2x2 6. y +2y=2sin(x) 7. y +2cos(2x)y=0 8. xy +y=ln(x) 9. y +3y=4, y(0)=5 10. y y=ex/x, y(e)=0 11. sin(x)y +cos(x)y=1 110 Advanced Engineering Mathematics with MATLAB 12. [1 cos(x)]y +2sin(x)y=tan(x) 13. y +[a tan(x)+b sec(x)]y=c sec(x) 14. (xy+y 1) dx+xdy=0 15. 16. 17. Solve the following initial-value problem: Hint: Introduce the new dependent variable p=y2. 18. If x(t) denotes the equity capital of a company, then under certain assumptions10 x(t) is governed by where N is the dividend payout ratio, r is the rate of return of equity, and S is the rate of net new stock financing. If the initial value of x(t) is x(0), find x(t). 19. The assimilation11 of a drug into a body can be modeled by the chemical reaction which is governed by the chemical kinetics equations where [A] denotes the concentration of the drug in the gastrointestinal tract or in the site of injection, [B] is the concentration of the drug in the body, and [C] is either the amount of drug eliminated by various metabolic functions or the amount of the drug utilized by various action sites in the body. If [A]0 denotes the initial concentration of A, find [A], [B], and [C] as a function of time t. 20. Find the current in a RL circuit when the electromotive source equals E0 cos2( t). Initially the circuit is dead. 10 See Lebowitz, J.L., C.O.Lee, and P.B.Linhart, 1976: Some effects of inflation on a firm with original cost depreciation. Bell J.Economics, 7, 463477. Reprinted by permission of RAND. Copyright 1976. See Calder, G.V., 1974: The time evolution of drugs in the body: An application of the principle of chemical kinetics. J. Chem. Educ., 51, 1922. 11 First-Order Ordinary Differential Equations 111 Find the general solution for the following Bernoulli equations: 21. 22. 23. 24. 25. 26. 2.6 GRAPHICAL SOLUTIONS In spite of the many techniques developed for their solution, many ordinary differential equations cannot be solved analytically. In the next two sections, we highlight two alternative methods when analytical methods fail. Graphical methods seek to understand the nature of the solution by examining the differential equations at various points and infer the complete solution from these results. In the last section, we highlight the numerical techniques that are now commonly used to solve ordinary differential equations on the computer. Direction fields One of the simplest numerical methods for solving first-order ordinary differential equations follows from the fundamental concept that the derivative gives the slope of a straight line that is tangent to a curve at a given point. Consider the first-order differential equation y =f(x, y) (2.6.1) which has the initial value y(x0)=y0. For any (x, y) it is possible to draw a short line segment whose slope equals f(x, y). This graphical representation is known as the direction field or slope field of (2.6.1). Starting with the initial point (x0, y0), we can then construct the solution curve by extending the initial line segment in such a manner that the tangent of the solution curve parallels the direction field at each point through which the curve passes. Before the days of computers, it was common to first draw lines of constant slope (isoclines) or f(x, y)=c. Because along any isocline all of the line segments had the same 112 Advanced Engineering Mathematics with MATLAB slope, considerable computational savings were realized. Today, computer software exists which perform these graphical computations with great speed. To illustrate this technique, consider the ordinary differential equation (2.6.2) Its exact solution is x(t)=Cet+t2+2t+2, (2.6.3) where C is an arbitrary constant. Using the MATLAB script clear % create grid points in t and x [t , x] = meshgrid( 2:0.2:3, 1:0.2:2); % load in the slope slope = x t.*t; % find the length of the vector (1, slope) length = sqrt(1 + slope .* slope) ; % create and plot the vector arrows quiver(t, x, 1./length,slope./length, 0.5) axis equal tight hold on % plot the exact solution for various initial conditions tt = [ 2:0.2:3]; for cva1 = 10:1:10 x_exact = cval * exp(tt) + tt.*tt + 2*tt + 2; plot(tt, x_exact) xlabel('t' , 'Fontsize',20) ylabel('x' , 'Fontsize',20) end we show in Figure 2.6.1 the directional field associated with (2.6.2) along with some of the particular solutions. Clearly the vectors are parallel to the various particular solutions. Therefore, without knowing the solution, we could choose an arbitrary initial condition and sketch its behavior at subsequent times. The same holds true for nonlinear equations. Rest points and autonomous equations In the case of autonomous differential equations (equations where the independent variable does not explicitly appear in the equation), considerable information can be gleaned from a graphical analysis of the equation. First-Order Ordinary Differential Equations 113 Consider the nonlinear ordinary differential equation (2.6.4) Figure 2.6.1: The direction field for (2.6.2). The solid lines are plots of the solution with various initial conditions. The time derivative x vanishes at x= 1, 0, 1. Consequently, if x(0)=0, x(t) will remain zero forever. Similarly, if x(0)=1 or x(0)= 1, then x(t) will equal 1 or 1 for all time. For this reason, values of x for which the derivative x is zero are called rest points, equilibrium points, or critical points of the differential equation. The behavior of solutions near rest points is often of considerable interest. For example, what happens to the solution when x is near one of the rest points x= 1, 0, 1? Consider the point x=0. For x slightly greater than zero, x <0. For x slightly less than 0, x >0. Therefore, for any initial value of x near x=0, x will tend to zero. In this case, the point x=0 is an asymptotically stable critical point because whenever x is perturbed away from the critical point, it tends to return there again. Turning to the point x=1, for x slightly greater than 1, x >0; for x slightly less than 1, x <0. Because any x near x=1, but not equal to 1, will move away from x=1, the point x=1 is called an unstable critical point. A similar analysis applies at the point x= 1. This procedure of determining the behavior of an ordinary differential equation near its critical points is called a graphical stability analysis. Phase line A graphical representation of the results of our graphical stability analysis is the phase line. On a phase line, the equilibrium points are denoted by circles. See Figure 2.6.2. Also on the phase line we identify the sign of x for all values of x. From the sign of x , we then indicate whether x is increasing or deceasing by an appropriate arrow. If the arrow points toward the right, x is increasing; toward the left x decreases. Then, by knowing the sign of the derivative for all values of x, together with the starting value of x, we can determine what happens as t . Any solution that is approached 114 Advanced Engineering Mathematics with MATLAB Figure 2.6.2: The phase line diagram for the ordinary differential equation (2.6.4). asymptotically as t steady-state output. is called a steady-state output. In our present example, x=0 is a Problems In previous sections, you used various techniques to solve first-order ordinary differential equations. Now check your work by using MATLAB to draw the direction field and plot your analytic solution for the following problems taken from previous sections: 1. 2.2, Problem 5 2. 2.3, Problem 1 3. 2.4, Problem 5 4. 2.5, Problem 3 For the following autonomous ordinary differential equations, draw the phase line. Then classify each equilibrium solution as either stable or unstable. 5. 6. x =(x2 1)(x2 4) 7. x = 4x x3 8. x =4x x3 2.7 NUMERICAL METHODS By now you have seen most of the exact methods for finding solutions to first-order ordinary differential equations. The methods have also given you a view of the general behavior and properties of solutions to differential equations. However, it must be admitted that in many instances exact solutions cannot be found and we must resort to numerical solutions. In this section we present the two most commonly used methods for solving differential equations: Euler and Runge-Kutta methods. There are many more methods and the interested student is referred to one of countless numerical methods books. A straightforward extension of these techniques can be applied to systems of first-order and higher-order differential equations. Euler and modified Euler methods Consider the following first-order differential equation and initial condition: First-Order Ordinary Differential Equations 115 (2.7.1) Euler's method is based on a Taylor series expansion of the solution about x0 or (2.7.2) where h is the step size. Euler's method consists of taking a sufficiently small h so that only the first two terms of this Taylor expansion are significant. Let us now replace y (x0) by f(x0, y0). Using subscript notation, we have that yi+1=yi+hf(xi, yi)+O(h2). (2.7.3) Equation (2.7.3) states that if we know the values of yi and f(xi, yi) at the position xi, then the solution at xi+1 can be obtained with an error12 O(h2). The trouble with Euler's method is its lack of accuracy, often requiring an extremely small time step. How might we improve this method with little additional effort? One possible method would retain the first three terms of the Taylor expansion rather than the first two. This scheme, known as the modified Euler method, is (2.7.4) This is clearly more accurate than (2.7.3). An obvious question is how do we evaluate because we do not have any information on its value? Using the forward derivative approximation, we find that (2.7.5) Substituting (2.7.5) into (2.7.4) and simplifying (2.7.6) 12 The symbol O is a mathematical notation indicating relative magnitude of terms, namely that provided For example, as and 116 Advanced Engineering Mathematics with MATLAB Using the differential equation, (2.7.7) Although f(xi, yi) at (xi, yi) are easily calculated, how do we compute f(xi+1, yi+1) at (xi+1, yi+1)? For this we compute a first guess via the Euler method (2.7.3); equation (2.7.7) then provides a refinement on the value of yi+1. In summary then, the simple Euler scheme is yi+1=yi+k1+O(h2), k1=hf(xi, yi). (2.7.8) while the modified Euler method is (2.7.9) Example 2.7.1 Let us illustrate Euler's method by numerically solving x = x+t, x(0)=1. (2.7.10) A quick check shows that (2.7.10) has the exact solution xexact(t)=2et t 1. Using the MATLAB script clear for i = 1:3 % set up time step increment and number of time steps h = 1/10^i; n = 10/h; % set up initial conditions t=zeros (n+1, 1) ; t(1) = 0; x_euler=zeros (n+1, 1); x_euler(1) = 1; x_modified=zeros(n+1, 1); x_modified(1) = 1; x_exact=zeros(n+1, 1); x_exact(1) = 1; First-Order Ordinary Differential Equations 117 % set up difference arrays for plotting purposes diff1 = zeros(n, 1); diff2 = zeros(n, 1); tplot = zeros(n, 1); % define right side of differential equation (2.7.10) f = inline('xx+tt','tt','xx'); for k = 1: n t(k+1) = t(k) + h; % compute exact solution x_exact(k+1) = 2*exp(t(k+1)) t(k+1) 1; % compute solution via Euler's method k1 = h * f(t(k), x_euler(k)); x_euler(k+1) = x_euler(k) + k1; tplot(k) = t(k+1); diff1(k) = x_euler(k+1) x_exact(k+1); diff1(k) = abs(diff1(k) / x_exact(k+1)); % compute solution via modified Euler method k1 = h * f(t(k), x_modified(k)); k2 = h * f(t(k+1), x_modified(k)+k1); x_modified(k+1) = x_modified(k) + 0.5 * (k1+k2) ; diff2(k) = x_modified(k+1) x_exact(k+1); diff2(k) = abs(diff2(k) / x_exact(k+1)); end % plot relative errors semilogy (tplot, diff1,'-', tplot,diff2,':') Figure 2.7.1: The relative error [x(t) xexact(t)]/xexact(t) of the numerical solution of (2.7.10) using Euler's method (the solid line) and modified Euler's method (the dotted line) with different time steps h. hold on xlabel ('TIME','Fontsize',20) ylabel (' |RELATIVE ERROR|','Fontsize',20) legend('Euler method','modified Euler method') legend boxoff; num1 = 0.2*n; num2 = 0.8*n; 118 Advanced Engineering Mathematics with MATLAB text(3,diff1(num1), ['h = ',num2str(h)],'Fontsize',15,... 'HorizontalAlignment','right',... 'VerticalAlignment','bottom') text(9,diff2(nun2), ['h = ',num2str(h)],'Fontsize',15,... 'HorizontalAlignment','righty',... 'VerticalAlignment','bottom') end Both the Euler and modified Euler methods have been used to numerically integrate (2.7.10) and the absolute value of the relative error is plotted in Figure 2.7.1 as a function of time for various time steps. In general, the error grows with time. The decrease of error with smaller time steps, as predicted in our analysis, is quite apparent. Furthermore, the superiority of the modified Euler method over the original Euler method is clearly seen. Runge-Kutta method As we have just shown, the accuracy of numerical solutions of ordinary differential equations can be improved by adding more terms to the Taylor expansion. Figure 2.7.2: Although Carl David Tolm Runge (18561927) began his studies in Munich, his friendship with Max Planck led him to Berlin and pure mathematics with Kronecker and Weierstrass. It was during his professorship at Hanover begining in 1886 and subsequent work in spectroscopy that led him to his celebrated paper on the numerical integration of ordinary differential equations. Runge's final years were spent in Gttingen as a professor in applied mathematics. (Protrait taken with permission from Reid, C., 1976: Courant in Gttingen and New York: The Story of an Improbable Mathematician. Springer-Verlag, 314 pp. 1976, by Springer-Verlag New York Inc.) First-Order Ordinary Differential Equations 119 The Runge-Kutta method13 builds upon this idea, just as the modified Euler method did. Let us assume that the numerical solution can be approximated by yi+1= yi +ak +bk2 , 1 k1=hf(xi, yi) and k2=hf(xi+A1h, yi+B1k1). (2.7.11) where (2.7.12) Here a, b, A1, and B1 are four unknowns. Equation (2.7.11) was suggested by the modified Euler method that we just presented. In that case, the truncated Taylor series had an error of O(h3). We anticipate such an error in the present case. Because the Taylor series expansion of f(x+h, y+k) about (x, y) is (2.7.13) k2 can be rewritten k2=hf[xi+A1h, yi+Bhf(xi, yi)] (2.7.14) =h[f(x , y )+(A hf +B hf f )] i 1 x 1 y i (2.7.15) Runge, C., 1895: Ueber die numerische Auflsung von Differentialgleichungen. Math. Ann., 46, 167178; Kutta, W., 1901: Beitrag zur Nherungsweisen Integration totaler Differentialgleichungen. Zeit. Math. Phys., 46, 435453. For a historical review, see Butcher, J.C., 1996: A history of Runge-Kutta methods. Appl. Numer. Math., 20, 247260 and Butcher, J.C., and G.Wanner, 1996: Runge-Kutta methods: Some historical notes. Appl. Numer. Math., 22, 113151. 13 120 Advanced Engineering Mathematics with MATLAB =hf+A1h2fx+B1h2f fy, (2.7.16) where we have retained only terms up to O(h2) and neglected all higher-order terms. Finally, substituting (2.7.16) into (2.7.11) gives yi+1=yi+(a+b)hf+(A1bfx+B1bf fy)h2. (2.7.17) This equation corresponds to the second-order Taylor expansion: (2.7.18) Therefore, if we wish to solve the differential equation y =f(x, y), then y =fx+fyy =fx+f fy. (2.7.19) Substituting (2.7.19) into (2.7.18), we have that (2.7.20) A direct comparison of (2.7.17) and (2.7.20) yields (2.7.21) These three equations have four unknowns. If we choose calculate we immediately and A1=B1=1. Hence the second-order Runge-Kutta scheme is (2.7.22) where k1=hf(xi, yi) and k2=hf(xi+h,yi+k1). Thus, second-order Runge-Kutta scheme is identical to the modified Euler method. First-Order Ordinary Differential Equations 121 Although the derivation of the second-order Runge-Kutta scheme yields the modified Euler scheme, it does provide a framework for computing higherorder and more accurate schemes. A particularly popular one is the fourthorder Runge-Kutta scheme (2.7.23) where k1=hf(xi , yi ), (2.7.24) (2.7.25) (2.7.26) and k4=hf(xi+h, yi+k3). (2.7.27) Example 2.7.2 Let us illustrate the fourth-order Runge-Kutta by redoing the previous example using the MATLAB script clear % test out different time steps for i = 1:4 % set up time step increment and number of time steps if i= =1 h = 0.50; end; if i= =2 h = 0.10; end; if i= =3 h = 0.05; end; if i= =4 h = 0.01; end; n = 10/h; % set up initial conditions t=zeros(n+1,1); t(1) = 0; x_rk=zeros(n+1,1); x_rk(1) = 1; x_exact=zeros(n +1,1); x_exact(1) = 1; % set up difference arrays for plotting purposes diff = zeros(n,1); tplot = zeros(n, 1); 122 Advanced Engineering Mathematics with MATLAB % define right side of differential equation f = inline('xx+tt','tt','xx'); for k = 1:n x_local = x_rk(k); t_local = t(k); k1 = h * f(t_local, x_local); k2 = h * f(t_local + h/2,x_local + k1/2); k3 = h * f(t_local + h/2,x_local + k2/2); k4 = h * f(t_local + h,x_local + k3); t(k+1) = t_local + h; x_rk(k+1) = x_local + (k1+2*k2+2*k3+k4)/6; x_exact(k+1) = 2*exp(t(k+1)) - t(k+1) - 1; tplot(k) = t(k); diff(k) = x_rk(k+1) - x_exact(k+1); diff(k) = abs(diff(k)/x_exact(k+1)); end % plot relative errors semilogy(tplot, diff,'-') hold on Figure 2.7.3: Same as Figure 2.7.1 except that we have used the fourth-order Runge-Kutta method. xlabel('TIME','Fontsize',20) ylabel('|RELATIVE ERROR|','Fontsize',20) num1 = 2*i; num2 = 0.2*n; text(num1,diff(num2),['h = ',num2str(h)],'Fontsize',15,... 'HorizontalAlignment','right',... 'VerticalAlignment','bottom') end The error growth with time is shown in Figure 2.7.3. Although this script could be used for any first-order ordinary differential equation, the people at MATLAB have an alternative called ode45 which combines a fourth-order and a fifth-order method which are similar to our fourth-order Runge-Kutta method. Their scheme is more efficient First-Order Ordinary Differential Equations 123 because it varies the step size, choosing a new time step at each step in an attempt to achieve a given desired accuracy. Problems Using Euler's method for various values of h=10 n, find the numerical solution for the following initial-value problems. Check your answer by finding the exact solution: 1. x =x t, x(0)=2 2. x =tx, x(0)=1 3. x =x2/(t+1), x(0)=1 4. x =x+e t, x(1)=0 5. Consider the integro-differential equation Figure 2.7.4: The numerical solution of the equation describing an electrical circuit with a nonlinear resistor. Here =0.2 and t=0.01. 124 Advanced Engineering Mathematics with MATLAB where the signum function is defined by (5.2.11). This equation describes the (nondimensional) current,14 x(t), within an electrical circuit that contains a capacitor, inductor, and nonlinear resistor. Assuming that the circuit is initially dead, x(0)=0, write a MATLAB script that uses Euler's method to compute x(t). Use a simple Riemann sum to approximate the integral. Examine the solution for various values of B and as well as time step t. 14 Monahan, T.F., 1960: Calculation of the current in non-linear surge-current-generation circuits. Proc. IEE, Part C, 107, 288291. Chapter 3 Higher-Order Ordinary Differential Equations Although first-order ordinary differential equations exhibit most of the properties of differential equations, higher-order ordinary differential equations are more ubiquitous in the sciences and engineering. This chapter is devoted to the most commonly employed techniques for their solution. A linear nth-order ordinary differential equation is a differential equation of the form (3.0.1) If f(x)=0, then (3.0.1) is said to be homogeneous; otherwise, it is nonhomogeneous. A linear differential equation is normal on an interval I if its coefficients and f(x) are continuous, and the value of an (x) is never zero on I. Solutions to (3.0.1) generally must satisfy not only the differential equations but also certain specified conditions at one or more points. Initial-value problems are problems where all of the conditions are specified at a single point x=a and have the form: y( )=b0, y ( )=b1, y (a)=b2,...., y(n 1)(a)=bn 1, where b0, b1, b2,...., bn 1 are arbitrary constants. A quick check shows that if (3.0.1) is homogeneous and normal on an interval I and all of the initial conditions equal zero at the point x=a which lies in I, then y(x) 0 on I. This follows because y=0 is a solution of (3.0.1) and satisfies the initial conditions. At this point a natural question would be whether the solution exists for this initial-value problem and, if so, how many? From a detailed study of this question,1 we have the following useful theorem. Theorem: Existence and Uniqueness Suppose that the differential equation (3.0.1) is normal on the open i nterval I containing the point x=a. Then, given n numbers b0, b1,..., bn 1, the nth-order linear equation (3.0.1) has a unique solution on the entire interval I that satisfies the n initial conditions y(a)=b0, y (a)=b1,..., y(n 1) (a)= bn 1. Example 3.0.1 to the ordinary differential equation y +2y y 2y=0 The solution satisfies the initial conditions y(0)=1, y (0)=2, and y (0)=0 at x=0. Our theorem guarantees us that this is the only solution with these initial values. 1 The proof of the existence and uniqueness of solutions to (3.0.1) is beyond the scope of this book. See Ince, E.L., 1956: Ordinary Differential Equations. Dover Publications, Inc., 3.32. 126 Advanced Engineering Mathematics with MATLAB Another class of problems, commonly called (two-point) boundary-value problems, occurs when conditions are specified at two different points x= a and x=b with b>a An important . example, in the case of secondorder ordinary differential equations, is the Sturmy( )+ 1y(a)=0 at x=a and Liouville problem where the boundary conditions are 1 2 y(b)+ 2y (b)=0 at x=b. The Sturm-Liouville problem is treated in Chapter 9. Having introduced some of the terms associated with higher-order ordinary linear differential equations, how do we solve them? One way is to recognize that these equations are really a set of linear, first-order ordinary differential equations. For example, the linear second-order linear differential equation y 3y +2y=3x (3.0.2) can be rewritten as the following system of first-order ordinary differential equations: y y= , and 2v=3x (3.0.3) because y y =v =2v+3x=2y 2y+3x, (3.0.4) which is the same as (3.0.2). This suggests that (3.0.2) can be solved by applying the techniques from the previous chapter. Proceeding along this line, we first find that (3.0.5) Therefore, (3.0.6) Again, applying the techniques from the previous chapter, we have that Higher-Order Ordinary Differential Equations 127 (3.0.7) Note that the solution to this second-order ordinary differential equation contains two arbitrary constants. Example 3.0.2 In the case of linear, second-order ordinary differential equations, a similar technique, called reduction in order, provides a method for solving differential equations if we know one of its solutions. Consider the second-order ordinary differential equation x2y 5xy +9y=0. (3.0.8) A quick check shows that y1(x)=x3 ln(x) is a solution of (3.0.8). Let us now assume that the general solution can be written y(x)=u(x)x3 ln(x). Then y =u (x)x3 ln(x)+u(x) [3x2 ln(x)+x2], and y =u (x)x3 ln(x)+2u (x) [3x2 ln(x)+x2]+u(x) [6x ln(x)+5x]. (3.0.9) (3.0.10) Substitution of y(x), y (x), and y (x) into (3.0.8) yields x5 ln(x)u +[x4 ln(x)+2x4] u =0. (3.0.11) Setting u = , separation of variables leads to (3.0.12) Note how our replacement of u (x) with (x) has reduced the second-order ordinary differential equation to a first-order one. Solving (3.0.12), we find that 128 Advanced Engineering Mathematics with MATLAB (3.0.13) and (3.0.14) Because y(x)=u(x)x3 ln(x), the complete solution is y(x)=C1x3+C2x3 ln(x). (3.0.15) Substitution of (3.0.15) into (3.0.8) confirms that we have the correct solution. We can verify our answer by using the symbolic toolbox in MATLAB. Typing the command: dsolve('x*x*D2y-5*x*Dy+9*y=0','x') yields ans = C1*x^3+C2*x^3*log(x) In summary, we can reduce (in principle) any higher-order linear ordinary differential , equations into a system of first-order ordinary differential equations. This system of differential equations can then be solved using techniques from the previous chapter. In Chapter 14 we will pursue this idea further. Right now, however, we will introduce methods that allow us to find the solution in a more direct manner. Example 3.0.3 An autonomous differential equation is one where the independent variable does not appear explicitly. In certain cases we can reduce the order of the differential equation and then solve it. Consider the autonomous ordinary differential equation y =2y3. (3.0.16) The trick here is to note that Higher-Order Ordinary Differential Equations 129 (3.0.17) where v=dy/dx. Integrating both sides of (3.0.17), we find that 2 =y4+C1. (3.0.18) Solving for v, (3.0.19) Integrating once more, we have the final result that (3.0.20) Problems For the following differential equations, use reduction of order to find a second solution. Can you obtain the general solution using dsolve in MATLAB? 1. xy +2y =0, y1(x)=1 2. y +y 2y=0, y1(x)=ex 3. x2y +4xy 4y=0, y1(x)=x 4. xy (x+1)y +y=0, y1 (x)=ex 5. (2x x2)y +2(x 1)y 2y=0, y1(x)=x 1 6. y +tan(x)y 6 cot2(x)y=0, y1(x)=sin3(x) 7. 8. y +ay +b(1+ax bx2)y=0, y1(x)=e bx2 /2 Solve the following autonomous ordinary differential equations: 9. yy =y 2 10. y =2yy , y(0)=y (0)=1 11. yy =y +y 2 12. 2yy =1+y 2 13. y =e2y, y(0)=0, y (0)=1 14. 15. Solve the nonlinear second-order ordinary differential equation 130 Advanced Engineering Mathematics with MATLAB by (1) reducing it to the Bernoulli equation (2) solving for (x), and finally (3) integrating u =v to find u(x). 16. Consider the differential equation a2(x)y + 1(x)y + 0(x)y=0, a2(x) 0. Show that this ordinary differential equation can be rewritten using the substitution 3.1 HOMOGENEOUS LINEAR EQUATIONS WITH CONSTANT COEFFICIENTS In our drive for more efficient methods to solve higher-order, linear, ordinary differential equations, let us examine the simplest possible case of a homogeneous differential equation with constant coefficients: (3.1.1) Although we could explore (3.1.1) in its most general form, we will begin by studying the second-order version, namely y +by +cy=0, (3.1.2) since it is the next step up the ladder in complexity from first-order ordinary differential equations. Higher-Order Ordinary Differential Equations 131 Motivated by the fact that mx the solution ax to the first-order ordinary differential equation y +ay=0 is y(x)=C1e , we make the educated guess that the solution to (3.1.2) is y(x)=Ae . Direct substitution into (3.1.2) yields (am2 +bm+c) Ae mx =0. (3.1.3) Because A 0 or we would have a trivial solution and since emx 0 for arbitrary x, (3.1.3) simplifies to am2 +bm+c=0. (3.1.4) Equation (3.1.4) is called the auxiliary or characteristic equation. At this point we must consider three separate cases. Distinct real roots In this case the roots to (3.1.4) are real and unequal. Let us denote these roots by m=m1, and m=m2. Thus, we have the two solutions: (3.1.5) We will now show that the most general solution to (3.1.2) is (3.1.6) This result follows from the principle of (linear) superposition. Theorem: Let y1, y2,..., yk be solutions of the homogeneous equation (3.1.1) on an interval I. Then the linear combination y(x)=C1y1(x)+C2y2(x)+...+Ckyk(x), where Ci, i=1, 2,..., k, are arbitrary constants, is also a solution on the interval I. (3.1.7) 132 Advanced Engineering Mathematics with MATLAB Proof: We will prove this theorem for second-order ordinary differential equations; it is easily extended to higher orders. By the superposition principle, y(x)=C1y1(x)+C2y2(x). Upon substitution into (3.1.2), we have that (3.1.8) Recombining the terms, we obtain (3.1.9) or 0C1+0C2=0. (3.1.10) Example 3.1.1 A quick check shows that y1(x)=ex and y2(x)=e x are two solutions of y y=0. Our theorem tells us that any linear combination of these solutions, such as y(x)=5ex 3e x, is also a solution. How about the converse? Is every solution to y y=0 a linear combination of y1(x) and y2(x)? We will address this question shortly. Example 3.1.2 Let us find the general solution to y +2y 15y=0. (3.1.11) Assuming a solution of the form y(x)=Aemx, we have that (m2+2m 15)Aemx=0. (3.1.12) Because A 0 and emx generally do not equal zero, we obtain the auxiliary or characteristic equation Higher-Order Ordinary Differential Equations 133 m2+2m 15=(m+5)(m 3)=0. (3.1.13) Therefore, the general solution is y(x)=C1e3x+C2e 5x . (3.1.14) Repeated real roots When m=m1=m2, we have only the single exponential solution To find the second solution we apply the reduction of order technique shown in Example 3.0.2. Performing the calculation, we find (3.1.15) Since m1= b/(2a), the integral simplifies to dx and (3.1.16) Example 3.1.3 Let us find the general solution to y +4y +4y=0. (3.1.17) Here the auxiliary or characteristic equation is m2+4m+4=(m+2)2=0. (3.1.18) Therefore, the general solution is 134 Advanced Engineering Mathematics with MATLAB y(x)=(C1+C2x)e 2x . (3.1.19) G Complex conjugate roots When b2 4ac<0, the roots become the complex pair m1= +i and m2= and are real and i2= 1. Therefore, the general solution is y(x)=C1e( +i )x i, where +C2e( i)x . (3.1.20) Although (3.1.20) is quite correct, most engineers prefer to work with real functions rather than complex exponentials. To this end, we apply Euler's formula2 to eliminate ei x and e i x since ei x=cos( x)+i sin( x), (3.1.21) and e i x =cos( x) i sin( x). (3.1.22) Therefore, y(x)=C1e x [cos( x)+i sin( x)]+C2eax [cos( x) i sin( x)] (3.1.23) =C3e where C3=C1+C2, and C4=iC1 iC2. x cos( x)+C4e x sin( x), (3.1.24) Example 3.1.4 Let us find the general solution to 2 If you are unfamiliar with Euler's formula, see 1.1. Higher-Order Ordinary Differential Equations 135 y +4y +5y=0. Here the auxiliary or characteristic equation is m2+4m+5=(m+2)2+1=0, (3.1.25) (3.1.26) or m= 2i. Therefore, the general solution is y(x)=e 2x [C1 cos(x)+C2 sin(x)]. (3.1.27) So far we have only dealt with second-order differential equations. When we turn to higher-order ordinary differential equations, similar considerations hold. In place of (3.1.4), we now have the nth-degree polynomial equation anmn+an 1mn 1+...+a2m2+a1m+a0=0 (3.1.28) for its auxiliary equation. When we treated second-order ordinary differential equations we were able to classify the roots to the auxiliary equation as distinct real roots, repeated roots, and complex roots. In the case of higher-order differential equations, such classifications are again useful although all three types may occur with the same equation. For example, the auxiliary equation m6 m5+2m4 2m3+m2 m=0 (3.1.29) For each complex pair m=a i, we have the corresponding homogeneous solution corresponding pair of homogeneous solutions e x cos( x) and e x sin( x). For a repeated root m=m1 of multiplicity k, regardless of whether it is real or complex, we have either has the distinct roots m=0 and m=1 with the twice repeated, complex roots m=i. Although the possible combinations increase with higher-order differential equations, the solution technique remains the same. For each distinct real root m=m1, we have a 136 Advanced Engineering Mathematics with MATLAB in the case of real m1 or e x cos( x), e sin( x), xeax cos( x), xe x sin( x), x2eax cos( x), x2eaxsin( x),..., xkeaxcos( x), xkeaxsin( x) x in the case of complex roots (3.1.29) is i. For example, the general solution for the roots to y(x)=C1+C2ex+C3 cos(x)+C4 sin(x)+C5x cos(x)+C6x sin(x). (3.1.30) Example 3.1.5 Let us find the general solution to y +y 10y=0. (3.1.31) Here the auxiliary or characteristic equation is m3+m 10=(m 2)(m2+2m+5)=(m 2)[(m+1)2+4]=0, (3.1.32) or m= 2 and m= 12i. Therefore, the general solution is y(x)=C1e 2x +e x[C2 cos(2x)+C3 sin(2x)]. (3.1.33) Having presented the technique for solving constant coefficient, linear, ordinary differential equations, an obvious question is: How do we know that we have captured all of the solutions? Before we can answer this question, we must introduce the concept of linear dependence. A set of functions f1(x), f2(x),..., fn(x) is said to be linearly dependent on an interval I if there exists constants C1, C2,..., Cn, not all zero, such that C1f1(x)+C2f2(x)+C3f3(x)+...+Cnfn(x)=0 (3.1.34) for each x in the interval; otherwise, the set of functions is said to be linearly Higher-Order Ordinary Differential Equations 137 independent. This concept is easily understood when we have only two functions f1(x) and f2(x). If the functions are linearly dependent on an interval, then there exists constants C1 and C2 that are not both zero where C1f1(x)+C2f2(x)=0 (3.1.35) for every x in the interval. If C1 0, then (3.1.36) In other words, if two functions are linearly dependent, then one is a constant multiple of the other. Conversely, two functions are linearly independent when neither is a constant multiple of the other on an interval. Example 3.1.6 Let us show that f(x)=2x, g(x)=3x2, and h(x)=5x 8x2 are linearly dependent on the real line. To show this, we must choose three constants, C1, C2, and C3, such that C1f(x)+C2g(x)+C3h(x)=0, (3.1.37) where not all of these constants are nonzero. A quick check shows that 15f(x) 16g(x) 6h(x)=0. (3.1.38) Clearly, f(x), g(x), and h(x) are linearly dependent. Example 3.1.7 This example shows the importance of defining the interval on which a function is linearly dependent or independent. Consider the two functions f(x)=x and g(x)=|x|. They are linearly dependent on the interval (0, ) since C1x+C2|x|=C1x+C2x=0 is satisfied for any nonzero choice of C1 and C2 where C1= C2. What happens on the interval ( They are still linearly dependent but now C1=C2. , 0)? 138 Advanced Engineering Mathematics with MATLAB Although we could use the fundamental concept of linear independence to check and see whether a set of functions is linearly independent or not, the following theorem introduces a procedure that is very straightforward. Theorem: Wronskian Test of Linear Independence Suppose f1(x), f2(x),..., fn(x) possess at least n 1 derivatives. If the determinant3 is not zero for at least one point in the interval I, then the functions f1(x), f2(x),..., fn(x) are linearly independent on the interval. The determinant in this theorem is denoted by W[f1(x), f2(x),..., fn(x)] and is called the Wronskian of the functions. Proof: We prove this theorem by contradiction when n=2. Let us assume that W[f1(x0), f2(x0)] 0 for some fixed x0 in the interval I and that f1(x) and f2(x) are linearly dependent on the interval. Since the functions are linearly dependent, there exists C1 and C2, both not zero, for which C1f1(x)+C2f2(x)=0 (3.1.39) for every x in I. Differentiating (3.1.39) gives (3.1.40) We may view (3.1.39)(3.1.40) as a system of equations with C1 and C2 as the unknowns. Because the linear dependence of f1 and f2 implies that C1 0 and/or C2 0 for each x in the interval, (3.1.41) for every x in I. This contradicts the assumption that W[f1(x0), f2(x0) 0 and f1 and f2 are linearly independent. 3 If you are unfamiliar with determinants, see 14.2. Higher-Order Ordinary Differential Equations 139 Example 3.1.8 Are the functions f(x)=x, g(x)=xex, and h(x)=x2ex linearly dependent on the real line? To find out, we compute the Wronskian or (3.1.42) (3.1.43) Therefore, x, xex, and x2ex are linearly independent. Having introduced this concept of linear independence, we are now ready to address the question of how many linearly independent solutions a homogeneous linear equation has. Theorem: On any interval I over which an n-th order homogeneous linear differential equation is normal, the equation has n linearly independent solutions y1(x), y2(x),..., yn(x) and any particular solution of the equation on I can be expressed as a linear combination of these linearly independent solutions. Proof : Again for convenience and clarity we prove this theorem for the special case of n=2. Let y1(x) and y2(x) denote solutions on I of (3.1.2). We know that these solutions exist by the existence theorem and have the following values: (3.1.44) at some point a on I. To establish the linear independence of y1 and y2 we note that, if C1y1(x)+C2y2(x)=0 holds identically on I, then Because x=a lies in I, we have that C1y1(a)+C2y2(a)=0, there too. (3.1.45) and 140 Advanced Engineering Mathematics with MATLAB (3.1.46) which yields C1=C2=0 after substituting (3.1.44). Hence, the solutions y1 and y2 are linearly independent. To complete the proof we must now show that any particular solution of (3.1.2) can be expressed as a linear combination of y1 and y2. Because y, y1, and y2 are all solutions of (3.1.2) on I, so is the function Y(x)=y(x) y( )y1(a) y (a)y2(x), (3.1.47) where y( ) and y (a) are the values of the solution y and its derivative at x=a. Evaluating Y and Y at x=a, we have that Y (a)=y(a) y( )y1( ) y (a)y2(a)=y(a) y(a)=0, (3.1.48) and (3.1.49) Thus, Y is the trivial solution to (3.1.2). Hence, for every x in I, y(x) y(a)y1(x) y (a)y2(x)=0. (3.1.50) Solving (3.1.50) for y(x), we see that y is expressible as the linear combination y(x)=y(a)y1(x)+y (a)y2(x) (3.1.51) of y1 and y2, and the proof is complete for n=2. Problems Find the general solution to the following differential equations. Check your general solution by using dsolve in MATLAB. 1. y +6y +5y=0 Higher-Order Ordinary Differential Equations 141 2. y 6y +10y=0 3. y 2y +y=0 4. y 3y +2y=0 5. y 4y +8y=0 6. y +6y +9y=0 7. y +6y 40y=0 8. y +4y +5y=0 9. y +8y +25y=0 10. 4y 12y +9y=0 11. y +8y +16y=0 12. y +4y =0 13. y +4y =0 14. y +2y +y =0 15. y 8y=0 16. y 3y +3y y =0 17. The simplest differential equation with "memory"--its past behavior affects the present--is Solve this integro-differential equation by differentiating it with respect to t to eliminate the integral. 3.2 SIMPLE HARMONIC MOTION Second-order, linear, ordinary differential equations often arise in mechanical or electrical problems. The purpose of this section is to illustrate how the techniques that we just derived may be applied to these problems. We begin by considering the mass-spring system illustrated in Figure 3.2.1 where a mass m is attached to a flexible spring suspended from a rigid support. If there were no spring, then the mass would simply fall downward due to the gravitational force mg. Because there is no motion, the gravitational force must be balanced by an upward force due to the presence of the spring. This upward force is usually assumed to obey Hooke's law which states that the restoring force is opposite to the direction of elongation and proportional to 142 Advanced Engineering Mathematics with MATLAB Figure 3.2.1: Various configurations of a mass/spring system. The spring alone has a length L which increases to L+s when the mass is attached. During simple harmonic motion, the length of the mass/spring system varies as L+s+x. the amount of elongation. Mathematically the equilibrium condition can be expressed mg=ks. Consider now what happens when we disturb this equilibrium. This may occur in one of two ways: We could move the mass either upward or downward and then release it. Another method would be to impart an initial velocity to the mass. In either case, the motion of the mass/spring system would be governed by Newton's second law which states that the acceleration of the mass equals the imbalance of the forces. If we denote the downward displacement of the mass from its equilibrium position by positive x, then (3.2.1) since ks=mg. After dividing (3.2.1) by the mass, we obtain the second-order differential equation (3.2.2) or (3.2.3) Higher-Order Ordinary Differential Equations 143 where 2=k/m and is the circular frequency. Equation (3.2.3) describes simple harmonic motion or free undamped motion. The two initial conditions associated with this differential equation are x(0)=a, x (0)= . (3.2.4) The first condition gives the initial amount of displacement while the second condition specifies the initial velocity. If >0 while <0, then the mass starts from a point below the equilibrium position with an initial upward velocity. On the other hand, if <0 with =0 the mass is at rest when it is released | | units above the equilibrium position. Similar considerations hold for other values of and . To solve (3.2.3), we note that the solutions of the auxiliary equation m2+ 2=0 are the complex numbers m1= i, and m2= i. Therefore, the general solution is x(t)=A cos( t)+B sin( t). (3.2.5) The (natural) period of free vibrations is T=2 / while the (natural) frequency is f=1/T= /(2 ). Example 3.2.1 Let us solve the initial-value problem (3.2.6) The physical interpretation is that we have pulled the mass on a spring down 10 units below the equilibrium position and then release it from rest at t=0. Here, =2 so that x(t)=A cos(2t)+B sin(2t) (3.2.7) from (3.2.5). Because x(0)=10, we find that x(0)=10=A1+B0 (3.2.8) 144 Advanced Engineering Mathematics with MATLAB so that A=10. Next, we note that (3.2.9) Therefore, at t=0, x (0)=0= 200+2B1 (3.2.10) and B=0. Thus, the equation of motion is x(t)=10 cos(2t). What is the physical interpretation of our equation of motion? Once the system is set into motion, it stays in motion with the mass oscillating back and forth 10 units above and below the equilibrium position x=0. The period of oscillation is 2 /2= units of time. Example 3.2.2 A weight of 45N stretches a spring 5cm. At time t=0, the weight is released from its equilibrium position with an upward velocity of 28cm s 1. Determine the displacement x(t) that describes the subsequent free motion. Higher-Order Ordinary Differential Equations 145 From Hooke's law, F=mg=45N=k 5cm (3.2.11) so that k=9N cm 1. Therefore, the differential equation is (3.2.12) The initial displacement and initial velocity are x(0)=0cm and x (0)= 28 cm s 1. The negative sign in the initial velocity reflects the fact that the weight has an initial velocity in the negative or upward direction. Because 2=196s 2 or =14s 1, the general solution to the differential equation is x(t)=A cos(14s 1t)+B sin(14s 1t). (3.2.13) Figure 3.2.2: Schematic of a floating body partially submerged in pure water. Substituting for the initial displacement x(0) in (3.2.13), we find that x(0)=0cm=A1+B0, (3.2.14) and A=0cm. Therefore, x(t)=B sin(14s 1t) (3.2.15) and 146 Advanced Engineering Mathematics with MATLAB x (t)=14s 1B cos(14s 1t) (3.2.16) Substituting for the initial velocity, x (0)= 28cm s 1=14s 1B, (3.2.17) and B= 2cm. Thus the equation of motion is x(t)= 2cm sin(14s 1t). (3.2.18) Example 3.2.3: Vibration of floating bodies Consider a solid cylinder of radius a that is partially submerged in a bath of pure water as shown in Figure 3.2.2. Let us find the motion of this cylinder in the vertical direction assuming that it remains in an upright position. If the displacement of the cylinder from its static equilibrium position is x, the weight of water displaced equals Ag x, where w is the density of the water and g is the gravitational acceleration. This is the restoring force according to the Archimedes principle. The mass of the cylinder is Ah , where is the density of cylinder. From second Newton's law, the equation of motion is Ahx +Ag w x=0, (3.2.19) or (3.2.20) From (3.2.20) we see that the cylinder will oscillate about its static equilibrium position x=0 with a frequency of (3.2.21) When both A and B are both nonzero, it is often useful to rewrite the homogeneous solution (3.2.5) as Higher-Order Ordinary Differential Equations 147 x(t)=C sin( t+ ) (3.2.22) to highlight the amplitude and phase of the oscillation. Upon employing the trigonometric angle-sum formula, (3.2.22) can be rewritten x(t)=C sin( t) cos( )+C cos( t) sin( )=A cos( t)+B sin( t). (3.2.23) From (3.2.23), we see that A=C sin( ) and B=C cos( ). Therefore, A2 +B2 = C2 sin2 ( )+C2 cos2 ( )=C2, (3.2.24) Similarly, tan( )=A/B. Because the tangent is positive in both the first and and third quadrants and negative in both the second and fourth quadrants, there are two possible choices for . The proper choice of satisfies the equations A=C sin( ) and B=C cos( ). If we prefer the amplitude/phase solution x(t)=C cos( t ), (3.2.25) we now have x(t)=C cos( t) cos( )+C sin ( t) sin( )=A cos( t)+B sin( t). (3.2.26) Consequently, A=C cos( ) and B=C sin( ). Once again, we obtain the other hand, tan( )=B/A. On Problems Solve the following initial-value problems and write their solutions in terms of amplitude and phase: 1. x +25x=0, x(0)=10, x (0)= 10 2. 4x +9x=0, x(0)=2 , x (0)=3 3. x + 2x=0, x(0)=1, 148 Advanced Engineering Mathematics with MATLAB 4. A 4-kg mass is suspended from a 100N/m spring. The mass is set in motion by giving it an initial downward velocity of 5m/s from its equilibrium position. Find the displacement as a function of time. 5. A spring hangs vertically. A weight of mass M kg stretches it L m. This weight is removed. A body weighing m kg is then attached and allowed to come to rest. It is then pulled down s0 m and released with a velocity 0. Find the displacement of the body from its point of rest and its velocity at any time t. 6. A particle of mass m moving in a straight line is repelled from the origin by a force F. (a) If the force is proportional to the distance from the origin, find the position of the where k is the proportionality constant and a is the distance from the origin, find the position of the particle as a function of time. What happens if m<1 and m=1? 3.3 DAMPED HARMONIC MOTION Free harmonic motion is unrealistic because there are always frictional forces which act to retard to retard motion. In mechanics, the drag is often modeled as a resistance that is proportional to the instantaneous velocity. Adopting this resistance law, it follows from Newton's second law that the harmonic oscillator is governed by particle as a function of time. (b) If the initial velocity of the particle is (3.3.1) where is a positive damping constant. The negative sign is necessary since this resistance acts in a direction opposite to the motion. Dividing (3.3.1) by the mass m, we obtain the differential equation of free damped motion, (3.3.2) or (3.3.3) We have written 2 rather than just because it simplifies future computations. The auxiliary equation is m2+2 m+ 2=0 which has the roots (3.3.4) Higher-Order Ordinary Differential Equations 149 2 From (3.3.4) we see that there are three possible cases which depend on the algebraic sign of 2 . Because all of the solutions contain the damping factor e t, >0, x(t) vanishes as t . is large compared to Case I: > Here the system is overdamped because the damping coefficient the spring constant k. The corresponding solution is (3.3.5) or (3.3.6) In this case the motion is smooth and nonoscillatory. Case II: = The system is critically damped because any slight decrease in the damping force would result in oscillatory motion. The general solution is (3.3.7) or x(t)=e t (A+Bt). (3.3.8) The motion is quite similar to that of an overdamped system. Case III: < In this case the system is underdamped because the damping coefficient is small compared to the spring constant. The roots m1 and m2 are complex: (3.3.9) The general solution now becomes (3.3.10) 150 Advanced Engineering Mathematics with MATLAB Equation (3.3.10) describes oscillatory motion which decays as e t. Equations (3.3.6), (3.3.8), and (3.3.10) are illustrated in Figure 3.3.1 when the initial conditions are x(0)=1 and x (0)=0. Just as we could write the solution for the simple harmonic motion in the amplitude/phase format, we can write any damped solution (3.3.10) in the alternative form (3.3.11) and the phase angle is given by tan ( )=A/B such that A=C where sin( ) and B=C cos( ). The coefficient Ce t is sometimes Figure 3.3.1: The displacement x(t) of a damped harmonic oscillator as a function of time and = / . called the damped coefficient of vibrations. Because (3.3.11) is not a periodic function, the quantity is called the quasi period and is the quasi frequency. The quasi period is the time interval between two successive maxima of x(t). Example 3.3.1 is attached to the end of a spring that is stretched 2m by a A body with mass force of 100N. Furthermore, there is also attached a dashpot4 that provides 6N of 4 A mechanical device--usually a piston that slides within a liquid-filled cylinder--used to damp the vibration or control the motion of a mechanism to which is attached. Higher-Order Ordinary Differential Equations 151 resistance for each m/s of velocity. If the mass is set in motion by further stretching the and giving it an upward velocity of 10m/s, let us find the subsequent motion. spring We begin by first computing the constants. The spring constant is k= (100N)/(2m)=50N/m. Therefore, the differential equation is (3.3.12) with and x (0)= 10m/s. Here the units of x(t) are meters. The characteristic or auxiliary equation is m2+12m+100=(m+6)2+64=0, (3.3.13) or m= 68i. Therefore, we have an underdamped harmonic oscillator and the general solution is x(t)=e 6t [A cos(8t)+B sin(8t)]. (3.3.14) Review of the Solution of the Underdamped Homogeneous Oscillator Problem mx + x +kx=0 subject to x(0)=x0, x (0) = v0 has the solution x(t)=Ae where the undamped natural frequency, = /(2m) is the damping factor, is the damped natural frequency, and the constants A and are determined by t sin ( d t+ ), 152 Advanced Engineering Mathematics with MATLAB and Consequently, each cycle takes 2 /8=0.79 second. This is longer than the 0.63 second that would occur if the system were undamped. From the initial conditions, (3.3.15) Therefore, and Consequently, (3.3.16) Example 3.3.2: Design of a wind vane In its simplest form a wind vane is a flat plate or airfoil that can rotate about a vertical shaft. See Figure 3.3.2. In static equilibrium it points into the wind. There is usually a counterweight to balance the vane about the vertical shaft. A vane uses a combination of the lift and drag forces on the vane to align itself with the wind. As the wind shifts direction from 0 to the new Higher-Order Ordinary Differential Equations 153 Figure 3.3.2: Schematic of a wind vane. The counterbalance is not shown. direction i , the direction in which the vane currently points is governed by the equation of motion5 (3.3.17) where I is the vane's moment of inertia, N is the aerodynamic torque per unit angle, and R is the distance from the axis of rotation to the effective center of the aerodynamic force on the vane. The aerodynamic torque is given by (3.3.18) where CL is the lift coefficient, is the air density, A is the vane area, and V is the wind speed. Dividing (3.3.17) by I, we obtain the second-order ordinary differential equation (3.3.19) The solution to (3.3.19) is (3.3.20) 5 For a derivation of (3.3.12) and (3.3.13), see subsection 2 of 3 in Barthelt, H.P, and G.H.Ruppersberg, 1957: Die mechanische Windfahne, eine theoretische und experimentelle Untersuchung. Beitr. Phys. Atmos., 29, 154185. 154 Advanced Engineering Mathematics with MATLAB where (3.3.21) and A and are the two arbitrary constants which would be determined by presently unspecified initial conditions. Consequently an ideal wind vane is a damped harmonic oscillator where the wind torque should be large and its moment of inertia should be small. Problems For the following values of m, , and k, find the position x(t) of a damped oscillator for the given initial conditions: 1. 2. m=1, =10, k=125, x(0)=3, x (0)=25 3. m=4, =20, k=169, x(0)=4, x (0)=16 4. For a fixed value of / , what is the minimum number of cycles required to produce a reduction of at least 50% in the maxima of a underdamped oscillator? 5. For what values of c does x +cx +4x=0 have critically damped solutions? 6. For what values of c are the motions governed by 4x +cx +9x=0 (a) overdamped, (b) underdamped, and (c) critically damped? 7. For an overdamped mass-spring system, prove that the mass can pass through its equilibrium position x=0 at most once. 3.4 METHOD OF UNDETERMINED COEFFICIENTS Homogeneous ordinary differential equations become nonhomogeneous when the right side of (3.0.1) is nonzero. How does this case differ from the homogeneous one that we have treated so far? To answer this question, let us begin by introducing a function yp(x)--called a particular solution--whose only requirement is that it satisfies the differential equation (3.4.1) Then, by direct substitution, it can be seen that the general solution to any nonhomogeneous, linear, ordinary differential equation is Higher-Order Ordinary Differential Equations 155 y(x)=yH(x)+yp(x), (3.4.2) where yH (x)--the homogeneous or complementary solution--satisfies (3.4.3) Why have we introduced this complementary solution because the particular solution already satisfies the ordinary differential equation? The purpose of the complementary solution is to introduce the arbitrary constants that any general solution of an ordinary differential equation must have. Thus, because we already know how to find yH(x), we must only invent a method for finding the particular solution to have our general solution. Example 3.4.1 Let us illustrate this technique with the second-order, linear, nonhomogeneous ordinary differential equation y 4y +4y =2e2x+4x12. Taking y(x)=yH(x)+yp(x), direction substitution yields (3.4.5) If we now require that the particular solution yp(x) satisfies the differential equation (3.4.6) (3.4.5) simplifies to the homogeneous ordinary differential equation (3.4.7) A quick check6 shows that the particular solution to (3.4.6) is yp(x)=x2e2x+ x 2. Using techniques from the previous section, the complementary solution is yH(x)=+C1e2x+C2xe2x. 6 (3.4.4) We will show how yp(x) was obtained momentarily. 156 Advanced Engineering Mathematics with MATLAB In general, finding yp(x) is a formidable task. In the case of constant coefficients, several techniques have been developed. The most commonly employed technique is called the method of undetermined coefficients which is used with linear, constant coefficient, ordinary differential equations when f(x) is a constant, a polynomial, an exponential function e x, sin( x), cos( x), or finite sum and products of these functions. Thus, this technique applies when the function f(x) equals ex sin(x) (3x2)e 2x but not when it equals ln(x). Why does this technique work? The reason lies in the set of functions that we have allowed to be included in f(x). They enjoy the remarkable property that derivatives of their sums and products yield sums and products that are also constants, polynomials, exponentials, sines, and cosines. Because a linear combination of derivatives such as must equal f(x), it seems reasonable to assume that yp(x) has the same form as f(x). The following examples show that our conjecture is correct. Example 3.4.2 Let us illustrate the method of undetermined coefficients by finding the particular solution to y 2y +y=x+sin(x) (3.4.8) by the method of undetermined coefficients. From the form of the right side of (3.4.8), we guess the particular solution yp(x)=Ax+B+C sin(x)+D cos(x). Therefore, (3.4.10) (3.4.9) and (3.4.11) Higher-Order Ordinary Differential Equations 157 Substituting into (3.4.8), we find that (3.4.12) Since (3.4.12) must be true for all x, the constant terms must sum to zero or B 2A=0. Similarly, all of the terms involving the polynomial x must balance, yielding A=1 and B=2A=2. Turning to the trigonometric terms, the coefficients of sin(x) and cos(x) give 2D=1 and 2C=0, respectively. Therefore, the particular solution is (3.4.13) and the general solution is (3.4.14) We can verify our result by using the symbolic toolbox in MATLAB. Typing the command: dsolve('D2y-2*Dy+y=x+sin(x)','x') yields ans = x+2+1/2*cos(x)+C1*exp(x)+C2*exp(x)*x Example 3.4.3 Let us find the particular solution to y +y 2y=xex (3.4.15) by the method of undetermined coefficients. From the form of the right side of (3.4.15), we guess the particular solution 158 Advanced Engineering Mathematics with MATLAB yp(x)=Axex+Bex. (3.4.16) Therefore, (3.4.17) and (3.4.18) Substituting into (3.4.15), we find that 3Aex=xex. (3.4.19) Clearly we cannot choose a constant A such that (3.4.19) is satisfied. What went wrong? To understand why, let us find the homogeneous or complementary solution to (3.4.15); it is yH(x)=C1e 2x +C2ex. (3.4.20) Therefore, one of the assumed particular solutions, Bex, is also a homogeneous solution and cannot possibly give a nonzero left side when substituted into the differential equation. Consequently, it would appear that the method of undetermined coefficients does not work when one of the terms on the right side is also a homogeneous solution. Before we give up, let us recall that we had a similar situation in the case of linear homogeneous second-order ordinary differential equations when the roots from the auxiliary equation were equal. There we found one of the homogeneous solution was We eventually found that the second solution was Could such a solution work here? Let us try. We begin by modifying (3.4.16) by multiplying it by x. Thus, our new guess for the particular solution reads yp(x)=Ax2ex+Bxex. (3.4.21) Higher-Order Ordinary Differential Equations 159 Then, (3.4.22) and (3.4.23) Substituting (3.4.21) into (3.4.15) gives (3.4.24) Grouping together terms that vary as xex, we find that 6A=1. Similarly, terms that vary as ex yield 2A+3B=0. Therefore, (3.4.25) so that the general solution is (3.4.26) In summary, the method of finding particular solutions to higher-order ordinary differential equations by the method of undetermined coefficients is as follows: G Step 1: Find the homogeneous solution to the differential equation. G Step 2: Make an initial guess at the particular solution. The form of yp(x) is a linear combination of all linearly independent functions that are generated by repeated differentiations of f(x). G Step 3: If any of the terms in yp(x) given in Step 2 duplicate any of the homogeneous solutions, then that particular term in yp(x) must be multiplied by xn, where n is the smallest positive integer that eliminates the duplication. 160 Advanced Engineering Mathematics with MATLAB Example 3.4.4 Let us apply the method of undetermined coefficients to solve y +y=sin(x) e3x cos(5x). (3.4.27) We begin by first finding the solution to the homogeneous version of (3.4.27): (3.4.28) Its solution is yH(x)=A cos(x)+B sin(x). (3.4.29) To find the particular solution we examine the right side of (3.4.27) or f(x)=sin(x) e3x cos(5x). (3.4.30) Taking a few derivatives of f(x), we find that f (x)=cos(x) 3e3x cos(5x)+5e3x sin(5x), (3.4.31) f (x)= sin(x) 9e3x cos(5x)+30e3x sin(5x)+25e3x cos(5x), (3.4.32) and so forth. Therefore, our guess at the particular solution is yp(x)=Cx sin(x)+Dx cos(x)+Ee3x cos(5x)+Fe3x sin(5x). (3.4.33) Why have we chosen x sin (x) and x cos (x) rather than sin (x) and cos (x)? Because sin(x) and cos(x) are homogeneous solutions to (3.4.27), we must multiply them by a power of x. Higher-Order Ordinary Differential Equations 161 Since (3.4.34) (3.4.35) =sin(x) e3x cos(5x). (3.4.36) Therefore, 2C=0, 2D=1, 30F 15E= 1, and 30E+15F=0. Solving this system of and Thus, the general solution is (3.4.37) equations yields C=0, Problems Use the method of undetermined coefficients to find the general solution of the following differential equations. Verify your solution by using dsolve in MATLAB. 1. y +4y +3y=x+1 2. y y=ex 2e 2x 3. y +2y +2y=2x2+2x+4 4. y +y =x2+x 5. y +2y =2x+5 e 2x 6. y 4y +4y=(x+1)e2x 7. y + 4y +4y=xex 8. y 4y=4sinh(2x) 9. y + 9y=x cos(3x) 10. y +y=sin(x)+x cos(x) 11. Solve y +2ay =sin2( x), y(0)=y (0)=0, by (a) the method of undetermined coefficients and (b) integrating the ordinary differential equation so that it reduces to and then using the techniques from the previous section to solve this first-order ordinary differential equation. 162 Advanced Engineering Mathematics with MATLAB 3.5 FORCED HARMONIC MOTION Let us now consider the situation when an external force f(t) acts on a vibrating mass on a spring. For example, f(t) could represent a driving force that periodically raises and lowers the support of the spring. The inclusion of f(t) in the formulation of Newton's second law yields the differential equation (3.5.1) (3.5.2) or (3.5.3) where F(t)=f(t)/m, 2 = /m, and 2=k/m. To solve this nonhomogeneous equation we will use the method of undetermined coefficients. Example 3.5.1 Let us find the solution to the nonhomogeneous differential equation y +2y +y=2 sin(t), (3.5.4) subject to the initial conditions y(0)=2 and y (0)=1. The homogeneous solution is easily found and equals yH(t)=Ae t+Bte t. (3.5.5) From the method of undetermined coefficients, we guess that the particular solution is Higher-Order Ordinary Differential Equations 163 yp(t)=C cos(t)+D sin(t), (3.5.6) so that (3.5.7) and (3.5.8) Substituting yp(t), and into (3.5.4) and simplifying, we find that 2C sin(t)+2D cos(t)=2 sin(t) (3.5.9) or D=0 and C= 1. To find A and B, we now apply the initial conditions on the general solution y(t)=Ae t+Bte t cos(t). (3.5.10) The initial condition y(0)=2 yields y(0)=A+0 1=2, (3.5.11) or A=3. The initial condition y (0)=1 gives y (0)= A+B=1, (3.5.12) or B=4, since 164 Advanced Engineering Mathematics with MATLAB y (t)= Ae t+Be t Bte t+sin(t). (3.5.13) Therefore, the solution which satisfies the differential equation and initial conditions is y(t)=3e t+4te t cos(t). (3.5.14) Example 3.5.2 Let us solve the differential equation for a weakly damped harmonic oscillator when the constant forcing F0 "turns on" at t=t0. The initial conditions are that x(0)=x0 and x (0)= 0. Mathematically, the problem is (3.5.15) with x(0)=x0 and x (0)= 0. To solve (3.5.15), we first divide the time domain into two regions: 0 < t <t0 and t0< t. For 0 < t < t0, x(t)=Ae t cos( d t)+Be t sin( d t), (3.5.16) where Upon applying the initial conditions, (3.5.17) as before. For the region t0 < t, we write the general solution as (3.5.18) Why have we written our solution in this particular form rather than the simpler Higher-Order Ordinary Differential Equations 165 (3.5.19) Both solutions satisfy the differential equation as direct substitution verifies. However, the algebra is greatly simplified when (3.5.18) rather than (3.5.19) is used in matching the solution from each region at t=t0. There both the solution and its first derivative must be continuous or (3.5.20) where and are points just below and above t0, respectively. When (3.5.17) and 2 (3.5.18) are substituted, we find that C= F0/ region t0< t is , and d D= C. Thus, the solution for the (3.5.21) As we will see in Chapter 6, the technique of Laplace transforms is particularly well suited for this type of problem when the forcing function changes abruptly at one or more times. As noted earlier, nonhomogeneous solutions consist of the homogeneous solution plus a particular solution. In the case of a damped harmonic oscillator, another, more physical, way of describing the solution involves its behavior at large time. That portion of the solution that eventually becomes negligible as t is often referred to as the transient term, or transient solution. In (3.5.14) the transient solution equals 3e t+4te t. On the other hand, the portion of the solution that remains as t is called the steadystate solution. In (3.5.14) the steady-state solution equals--cos(t). One of the most interesting forced oscillator problems occurs when =0 and the forcing function equals F0 sin( 0t), where F0 is a constant. Then the initial-value problem becomes (3.5.22) 166 Advanced Engineering Mathematics with MATLAB Review of the Solution of the Forced Harmonic Oscillator Problem The undamped system mx +kx=F0 cos( 0t) subject to the initial conditions x(0)=x0 and x'(0)=v0 has the solution where f0=F0/m and +kx=F0 cos( 0 The underdamped system mx + x t) has the steady-state solution where 2 = /m. Let us solve this problem when x(0)=x (0)=0. The homogeneous solution to (3.5.22) is xH(t)=A cos( t)+B sin( t). (3.5.23) To obtain the particular solution, we assume that xp(t)=C cos( 0 t)+D sin( 0 t). (3.5.24) This leads to (3.5.25) (3.5.26) and (3.5.27) Higher-Order Ordinary Differential Equations 167 We immediately conclude that and Therefore, (3.5.28) provided that 0 . Thus, (3.5.29) Figure 3.5.1: The solution (3.5.31) as a function of time when equals (a) 1.02, (b) 1.2, and (c) 2. =1and 0 To finish the problem, we must apply the initial conditions to the general solution (3.5.30) From x(0)=0, we find that A=0. On the other hand, x (0)=0 yields Thus, the final result is (3.5.31) 168 Advanced Engineering Mathematics with MATLAB Equation (3.5.31) is illustrated in Figure 3.5.1 as a function of time. The most arresting feature in Figure 3.5.1 is the evolution of the uniform amplitude of the oscillation shown in frame (c) into the one shown in frame (a) where the amplitude exhibits a sinusoidal variation as 0 . In acoustics these fluctuations in the amplitude are called beats, the loud sounds corresponding to the larger amplitudes. As our analysis indicates, (3.5.31) does not apply when = 0. As we shall shortly see, this is probably the most interesting configuration. We can use (3.5.31) to examine this case by applying L'Hpital's rule in the limiting case of 0 . This limiting process is analogous to "tuning in" the frequency of the driving frequency [ 0 /(2 )] to the frequency of free vibrations [ /(2 )]. From experience, we expect that given enough time we should be able to substantially increase the amplitudes of vibrations. Mathematical confirmation of our physical intuition is as follows: (3.5.32) (3.5.33) (3.5.34) (3.5.35) (3.5.36) As we suspected, as t , the displacement grows without bounds. This phenomenon is known as pure resonance. We could also have obtained (3.5.36) directly using the method of undetermined coefficients involving the initial value problem (3.5.37) Because there is almost always some friction, pure resonance rarely occurs and the more realistic differential equation is Higher-Order Ordinary Differential Equations 169 (3.5.38) Its solution is (3.5.39) where (3.5.40) (3.5.41) and C and are determined by the initial conditions. To illustrate (3.5.39) we rewrite the amplitude and phase of the particular solution as (3.5.42) and (3.5.43) 170 Advanced Engineering Mathematics with MATLAB Figure 3.5.2: The amplitude of the particular solution (3.5.39) for a forced, damped simple harmonic oscillator (normalized with F0/ 2) as a function of r= 0/ . where r= 0 / and = / . Figures 3.5.2 and 3.5.3 graph (3.5.42) and (3.5.43) as functions of r for various values of . Example 3.5.3: Electrical circuits In the previous chapter, we saw how the mathematical analysis of electrical circuits yields firstorder linear differential equations. In those cases we only had a resistor and capacitor or a resistor and inductor. One of the fundamental problems of electrical circuits is a circuit where a resistor, capacitor, and inductor are connected in series, as shown in Figure 3.5.4. In this RCL circuit, an instantaneous current flows when the key or switch K is closed. If Q(t) denotes the instantaneous charge on the capacitor, Kirchhoff's law yields the differential equation (3.5.44) where E(t), the electromotive force, may depend on time, but where L, R, and C are constant. Because I=dQ/dt, (3.5.44) becomes (3.5.45) Consider now the case when resistance is negligibly small. Equation (3.5.45) will become Higher-Order Ordinary Differential Equations 171 identical to the differential equation for the forced simple harmonic oscillator, (3.5.3), with =0. Similarly, the general case yields various analogs to the damped harmonic oscillator: Case 1 Case 2 Case 3 Overdamped Critically damped Underdamped R2 > 4L/C R2 = 4L/C R2 < 4L/C Figure 3.5.3: The phase of the particular solution (3.5.39) for a forced, damped simple harmonic oscillator as a function of r= 0/ . In each of these three cases, Q(t) 0 as t . (See Problem 6.) Therefore, an RLC electrical circuit behaves like a damped mass-spring mechanical system, where inductance acts like mass, resistance is the damping coefficient, and 1/C is the spring constant. Problems 1. Find the values of so that x +6x +18=cos( t) is in resonance. 2. The differential equation x +2x +2x=10sin(2t) describes a damped, forced oscillator. If the initial conditions are x(0)=x0 and x (0)=0, find its solution by hand and by using MATLAB. Plot the solution when x0= 10, 9,..., 9, 10. Give a physical interpretation to what you observe. 3. At time t=0, a mass m is suddenly attached to the end of a hanging spring with a spring constant k. Neglecting friction, find the subsequent motion if the coordinate system is chosen so that x(0)=0. Step 1: Show that the differential equation is 172 Advanced Engineering Mathematics with MATLAB with the initial conditions x(0)=x (0)=0. Figure 3.5.4: A simple electrical circuit containing a resistor of constant resistance R, capacitor of constant capacitance C, and inductor of constant inductance L driven by a time-dependent electromotive force E(t). Step 2: Show that the solution to Step 1 is x(t)=mg[1 cos( t)]/k, 2 =k/m. 4. Consider the electrical circuit shown in Figure 3.5.4 which now possesses negligible resistance and has an applied voltage E(t)=E0[1 cos( t)]. Find the current if the circuit is initially dead. 5. Find the general solution to the differential equation governing a forced, damped harmonic equation mx +cx +kx=F0 sin( t), where m, c, k, F0, and are constants. Write the particular solution in amplitude/phase if R, C, and L format. 6. Prove that the transient solution to (3.5.45) tends to zero as t are greater than zero. 3.6 VARIATION OF PARAMETERS As the previous section has shown, the method of undetermined coefficients can be used when the right side of the differential equation contains constants, polynomials, exponentials, sines, and cosines. On the other hand, when the right side contains terms other than these, variation of parameters provides a method for finding the particular solution. Higher-Order Ordinary Differential Equations 173 To understand this technique, let us return to our solution of the firstorder ordinarydifferential equation (3.6.1) Its solution is (3.6.2) The solution (3.6.2) consists of two parts: The first term is the homogeneous solution and can be written yH(x)=C1y1(x), where y1(x)=e p(x)dx. The second term is the particular solution and equals the product of some function of x, say u1(x), times y1(x): (3.6.3) This particular solution bears a striking resemblance to the homogeneous solution if we replace u1(x) with C1. Variation of parameters builds upon this observation by using the homogeneous solution y1(x) to construct a guess for the particular solution yp(x)=u1(x)y1(x). Upon substituting this guessed yp(x) into (3.6.1), we have that (3.6.4) (3.6.5) or (3.6.6) since Using the technique of separating the variables, we have that 174 Advanced Engineering Mathematics with MATLAB (3.6.7) Consequently, the particular solution equals (3.6.8) Upon substituting for y1(x), we obtain (3.6.3). How do we apply this method to the linear second-order differential equation a2(x)y + 1y (x)+ 0(x)y=g(x), (3.6.9) or y +P(x)y +Q(x)y=f(x), (3.6.10) where P(x), Q(x), and f(x) are continuous on some interval I? Let y1(x) and y2(0:) denote the homogeneous solutions of (3.6.10). That is, y1(x) and y2(x) satisfy (3.6.11) and (3.6.12) Following our previous example, we now seek two function u1(x) and u2(x) such that yp(x)=u1(x)y1(x)+u2(x)y2(x) (3.6.13) is a particular solution of (3.6.10). Once again, we replaced our arbitrary constants C1 and C2 by the "variable parameters" u1(x) and u2(x). Because we have two unknown Higher-Order Ordinary Differential Equations 175 functions, we require two equations to solve for u1(x) and u2(x). One of them follows from substituting yp(x)=u1(x)y1(x)+ u2(x)y2(x) into (3.6.10). The other equation is (3.6.14) This equation is an assumption that is made to simplify the first and second derivative which is clearly seen by computing (3.6.15) after applying (3.6.14). Continuing to the second derivative, (3.6.16) Substituting these results into (3.6.10), we obtain (3.6.17) (3.6.18) Hence, u1(x) and u2(x) must be functions that also satisfy the condition (3.6.19) It is important to note that the differential equation must be written so that it conforms to (3.6.10). This may require the division of the differential equation by a2(x) so that you have the correct f(x). Equation (3.6.14) and (3.6.19) constitute a linear system of equations for determining the unknown derivatives (3.6.19) equal 7 and By Cramer's rule,7 the solutions of (3.6.14) and If you are unfamiliar with Cramer's rule, see 14.3. 176 Advanced Engineering Mathematics with MATLAB (3.6.20) where (3.6.21) The determinant W is the Wronskian of y1 and y2. Because y1 and y2 are linearly independent on I, the Wronskian will never equal to zero for every x in the interval. These results can be generalized to any nonhomogeneous, nth-order, linear equation of the form y(n)+Pn 1(x)y(n 1) +P1(x)y +P0(x)=f(x). (3.6.22) If yH(x)=C1y1(x)+C2y2(x)+...+Cnyn(x) is the complementary function for (3.6.22), then a particular solution is yp(x)=u1(x)y1(x)+u2(x)y2(x)+...+un(x)yn(x), (3.6.23) where the k=1, 2,..., n, are determined by the n equations: (3.6.24) (3.6.25) (3.6.26) The first n 1 equations in this system, like (3.6.14), are assumptions made to simplify the Higher-Order Ordinary Differential Equations 177 first n 1 derivatives of yp(x). The last equation of the system results from substituting the n derivative of yp(x) and the simplified lower derivatives into (3.6.22). Then, by Cramer's rule, we find that (3.6.27) where W is the Wronskian of y1, y2,..., yn, and Wk is the determinant obtained by replacing the kth column of the Wronskian by the column [0, 0, 0, ..., f(x)]T. Example 3.6.1 Let us apply variation of parameters to find the general solution to y +y 2y=xex. (3.6.28) We begin by first finding the homogeneous solution which satisfies the differential equation (3.6.29) Applying the techniques from 3.1, the homogeneous solution is yH(x)=Aex+Be 2x , (3.6.30) yielding the two independent solutions y1(x)=ex, and y2(x)=e variation of parameters yields the particular solution yp(x)=exu1(x)+e 2x 2x . Thus, the method of u2(x). (3.6.31) From (3.6.14), we have that (3.6.32) 178 Advanced Engineering Mathematics with MATLAB while (3.6.33) Solving for (x) and (x), we find that (3.6.34) or (3.6.35) and (3.6.36) or (3.6.37) Therefore, the general solution is y(x)=Aex+Be 2x +exu1(x)+e 2x u2(x) (3.6.38) (3.6.39) (3.6.40) Higher-Order Ordinary Differential Equations 179 Example 3.6.2 Let us find the general solution to y +2y +y=e x ln(x) (3.6.41) by variation of parameters on the interval (0, ). We start by finding the homogeneous solution which satisfies the differential equation (3.6.42) Applying the techniques from 3.1, the homogeneous solution is yH(x)=Ae x+Bxe x, (3.6.43) yielding the two independent solutions y1(x)=e solution equals x and y2(x)=xe x. Thus, the particular yp(x)=e xu1(x)+xe xu2(x). (3.6.44) From (3.6.14), we have that (3.6.45) while (3.6.46) Solving for and we find that (3.6.47) 180 Advanced Engineering Mathematics with MATLAB or (3.6.48) and (3.6.49) or u2(x)=x ln(x) x. (3.6.50) Therefore, the general solution is y(x)=Ae x+Bxe x+e xu1(x)+xe xu2(x) (3.6.51) (3.6.52) We can verify our result by using the symbolic toolbox in MATLAB. Typing the command: dsolve('D2y+2*Dy+y=exp(-x)*log(x)','x') yields ans = 1/2*exp(-x)*x2*log(x)-3/4*exp(-x)*x2+C1*exp(-x)+C2*exp(-x)*x Example 3.6.3 So far, all of our examples have yielded closed form solutions. To show that this is not necessarily so, let us solve y 4y=e2x/x (3.6.53) by variation of parameters. Higher-Order Ordinary Differential Equations 181 Again we begin by solving the homogeneous differential equation (3.6.54) which has the solution yH(x)=Ae2x+Be 2x . (3.6.55) Thus, our two independent solutions are y1(x)=e2x and y2(x)=e Therefore, the particular solution equals yp(x)=e2xu1(x)+e 2x 2x . u2(x). (3.6.56) From (3.6.14), we have that (3.6.57) while (3.6.58) Solving for and we find that (3.6.59) or (3.6.60) and 182 Advanced Engineering Mathematics with MATLAB (3.6.61) or (3.6.62) Therefore, the general solution is y(x)=Ae2x+Be 2x +e2xu1(x)+e 2x u2(x) (3.6.63) (3.6.64) Problems Use variation of parameters to find the general solution for the following differential equations. Then see if you can obtain your solution by using dsolve in MATLAB. 1. y 4y +3y=e x 2. y y 2y=x 3. y 4y=xex 4. y +9y=2sec(x) 5. y +4y +4y=xe 2x 6. y +2ay =sin2( x) 7. y 4y +4y=(x+1)e2x 8. y 4y=sin2(x) 9. y 2y +y=ex/x 10. y +y=tan(x) 3.7 EULER-CAUCHY EQUATION The Euler-Cauchy or equidimensional equation is a linear differential equation of the form (3.7.1) Higher-Order Ordinary Differential Equations 183 where an, n 1 ,..., a0 are constants. The important point here is that in each term the power to which x is raised equals the order of differentiation. To illustrate this equation, we will focus on the homogeneous, secondorder, ordinary differential equation (3.7.2) The solution of higher-order ordinary differential equations follows by analog. If we wish to solve the nonhomogeneous equation (3.7.3) we can do so by applying variation of parameters using the complementary solutions that satisfy (3.7.2). Our analysis starts by trying a solution of the form y=xm, where m is presently undetermined. The first and second derivatives are (3.7.4) respectively. Consequently, substitution yields the differential equation (3.7.5) =am(m 1)xm+bmxm+cxm (3.7.6) =[ m(m 1)+bm+c]xm. (3.7.7) Thus, y=xm is a solution of the differential equation whenever m is a solution of the auxiliary equation am(m 1)+bm+c=0, or am2+(b a)m+c=0. (3.7.8) 184 Advanced Engineering Mathematics with MATLAB At this point we must consider three different cases which depend upon the values of a, b, and c. Distinct real roots Let m1 and m2 denote the real roots of (3.7.8) such that m1 m2. Then, (3.7.9) are homogeneous solutions to (3.7.2). Therefore, the general solution is (3.7.10) Repeated real roots If the roots of (3.7.8) are repeated [m1=m2= (b a)/2], then we presently have only one solution, To construct the second solution y2, we use reduction in order. We begin by first rewriting the Euler-Cauchy equation as (3.7.11) Letting P(x)=b/(ax), we have (3.7.12) (3.7.13) (3.7.14) The general solution is then Higher-Order Ordinary Differential Equations 185 (3.7.15) For higher-order equations, if m1 is a root of multiplicity k, then it can be shown that are the k linearly independent solutions. Therefore, the general solution of the differential equation equals a linear combination of these k solutions. Conjugate complex roots If the roots of (3.7.8) are the complex conjugate pair m1= +i , and m2= and are real and >0, then a solution is y(x)=C1x +i i , where +C2xa i . (3.7.16) However, because xi =[eln(x)]i =ei ln(x) , we have by Euler's formula (3.7.17) xi =cos[ ln(x)]+i sin [ ln (x)], and x i =cos [ ln(x)] i sin [ ln(x)], (3.7.18) Substitution into (3.7.16) leads to y(x)=C3x cos [ ln(x)]+C4x sin [ ln(x)], (3.7.19) where C3=C1+C2, and C4=iC1 iC2. Example 3.7.1 Let us find the general solution to 186 Advanced Engineering Mathematics with MATLAB x2y +5xy 12y=ln(x) (3.7.20) by the method of undetermined coefficients and variation of parameters. In the case of undetermined coefficients, we begin by letting t=ln(x) and y(x)=Y(t). Substituting these variables into (3.7.20), we find that Y +4Y 12Y=t. (3.7.21) The homogeneous solution to (3.7.21) is YH(t)=A e 6t +B e2t, (3.7.22) while the particular solution is Yp(t)=Ct+D (3.7.23) from the method of undetermined coefficients. Substituting (3.7.23) into (3.7.21) yields and Therefore, (3.7.24) or (3.7.25) To find the particular solution via variation of parameters, we use the homogeneous solution (3.7.26) Higher-Order Ordinary Differential Equations 187 to obtain y1(x)=x 6 and y2(x)=x2. Therefore, yp(x)=x 6u1(x)+x2u2(x). (3.7.27) Substitution of (3.7.27) in (3.7.20) yields the system of equations: (3.7.28) and (3.7.29) Solving for and (3.7.30) The solutions of these equations are (3.7.31) and (3.7.32) The general solution then equals (3.7.33) We can verify this result by using the symbolic toolbox in MATLAB. Typing the command: 188 Advanced Engineering Mathematics with MATLAB yields Problems Find the general solution for the following Euler-Cauchy equations valid over the domain ( , ). Then check your answer by using dsolve in MATLAB. 1. x2y +xy y=0 2. x2y +2xy 2y=0 3. x2y 2y=0 4. x2y xy +y=0 5. x2y +3xy +y=0 6. x2y 3xy +4y=0 7. x2y y +5y=0 8. 4x2y +8xy +5y=0 9. x2y +xy +y=0 10. x2y 3xy +13y=0 11. x2y 2x2y 2xy +8y=0 12. x2y 2xy 4y=x 3.8 PHASE DIAGRAMS In 2.6 we showed how solutions to first-order ordinary differential equations could be qualitatively solved through the use of the phase line. This concept of qualitatively studying differential equations showed promise as a method for deducing many of the characteristics of the solution to a differential equation without actually solving it. In this section we extend these concepts to second-order ordinary differential equations by introducing the phase plane. Consider the differential equation x +sgn(x)=0, (3.8.1) where the signum function is defined by (5.2.11). Equation (3.8.1) describes, for example, the motion of an infinitesimal ball rolling in a "V" shaped trough in a constant gravitational field.8 Our analysis begins by introducing the new dependent variable v=x so that (3.8.1) can be written 8 See Lipscomb, T., and R.E.Mickens, 1994: Exact solution to the axisymmetric, constant force oscillator equation. J. Sound Vibr., 169, 138140. Higher-Order Ordinary Differential Equations 189 (3.8.2) since (3.8.3) Figure 3.8.1: Phase diagram for the differential equation (3.8.1). Equation (3.8.2) relates v to x and t has disappeared explicitly from the problem. Integrating (3.8.2) with respect to x, we obtain (3.8.4) or (3.8.5) Equation (3.8.5) expresses conservation of energy because the first term on the left side of (3.8.5) is kinetic energy while the second term is the potential energy. The value of C 190 Advanced Engineering Mathematics with MATLAB depends upon the initial condition x(0) and (0). Thus, for a specific initial condition, (3.8.5) gives the relationship between x and for the motion corresponding to the initial condition. Although there is a closed-form solution for (3.8.1), let us imagine that there is none. What could we learn from (3.8.5)? Equation (3.8.5) can be represented in a diagram, called a phase plane, where x and v are its axes. A given pair of (x, v) is called a state of the system. A given state determines all subsequent states because it serves as initial conditions for any subsequent motion. For each different value of C, we will obtain a curve, commonly known as phase paths, trajectories, or integral curves, on the phase plane. In Figure 3.8.1, we used the MATLAB script clear % set up grid points in the (x, v) plane [x, v] = meshgrid(-5:0.5:5,-5:0.5:5); % compute slopes dxdt = v; dvdt = -sign(x); % find magnitude of vector [dxdt,dydt] L = sqrt(dxdt.*dxdt + dvdt.*dvdt); % plot scaled vectors quiver(x,v,dxdt./L,dvdt./L,0.5); axis equal tight hold % contour trajectories contour(x,v,v.*v/2 + abs(x),8) h = findobj('Type','patch'); set(h,'Linewidth',2); xlabel('x','Fontsize',20); ylabel('v','Fontsize',20) to graph the phase plane for (3.8.1). Here the phase paths are simply closed, oval shaped curves which are symmetric with respect to both the x and phase space axes. Each phase path corresponds to a particular possible motion of the system. Associated with each path is a direction, indicated by an arrow, showing how the state of the system changes as time increases. An interesting feature on Figure 3.8.1 is the point (0, 0). What is happening there? In our discussion of phase line, we sought to determine whether there were any equilibrium or critical points. Recall that at an equilibrium or critical point the solution is constant and was given by x =0. In the case of second-order differential equations, we again have the condition x = =0. For this reason equilibrium points are always situated on the abscissa of the phase diagram. The condition x =0 is insufficient for determining critical points. For example, when a ball is thrown upward, its velocity equals zero at the peak height. However, this is clearly not a point of equilibrium. Consequently, we must impose the additional constraint that x = =0. In the present example, equilibrium points occur where x = =0 and = sgn(x)=0 or x=0. Therefore, the point (0,0) is the critical point for (3.8.1). The closed curves immediately surrounding the origin in Figure 3.8.1 show that we have periodic solutions there because on completing a circuit, the original state returns and the motion simply repeats itself indefinitely. Once we have found an equilibrium point, an obvious question is whether it is stable or not. To determine this, consider what happens if the initial state is displaced slightly from Higher-Order Ordinary Differential Equations 191 the origin. It lands on one of the nearby closed curves and the particle oscillates with small amplitude about the origin. Thus, this critical point is stable. In the following examples, we further illustrate the details that may be gleaned from a phase diagram. Example 3.8.1 The equation describing a simple pendulum is ma2 +mga sin( )=0, (3.8.6) Figure 3.8.2: Phase diagram for a simple pendulum. where m denotes the mass of the bob, a is the length of the rod or light string, and g is the acceleration due to gravity. Here the conservation of energy equation is (3.8.7) Figure 3.8.2 is the phase diagram for the simple pendulum Some of the critical points are . located at =2n , n=0, 1, 2,..., and =0. Near these critical points, we have closed patterns surrounding these critical points, just as we did in the earlier case of an infinitesimal ball rolling in a "V" shaped trough. Once again, these critical points are stable and the region around these equilibrium points corresponds to a pendulum swinging to and fro about the vertical. On the other hand, there is a new type of critical point at =(2n 1) , n=0, 1, 2,... and =0. Here the trajectories form hyperbolas near these equilibrium points. Thus, for any initial state that is near these critical points we have solutions that move away from the equilibrium point. This is an example of an unstable critical point. Physically these critical points correspond to a pendulum that is balanced on end. Any displacement from the equilibrium results in the bob falling from the inverted position. Finally, we have a wavy line as . This corresponds to whirling motions of the pendulum where has the same sign and continuously increases or decreases. 192 Advanced Engineering Mathematics with MATLAB Example 3.8.2: Damped harmonic oscillator Consider the ordinary differential equation x +2x +5x=0. (3.8.8) The exact solution to this differential equation is x(t)=e t [A cos(2t)+B sin(2t)], (3.8.9) and x (t)=2e t [B cos(2t) A sin(2t)] e t [A cos(2t)+B sin(2t)]. (3.8.10) Figure 3.8.3: Phase diagram for the damped harmonic oscillator (3.8.8). To construct its phase diagram, we again define =x and replace (3.8.8) with The MATLAB script clear % set up grid points in the x, x' plane = 2 5x. Higher-Order Ordinary Differential Equations 193 [x, v] = meshgrid (-3:0.5:3,-3:0.5:3); % compute slopes dxdt = v; dvdt = -2*v - 5*x; % find length of vector L = sqrt (dxdt.*dxdt + dvdt.*dvdt); % plot direction field quiver (x, v, dxdt./L, dvdt./L,0.5); axis equa tight l hold % compute x(t) and v(t) at various times and a's and b's for b = -3:2:3; for a = -3:2:3; t = [-5:0.1:5]; xx = exp(-t).* (a*cos(2*t) + b*sin(2*t)); vv = 2 * exp(-t).* (b*cos(2*t) - a*sin(2*t)) - xx; % plot these values plot(xx,vv) end; end; xlabel ('x','Fontsize',20); ylabel ('v','Fontsize', 20) was used to construct the phase diagram for (3.8.8) and is shown in Figure 3.8.3. Here the equilibrium point is at x= =0. This is a new type of critical point. It is called a stable node because all slight displacements from this critical point eventually return to this equilibrium point. Problems 1. Using MATLAB, construct the phase diagram for x 3x +2x=0. What happens around the point x= =0? 2. Consider the nonlinear differential equation x =x3 x. This equation arises in the study of simple pendulums with swings of moderate amplitude. (a) Show that the conservation law is What is special about C=0 and (b) Show that there are three critical points: x=0 and x=1 with =0. (c) Using MATLAB, graph the phase diagram with axes x and . For the following ordinary differential equations, find the equilibrium points and then classify them. Use MATLAB to draw the phase diagrams. 3. x =2x 4. x +sgn(x)x=0 5. 3.9 NUMERICAL METHODS When differential equations cannot be integrated in closed form, numerical methods must be employed. In the finite difference method, the discrete variable xi or ti replaces the 194 Advanced Engineering Mathematics with MATLAB continuous variable x or t and the differential equation is solved progressively in increments h starting from known initial conditions. The solution is approximate, but with a sufficiently small increment, you can obtain a solution of acceptable accuracy. Although there are many different finite difference schemes available, we consider here only two methods that are chosen for their simplicity. The interested student may read any number of texts on numerical analysis if he or she wishes a wider view of other possible schemes. Let us focus on second-order differential equations; the solution of higherorder differential equations follows by analog. In the case of second-order ordinary differential equations, the differential equation can be rewritten as x =f(x, x , t), x0=x(0), x 0=x (0), (3.9.1) where the initial conditions x0 and are assumed to be known. For the present moment, let us treat the second-order ordinary differential equation (3.9.2) The following scheme, known as the central difference method, computes the solution from Taylor expansions at xi+1 and xi 1: (3.9.3) and (3.9.4) where h denotes the time interval t. Subtracting and ignoring higher-order terms, we obtain (3.9.5) Adding (3.9.3) and (3.9.4) yields Higher-Order Ordinary Differential Equations 195 (3.9.6) In both (3.9.5) and (3.9.6) we ignored terms of O(h2). After substituting into the differential equation (3.9.2), (3.9.6) can be rearranged to xi+1=2xi xi 1+h2f(xi, ti), i>1, (3.9.7) which is known as the recurrence formula. Consider now the situation when i=0. We note that although we have x0 we do not have x 1 Thus, to start the computation, we need another equation for x1. This is supplied by (3.9.3) which gives (3.9.8) Once we have computed x1, then we can switch to (3.9.6) for all subsequent calculations. In this development we have ignored higher-order terms that introduce what is known as truncation errors. Other errors, such as round-off errors, are introduced due to loss of significant figures. These errors are all related to the time increment h in a rather complicated manner that are investigated in numerical analysis books. In general, better accuracy is obtained by choosing a smaller h, but the number of computations will then increase together with errors. Example 3.9.1 Let us solve x 4x=2t subject to x(0)=x (0)=1. The exact solution is (3.9.9) The MATLAB script clear % test out different time steps for i = 1:3 % set up time step increment and number of time steps h = 1/10. i; n = 10/h; % set up initial conditions t=zeros(n+1,1); t(1) = 0; x(1) = 1; x_exact(1) = 1; 196 Advanced Engineering Mathematics with MATLAB % define right side of differential equation f = inline('4*xx+2*tt','tt','xx'); % set up difference arrays for plotting purposes diff = zeros(n,1); t_plot = zeros(n,1); % compute first time step t(2) = t(1) + h; x(2) = x(1) + h + 0.5*h*h*f(t(1), x(1)); x_exact(2) = (7/8)*exp(2*t (2)) +(1/8)*exp(-2*t(2))-t(2)/2; t_plot(1) = t(2); diff (1) = x(2)- x_exact(2); diff (1)= abs(diff (1)/ x.exact(2)); % compute the remaining time steps for k = 2:n t (k+1) = t (k) + h; t_plot(k) = t (k+1); x(k+1) = 2*x(k) x(k-1) + h*h*f (t (k),x (k)); x_exact (k+1) = (7/8)*exp (2*t ( k+1)) + (1/8)*exp (-2*t (k+1)) ... -t (k+1)/2; diff(k) = x(k+1) x_exact(k+1); diff(k) = abs(diff(k) / x_exact(k+1)); end % plot the relative error semilogy (t_plot, diff f,' -') hold on num = 0.2*n; text (3*i, diff (num) ['h = ', num2str(h)],'Fontsize', 15,... , 'HorizontalAlignment', 'right','VerticalAlignment' , 'bottom') xlabel ('TIME','Fontsize',20); ylabel ('|RELATIVE ERROR|','Fontsize',20); end implements our simple finite difference method of solving a second-order ordinary differential equation. In Figure 3.9.1 we have plotted results for three different values of the time step. As our analysis suggests, the relative error is related to h2. An alternative method for integrating higher-order ordinary differential equations is Runge-Kutta. It is popular because it is self-starting and the results are very accurate. Figure 3.9.1: The numerical solution of x 4x=2t when x(0)=x (0)=1 using a simple finite difference approach. Higher-Order Ordinary Differential Equations 197 For second-order ordinary differential equations this method first reduces the differential equation into two first-order equations. For example, the differential equation (3.9.10) becomes the first-order differential equations x =y, y =F(x,y,t). (3.9.11) The Runge-Kutta procedure can then be applied to each of these equations. Using a fourth-order scheme, the procedure is as follows: (3.9.12) and (3.9.13) where k1=yi, K1=F(xi, yi, ti), (3.9.14) (3.9.15) (3.9.16) 198 Advanced Engineering Mathematics with MATLAB and (3.9.17) k4=yi+K3h, K4=F(xi+hk3, k4, ti+h). Example 3.9.2 The MATLAB script clear % test out different time steps for i = 1:4 % set up time step increment and number of time steps if i==1 h = 0.50; end ; if i==2 h = 0.10; end; if i==3 h = 0.05; end; if i= =4 h = 0.01; end; n = 10/h; % set up initial conditions t=zeros (n+1,1); t (1) = 0; x_rk=zeros (n+1,1); x_rk(1) = 1; y_rk=zeros (n+1,1); y_rk(1) = 1; x_exact=zeros(n+1,1); x_exact(1) = 1; % set up difference arrays for plotting purposes t_plot = zeros (n,1); diff = zeros (n,1); % define right side of differential equation f = inline ('4*xx+2*tt','tt>, xx','yy'); for k = 1:n t_local = t(k); x_local = x_rk(k); y_local = y_rk(k); k1 = y_local; K1 = f (t_local,x_local,y_local) ; k2 = y_local + h*K1/2; K2 = f(t_local + h/2,x_local + h*k1/2,k2); k3 = y_local + h*K2/2; K3 = f(t_local + h/2,x_local + h*k2/2,k3); k4 = y_local + h*K3; K4 = f(t.local + h,x_local + h*k3,k4); t(k+1) = t_local + h; x_rk(k+1) = x_local + (h/6) * (k1+2*k2+2*k3+k4); y_rk(k+1) = y_local + (h/6) * (K1+2*K2+2*K3+K4); x_exact(k+1) = (7/8)*exp (2*t (k +1))+(1/8)*exp(-2*t(k+1))... - t(k+1)/2; t_plot(k) = t(k); diff (k) = x_rk(k+1) - x_exact(k+1); diff (k) = abs (diff (k)/x_exact(k+1)); end % plot the relative errors semilogy (t_plot, diff f, '-') hold on xlabel('TIME','Fontsize ',20); ylabel' I RELATIVE ERROR| ' , ' Fontsize' ,20); text (2*i,diff (0.2*n),['h=',num2str(h)],'Fontsize',15,... HorizontalAlignment','right','VerticalAlignment','bottom') end Higher-Order Ordinary Differential Equations 199 Figure 3.9.2: The numerical solution of x 4x=2t when x(0)=x (0)=1 using Runge-Kutta method. was used to resolve Example 3.9.1 using the Runge-Kutta approach. Figure 3.9.2 illustrates the results for time steps of various size. Problems In previous sections, you found exact solutions to second-order ordinary differential equations. Confirm these earlier results by using MATLAB and the Runge-Kutta scheme to find the numerical solution to the following problems drawn from previous sections. 1. 2. 3. 4. 5. 6. 3.1, Problem 1 3.1, Problem 5 3.4, Problem 1 3.4, Problem 5 3.6, Problem 1 3.6, Problem 5 Chapter 4 Fourier Series Fourier series arose during the eighteenth century as a formal solution to the classic wave equation. Later on, it was used to describe physical processes in which events recur in a regular pattern. For example, a musical note usually consists of a simple note, called the fundamental, and a series of auxiliary vibrations, called overtones. Fourier's theorem provides the mathematical language which allows us to precisely describe this complex structure. 4.1 FOURIER SERIES One of the crowning glories1 of nineteenth century mathematics was the discovery that the infinite series (4.1.1) can represent a function f(t) under certain general conditions. This series, called a Fourier series, converges to the value of the function f(t) at every point in the interval [ L, L] with the possible exceptions of the points at any discontinuities and the endpoints of the interval. Because each term has a period of 2L, the sum of the series also has the same period. The fundamental of the periodic function f(t) is the n=1 term while the harmonics are the remaining terms whose frequencies are integer multiples of the fundamental. We must now find some easy method for computing the coefficients an and bn for a given function f(t). As a first attempt, we integrate (4.1.1) term by term2 from L to L. On the right side, all of the integrals multiplied by an and bn vanish because the average of cos(n t/L) and sin(n t/L) is zero. Therefore, we are left with "Fourier's Theorem...is not only one of the most beautiful results of modern analysis, but may be said to furnish an indispensable instrument in the treatment of nearly every recondite question in modern physics. To mention only sonorous vibrations, the propagation of electric signals along a telegraph wire, and the conduction of heat by the earth's crust, as subjects in their generality intractable without it, is to give but a feeble idea of its importance." (Quote taken from Thomson, W., and P.G.Tait, 1879: Treatise on Natural Philosophy, Part 1. Cambridge University Press, 75.) 1 Fourier Series 201 (4.1.2) Consequently a0 is twice the mean value of f(t) over one period. We next multiply each side of (4.1.1) by cos(m t/L), where m is a fixed integer. Integrating from L to L, (4.1.3) The a0 and bn terms vanish by direct integration. Finally all of the an integrals vanish when n m. Consequently, (4.1.3) simplifies to (4.1.4) because Finally, by multiplying both sides of (4.1.1) by sin(m t/L)(m is again a fixed integer) and integrating from L to L, (4.1.5) Although (4.1.2) (4.1.4), and (4.1.5) give us a0, an, and bn for periodic functions over the , interval [ L, L], in certain situations it is convenient to use the interval [ , +2L], where is any real number. In that case, (4.1.1) still gives the Fourier series of f(t) and 2 We assume that the integration of the series can be carried out term by term. This is sometimes difficult to justify but we do it anyway. 202 Advanced Engineering Mathematics with MATLAB (4.1.6) These results follow when we recall that the function f(t) is a periodic function that extends from minus infinity to plus infinity. The results must remain unchanged, therefore, when we shift from the interval [ L, L] to the new interval [ , +2L]. We now ask the question: what types of functions have Fourier series? Secondly, if a function is discontinuous at a point, what value will the Fourier series give? Dirichlet3,4 answered these questions in the first half of the nineteenth century. His results may be summarized as follows. Dirichlet's Theorem: If for the interval [ L, L] the function f(t) (1) is single-valued, (2) is bounded, (3) has at most a finite number of maxima and minima, and (4) has only a finite number of discontinuities (piecewise continuous), and if (5) f(t+2L)=f(t) for values of t outside of [ L, L], then (4.1.7) converges to f(t] as N at values of t for which f(t) is continuous and to at points of discontinuity. The quantities t+ and t denote points infinitesimally to the right and left of t. The coefficients in (4.1.7) are given by (4.1.2), (4.1.4), and (4.1.5). A function f(t) is bounded if the inequality |f(t)| M holds for some constant M for all values of t. Because the Dirichlet's conditions (1)(4) are very mild, 3 Dirichlet, P.G.L., 1829: Sur la convergence des sries trigonomtriques qui servent reprsenter une fonction arbitraire entre des limites donnes. J. Reine Angew. Math., 4, 157169. Dirichlet, P.G.L., 1837: Sur l'usage des intgrales dfinies dans la sommation des sries finies ou infinies. J. Reine Angew. Math., 17, 5767. 4 Fourier Series 203 Figure 4.1.1: A product of the French Revolution, (Jean Baptiste) Joseph Fourier (17681830) held positions within the Napoleonic Empire during his early career. After Napoleon's fall from power, Fourier devoted his talents exclusively to science. Although he won the Institut de France prize in 1811 for his work on heat diffusion, criticism of its mathematical rigor and generality led him to publish the classic book Thorie analytique de la chaleur in 1823. Within this book he introduced the world to the series that bears his name. (Portrait courtesy of the Archives de l'Acadmie des sciences, Paris.) it is very rare that a convergent Fourier series does not exist for a function that appears in an engineering or scientific problem. Example 4.1.1 Let us find the Fourier series for the function (4.1.8) We compute the Fourier coefficients an and bn using (4.1.6) by letting L= and = then find that . We 204 Advanced Engineering Mathematics with MATLAB (4.1.9) (4.1.10) (4.1.11) Figure 4.1.2: Second to Gauss, Peter Gustav Lejeune Dirichlet (18051859) was Germany's leading mathematician during the first half of the nineteenth century. Initially drawn to number theory, his later studies in analysis and applied mathematics led him to consider the convergence of Fourier series. These studies eventually produced the modern concept of a function as a correspondence that associates with each real x in an interval some unique value denoted by f(x). (Taken from the frontispiece of Dirichlet, P.G.L., 1889: Werke. Druck und Verlag von Georg Reimer, 644 pp.) because cos(n )=( 1)n, and Fourier Series 205 (4.1.12) (4.1.13) for n=1, 2, 3,.... Thus, the Fourier series for f(t) is (4.1.14) (4.1.15) Figure 4.1.3: Partial sum of the Fourier series for (4.1.8). We note that at the points t=(2n 1) , where n=1, 2, 3,..., the function jumps from zero to . To what value does the Fourier series converge at these points? From Dirichlet's theorem, the series converges to the average of the values of the function just to the right and left of the point of discontinuity, i.e., ( +0)/2 /2. At the remaining points the series converges to f(t). 206 Advanced Engineering Mathematics with MATLAB Figure 4.1.3 shows how well (4.1.14) approximates the function by graphing various partial sums of (4.1.14) as we include more and more terms (harmonics). The MATLAB script that created this figure is: clear; t = [-4:0.1:4]; % create time points in plot f = zeros(size(t)); % initialize function f (t) for k = 1:length(t) % construct function f(t) if t(k) < 0; f(k) = 0; else f(k) = t(k); end; if t(k) < -pi; f(k) = t(k) + 2*pi; end; if t(k) > pi; f(k) = 0; end; end % initialize fourier series with the mean term fs = (pi/4) * ones(size(t)); clf % clear any figures for n = 1:6 % create plot of truncated FS with only n harmonic fs = fs - (2/pi) * cos((2*n -1)*t)/(2*n-1)^2; fs = fs - (-1)^n * sin (n*t) / n; subplot(3, 2, n), plot(t, fs, t, f, '--') if n==1 legend ('mean plus 1 term','f (t)'); legend boxoff; else legend (['mean plus ', num2str(n),' terms'], 'f (t)') legend boxoff end if n >= 5; xlabel('t'); end; end As the figure shows, successive corrections are made to the mean value of the series, /2. As each harmonic is added, the Fourier series fits the function better in the sense of least squares: (4.1.16) where fN(x) is the truncated Fourier series of N terms. Example 4.1.2 Let us calculate the Fourier series of the function f(t)=|t| which is defined over the range t . From the definition of the Fourier coefficients, (4.1.17) Fourier Series 207 (4.1.18) (4.1.19) (4.1.20) and (4.1.21) (4.1.22) Figure 4.1.4: Partial sum of the Fourier series for f(t)=|t|. for n=1, 2, 3,.... Therefore, 208 Advanced Engineering Mathematics with MATLAB (4.1.23) for t . In Figure 4.1.4 we show how well (4.1.23) approximates the function by graphing various partial sums of (4.1.23). As the figure shows, the Fourier series does very well even when we use very few terms. The reason for this rapid convergence is the nature of the function: it does not possess any jump discontinuities. Example 4.1.3 Sometimes the function f(t) is an even or odd function.5 Can we use this property to simplify our work? The answer is yes. Let f(t) be an even function. Then (4.1.24) and (4.1.25) whereas (4.1.26) and =0. Here we used the properties that Thus, if we have an even function, we merely compute a0 and an via (4.1.24)(4.1.25) and bn=0. Because the corresponding series contains only cosine terms, it is often called a Fourier cosine series. Similarly, if f(t) is odd, then 5 An even function fe(t) has the property that fe( t)=fe(t); an odd function fo(t) has the property that fo( t)= fo(t) Fourier Series 209 (4.1.27) Thus, if we have an odd function, we merely compute bn via (4.1.27) and a0=an=0. Because the corresponding series contains only sine terms, it is often called a Fourier sine series. Example 4.1.4 In the case when f(x) consists of a constant and/or trigonometric functions, it is much easier to find the corresponding Fourier series by inspection rather than by using (4.1.6). For example, let us find the Fourier series for f(x)=sin2(x) defined over the range x . We begin by rewriting that any function defined over the range Next, we note <x< has the Fourier series (4.1.28) (4.1.29) On the other hand, (4.1.30) (4.1.31) Consequently, by inspection, we can immediately write that (4.1.32) Thus, instead of the usual expansion involving an infinite number of sine and cosine terms, our Fourier series contains only two terms and is simply 210 Advanced Engineering Mathematics with MATLAB (4.1.33) Example 4.1.5: Quieting snow tires An application of Fourier series to a problem in industry occurred several years ago, when drivers found that snow tires produced a loud whine6 on dry pavement. Tire sounds are produced primarily by the dynamic interaction of the tread elements with the road surface.7 As each tread element passes through the contact patch, it contributes a pulse of acoustic energy to the total sound field radiated by the tire. For evenly spaced treads we envision that the release of acoustic energy resembles the top of Figure 4.1.5. If we perform a Fourier analysis of this distribution, we find that (4.1.34) where is half of the width of the tread and (4.1.35) (4.1.36) (4.1.37) (4.1.38) (4.1.39) 6 7 Information based on Varterasian, J.H., 1969: Math quiets rotating machines. SAE J., 77(10), 53. Willett, P.R., 1975: Tire tread pattern sound generation. Tire Sci. Tech., 3, 252266. Fourier Series Because f(t) is an even function, bn=0. 211 The question now arises of how to best illustrate our Fourier coefficients. In 4.4 we will show that any harmonic can be represented as a single wave An cos(n t/L+ n) or An sin(n t/L+ n), where the amplitude Figure 4.1.5: Temporal spacing (over two periods) and frequency spectrum of uniformly spaced snow tire treads. In the bottom frame of Figure 4.1.5, MATLAB was used to plot this amplitude, usually called the amplitude of n for an arbitrarily chosen or frequency spectrum Although the value of as a function will affect the exact shape of the spectrum, the qualitative arguments that we will present remain unchanged. We have added the factor so that our definition of the frequency spectrum is consistent with that for a complex Fourier series stated after (4.5.13). The amplitude spectrum in Figure 4.1.5 shows that the spectrum for periodically placed tire treads has its largest amplitude at small n. This produces one loud tone plus strong harmonic overtones because the fundamental and its overtones are the dominant terms in the Fourier series representation. 212 Advanced Engineering Mathematics with MATLAB Clearly this loud, monotone whine is undesirable. How might we avoid it? Just as soldiers mardhing in step produce a loud uniform sound, we suspect that our uniform tread pattern is the problem. Therefore, let us now vary the interval between the treads so that the distance between any tread and its nearest neighbor is not equal as illustrated in Figure 4.1.6. Again we perform its Fourier analysis and obtain that Figure 4.1.6: Temporal spacing and frequency spectrum of nonuniformly spaced snow tire treads. (4.1.40) (4.1.41) (4.1.42) Fourier Series 213 (4.1.43) (4.1.44) and (4.1.45) (4.1.46) (4.1.47) The MATLAB script epsilon = pi/12; % set up parameter for fs coefficient n = 1:20; % number of harmonics arg1 = (pi/2)*n; arg2 = (pi/4)*n; arg3 = epsi1on*n; % compute the fourier coefficient a_n an = (cos(arg1) + cos(arg2)).*sin (arg3); an = (2/pi) *an./n; % compute the fourier coefficient b_n bn = (sin(arg2) - sin(arg1)).*sin(arg3); bn = (2/pi) *bn. /n; % compute the magnitude cn = 0.5 *sqrt (an.*an + bn.*bn); % add in the a_0 term cn = [2*epsilon/pi,cn]; n = [0,n]; clf % clear any figures axes ('FontSize',20) % set font size stem (n,cn,'filled') % plot spectrum set(gca,'PlotBoxAspectRatio', [8 4 1]) % set aspect ratio xlabel('n') % label x-axis ylabel('(a_n^2 + b_n^2)^{1/2}/2') % label y-axis, 214 Advanced Engineering Mathematics with MATLAB was used to compute the amplitude of each harmonic as a function of n and the results were plotted. See Figure 4.1.6. The important point is that our new choice for the spacing of the treads has reduced or eliminated some of the harmonics compared to the case of equally spaced treads. On the negative side we have excited some of the harmonics that were previously absent. However, the net effect is advantageous because the treads produce less noise at more frequencies rather than a lot of noise at a few select frequencies. If we were to extend this technique so that the treads occurred at completely random positions, then the treads would produce very little noise at many frequencies and the total noise would be comparable to that generated by other sources within the car. To find the distribution of treads with the whitest noise8 is a process of trial and error. Assuming a distribution, we can perform a Fourier analysis to obtain its frequency spectrum. If annoying peaks are present in the spectrum, we can then adjust the elements in the tread distribution that may contribute to the peak and analyze the revised distribution. You are finished when no peaks appear. Problems Find the Fourier series for the following functions. Using MATLAB, plot the Fourier spectrum. Then plot various partial sums and compare them against the exact function. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. f(t)=eat, L < t < L f(t)=t+t2, L < t < L 8 White noise is sound that is analogous to white light in that it is uniformly distributed throughout the complete audible sound spectrum. Fourier Series 11. 12. 13. 14. 15. 16. 215 4.2 PROPERTIES OF FOURIER SERIES In the previous section we introduced the Fourier series and showed how to compute one given the function f(t). In this section we examine some particular properties of these series. Differentiation of a Fourier series In certain instances we only have the Fourier series representation of a function f(t). Can we find the derivative or the integral of f(t) merely by differentiating or integrating the Fourier series term by term? Is this permitted? Let us consider the case of differentiation first. Consider a function f(t) of period 2L which has the derivative f (t). Let us assume that we can expand f (t) as a Fourier series. This implies that f (t) is continuous except for a finite number of discontinuities and f(t) is continuous over an interval that starts at t= and ends at t= +2L. Then (4.2.1) where we denoted the Fourier coefficients of f (t) with a prime. Computing the Fourier coefficients, (4.2.2) if f( +2L)=f( ). Similarly, by integrating by parts, 216 Advanced Engineering Mathematics with MATLAB (4.2.3) (4.2.4) (4.2.5) and (4.2.6) (4.2.7) (4.2.8) Consequently, if we have a function f(t) whose derivative f (t) is continuous except for a finite number of discontinuities and f( )=f( +2L), then (4.2.9) That is, the derivative of f(t) is given by a term-by-term differentiation of the Fourier series of f(t). Example 4.2.1 The Fourier series for the periodic function (4.2.10) Fourier Series is 217 (4.2.11) Because f(t) is continuous over the entire interval ( , ) and f( f (t) by taking the derivative of (4.2.11) term by term: )= f( )=0, we can find (4.2.12) This is the same Fourier series that we would obtain by computing the Fourier series for (4.2.13) Integration of a Fourier series To determine whether we can find the integral of f(t) by term-by-term integration of its Fourier series, consider a form of the antiderivative of f(t): (4.2.14) Now (4.2.15) (4.2.16) (4.2.17) so that F(t) has a period of 2L. Consequently we may expand F(t) as the Fourier series 218 Advanced Engineering Mathematics with MATLAB (4.2.18) For An, (4.2.19) (4.2.20) (4.2.21) Similarly, (4.2.22) Therefore, (4.2.23) This is identical to a term-by-term integration of the Fourier series for f(t). Thus, we can always find the integral of f(t) by a term-by-term integration of its Fourier series. Example 4.2.2 The Fourier series for f(t)=t for <t< is (4.2.24) To find the Fourier series for f(t)=t2, we integrate (4.2.24) term by term and find that Fourier Series 219 (4.2.25) But final result that Substituting and multiplying by 2, we obtain the (4.2.26) Parseval's equality One of the fundamental quantities in engineering is power. The power content of a periodic signal f(t) of period 2L is f2(t) dt/L This mathematical definition mir2 rors the power dissipation I R that occurs in a resistor of resistance R where I is the root mean square (RMS) of the current. We would like to compute this power content as simply as possible given the coefficients of its Fourier series. Assume that f(t) has the Fourier series (4.2.27) Then, (4.2.28) (4.2.29) Equation (4.2.29) is Parseval's equality.9 It allows us to sum squares of Fourier coefficients (which we have already computed) rather than performing the integration f2(t) dt analytically or numerically. Parseval, M.-A., 1805: Mmoire sur les sries et sur l'intgration complte d'une quation aux diffrences partielles linaires du second ordre, coefficients constants. Mm-oires prsents a l'Institut des sciences, lettres et arts, par divers sa ans, et lus dans ses assembles: Sciences mathmatiques et Physiques, 1, 638648. 9 220 Advanced Engineering Mathematics with MATLAB Example 4.2.3 The Fourier series for f(t)=t2 over the interval [ , ] is (4.2.30) Then, by Parseval's equality, (4.2.31) (4.2.32) (4.2.33) Gibbs phenomena In the actual application of Fourier series, we cannot sum an infinite number of terms but must be content with N terms. If we denote this partial sum of the Fourier series by SN(t), we have from the definition of the Fourier series: (4.2.34) Fourier Series 221 (4.2.35) (4.2.36) (4.2.37) The quantity is called a scanning function. Over the range 0 x 2 it has a very large peak at x=t where the amplitude equals 2N+1. See Figure 4.2.1. On either side of this peak there are oscillations which decrease rapidly Figure 4.2.1: The scanning function over 0 x 2 for N=5. with distance from the peak. Consequently, as N , the scanning function becomes essentially a long narrow slit corresponding to the area under the large peak at x=t. If we neglect for the moment the small area under the minor ripples adjacent to this slit, then the integral (4.2.37) essentially equals f(t) times the area of the slit divided by 2 . If 1/2 times the area of the slit equals unity, then the value of SN(t) f(t) to a good approximation for large N. 222 Advanced Engineering Mathematics with MATLAB For relatively small values of N, the scanning function deviates considerably from its ideal form, and the partial sum SN(t) only crudely approximates f(t). As the partial sum includes more terms and N becomes relatively large, the form of the scanning function improves and so does the agreement between SN(t) and f(t). The improvement in the scanning function is due to the large hump becoming taller and narrower. At the same time, the adjacent ripples become more numerous as well as narrower in the same proportion as the large hump does. The reason why SN(t) and f(t) will never become identical, even in the limit of N , is the presence of the positive and negative side lobes near the large peak. Because (4.2.38) an integration of the scanning function over the interval 0 to 2 shows that the total area under the scanning function equals 2 . However, from Figure Figure 4.2.2: The finite Fourier series representation SN(t) for the function (4.2.39) for the range 1 t 7 for N=27 and N=81. 4.2.1 the net area contributed by the ripples is numerically negative so that the area under the large peak must exceed 2 if the total area equals 2 . Although the exact value depends upon N, it is important to note that this excess does not become zero as N . Thus, the presence of these negative side lobes explains the departure of our scanning function from the idealized slit of area 2 . To illustrate this departure, consider the function: Fourier Series 223 (4.2.39) Then, (4.2.40) (4.2.41) (4.2.42) The first integral in (4.2.42) gives the contribution to SN(t) from the jump discontinuity at t=0 while the second integral gives the contribution from t= . In Figure 4.2.2 we have plotted SN(t) when N=27 and N=81. Residual discrepancies remain even for very large values of N. Indeed, as N increases, this figure changes only in that the ripples in the vicinity of the discontinuity of f(t) proportionally increase their rate of oscillation as a function of t while their relative magnitude remains the same. As N these ripples compress into a single vertical line at the point of discontinuity. True, these oscillations occupy smaller and smaller spaces but they still remain. Thus, we can never approximate a function in the vicinity of a discontinuity by a finite Fourier series without suffering from this overand undershooting of the series. This peculiarity of Fourier series is called the Gibbs phenomena.10 Gibbs phenomena can only be eliminated by removing the discontinuity.11 Problems Additional Fourier series representations can be generated by differentiating or integrating known Fourier series. Work out the following two examples. 1. Given 10 Gibbs, J.W., 1898: Fourier's series. Nature, 59, 200; Gibbs, J.W., 1899: Fourier's series. Nature, 59, 606. For the historical development, see Hewitt, E., and R.E.Hewitt, 1979: The GibbsWilbraham phenomenon: An episode in Fourier analysis. Arch. Hist. Exact Sci., 21, 129160. For a particularly clever method for improving the convergence of a trigonometric series, see Kantorovich, L.V., and V.I.Krylov, 1964: Approximate Methods of Higher Analysis. Interscience, pp. 7788. 11 224 Advanced Engineering Mathematics with MATLAB obtain by term-by-term integration. Could we go the other way, i.e., take the derivative of the second equation to obtain the first? Explain. 2. Given obtain by term-by-term integration. Could we go the other way, i.e., take the derivative of the second equation to obtain the first? Explain. 3. (a) Show that the Fourier series for the odd function: is (b) Use Parseval's equality to show that This series converges very rapidly to computing 6. 6 /960 and provides a convenient method for Fourier Series 4.3 HALF-RANGE EXPANSIONS 225 In certain applications, we will find that we need a Fourier series representation for a function f(x) that applies over the interval (0, L) rather than ( L, L). Because we are completely free to define the function over the interval ( L, 0), it is simplest to have a series that consists only of sines or cosines. In this section we shall show how we can obtain these so-called half-range expansions. Recall in Example 4.1.3 how we saw that if f(x) is an even function, then bn=0 for all n. Similarly, if f(x) is an odd function, then a0=an=0 for all n. We now use these results to find a Fourier half-range expansion by extending the function defined over the interval (0, L) as either an even or odd function into the interval ( L, 0). If we extend f(x) as an even function, we will get a half-range cosine series; if we extend f(x) as an odd function, we obtain a half-range sine series. It is important to remember that half-range expansions are a special case of the general Fourier series. For any f(x) we can construct either a Fourier sine or cosine series over the interval ( L, L). Both of these series will give the correct answer over the interval of (0, L). Which one we choose to use depends upon whether we wish to deal with a cosine or sine series. Example 4.3.1 Let us find the half-range sine expansion of f(x)=1, 0< x< . (4.3.1) We begin by defining the periodic odd function (4.3.2) with Because is odd, a0=an=0 and (4.3.3) (4.3.4) The Fourier half-range sine series expansion of f(x) is therefore 226 Advanced Engineering Mathematics with MATLAB (4.3.5) As counterpoint, let us find the half-range cosine expansion of f(x)=1, 0 < x < . we have that bn=0, Now, (4.3.6) and (4.3.7) Thus, the Fourier half-range cosine expansion equals the single term: f(x)=1, 0 < x < . (4.3.8) This is perfectly reasonable. To form a half-range cosine expansion we extend f(x) as an even function into the interval ( , 0). In this case, we would obtain for < x < . Finally, we note that the Fourier series of a constant is simply that constant. In practice it is impossible to sum (4.3.5) exactly and we actually sum only the first N terms. Figure 4.3.1 illustrates f(x) when the Fourier series (4.3.5) contains N terms. As seen from the figure, the truncated series tries to achieve the infinite slope at x=0, but in the attempt, it overshoots the discontinuity by a certain amount (in this particular case, by 17.9%). This is another example of the Gibbs phenomena. Increasing the number of terms does not remove this peculiarity; it merely shifts it nearer to the discontinuity. Example 4.3.2: Inertial supercharging of an engine An important aspect of designing any gasoline engine involves the motion of the fuel, air, and exhaust gas mixture through the engine. Ordinarily an engineer would consider the motion as steady flow; but in the case of a four-stroke, single-cylinder gasoline engine, the closing of the intake valve interrupts the steady flow of the gasoline-air mixture for nearly three Fourier Series 227 Figure 4.3.1: Partial sum of N terms in the Fourier half-range sine representation of a square wave. quarters of the engine cycle. This periodic interruption sets up standing waves in the intake pipe--waves which can build up an appreciable pressure amplitude just outside the input value. When one of the harmonics of the engine frequency equals one of the resonance frequencies of the intake pipe, then the pressure fluctuations at the valve will be large. If the intake valve closes during that portion of the cycle when the pressure is less than average, then the waves will reduce the power output. However, if the intake valve closes when the pressure is greater than atmospheric, then the waves will have a supercharging effect and will produce an increase of power. This effect is called inertia supercharging. While studying this problem, Morse et a1.12 found it necessary to express the velocity of the air-gas mixture in the valve, given by in terms of a Fourier expansion. The advantage of working with the Fourier series rather (4.3.9) 12 Morse, P.M., R.H.Boden, and H.Schecter, 1938: Acoustic vibrations and internal combustion engine performance. I. Standing waves in the intake pipe system. J. Appl. Phys., 9, 1623. 228 Advanced Engineering Mathematics with MATLAB than the function itself lies in the ability to write the velocity as a periodic forcing function that highlights the various harmonics that might resonate with the structure comprising the fuel line. Clearly f(t) is an even function and its Fourier representation will be a cosine series. In this problem = / , and L= / . Therefore, (4.3.10) and (4.3.11) (4.3.12) (4.3.13) (4.3.14) Plotting these Fourier coefficients using the MATLAB script: for m = 1:21; n = m-1; % compute the fourier coefficients a_n if n == 2; an(m) = pi/4; else; an(m) = 4.*cos(pi*n/4)/(4-n*n); end; end nn = 0:20; % create indices for x-axis fzero = zeros (size(nn)); % create the zero line clf % clear any figures axes ('FontSize',20) % set font size stem(nn,an,'filled') % plot spectrum hold on plot (nn,fzero,'-') % plot the zero line set (gca,'PlotBoxAspectRatio', [8 4 1]) % set aspect ratio xlabel ('n') % label x-axis ylabel ('a_n') % label y-axis, Fourier Series 229 we see that these Fourier coefficients become small rapidly (see Figure 4.3.2). For that reason, Morse et al. showed that there are only about three resonances where the acoustic properties of the intake pipe can enhance engine performance. These peaks occur when Figure 4.3.2: The spectral coefficients of the Fourier cosine series of the function (4.3.9). q=30c/NL=3, 4, or 5, where c is the velocity of sound in the air-gas mixture, L is the effective length of the intake pipe, and N is the engine speed in rpm. See Figure 4.3.3. Subsequent experiments13 verified these results. Such analyses are valuable to automotive engineers. Engineers are always seeking ways to optimize a system with little or no additional cost. Our analysis shows that by tuning the length of the intake pipe so that it falls on one of the resonance peaks, we could obtain higher performance from the engine with little or no extra work. Of course, the problem is that no car always performs at some optimal condition. Figure 4.3.3: Experimental verification of inertial supercharging within a gasoline engine resulting from the resonance of the air-gas mixture and the intake pipe system. The peaks correspond to the n=3, 4, and 5 harmonics of the Fourier representation (4.3.14) and the parameter q is defined in the text. (From Morse, P., Boden, R.H., and Schecter, H., 1938: Acoustic vibrations and internal combustion engine performance. J. Appl. Phys., 9, 17 with permission.) 13 Boden, R.H., and H.Schecter, 1944: Dynamics of the inlet system of a four-stroke engine. NACA Tech. Note 935. 230 Advanced Engineering Mathematics with MATLAB Problems Find the Fourier cosine and sine series for the following functions. Then, use MATLAB to plot the Fourier coefficients. 1. f(t)=t, 0 < t < 2. f(t)= t, 0 < t < 3. f(t)=t( t), 0 < t < 4. f(t)=ekt, 0 < t < 5. 6. 2 7. 8. f(t)= t2 ,0 < t < 9. 10. 11. 12. 13. Fourier Series 14. 15. Using the relationships14 that 231 and with obtain the following half-range expansions: and Here Jv( ) denotes the Bessel function of the first kind and order v (see 9.5) and ( ) is the function.15 16. The function is a curve fit to the observed pressure trace of an explosion wave in the atmosphere. Because the observed transmission of atmospheric waves depends on the five-fourths power of the frequency, Reed16 had to re-express this curve fit as a Fourier sine series before he could use the transmission law. He found that 14 Gradshteyn, I.S., and I.M.Ryzhik, 1965: Table of Integrals, Series, and Products. Academic Press, 3.753, Formula 2 and 3.771, Formula 8. Gradshteyn and Ryzhik, op. cit., 6.41. 15 16 From Reed, J.W., 1977: Atmospheric attenuation of explosion waves. J. Acoust. Soc. Am., 61, 3947 with permission. 232 Advanced Engineering Mathematics with MATLAB Confirm his result. 4.4 FOURIER SERIES WITH PHASE ANGLES Sometimes it is desirable to rewrite a general Fourier series as a purely cosine or purely sine series with a phase angle. Engineers often speak of some quantity leading or lagging another quantity. Re-expressing a Fourier series in terms of amplitude and phase provides a convenient method for determining these phase relationships. Suppose, for example, that we have a function f(t) of period 2L, given in the interval [ L, L], whose Fourier series expansion is (4.4.1) We wish to replace (4.4.1) by the series: (4.4.2) To do this we note that (4.4.3) (4.4.4) Fourier Series We equate coefficients of sin(n t/L) and cos(n t/L) on both sides and obtain 233 (4.4.5) Hence, upon squaring and adding, (4.4.6) while taking the ratio gives (4.4.7) Similarly we could rewrite (4.4.1) as (4.4.8) where (4.4.9) and (4.4.10) In both cases, we must be careful in computing n because there are two possible values of n which satisfy (4.4.7) or (4.4.9). These angles n must give the correct an and bn using either (4.4.5) or (4.4.10). Example 4.4.1 The Fourier series for f(t)=et over the interval L < t < L is 234 Advanced Engineering Mathematics with MATLAB (4.4.11) Let us rewrite (4.4.11) as a Fourier series with a phase angle. Regardless of whether we want the new series to contain cos(n t/L+ n) or sin(n t/L+ n), the amplitude An or Bn is the same in both series: (4.4.12) If we want our Fourier series to read (4.4.13) then (4.4.14) where n lies in the first quadrant if n is even and in the third quadrant if n is odd. This ensures that the sign from the ( 1)n is correct. On the other hand, if we prefer (4.4.15) then (4.4.16) where n lies in the fourth quadrant if n is odd and in the second quadrant if n is even. Fourier Series Problems Write the following Fourier series in both the cosine and sine phase angle form: 1. 235 2. 3. 4. 4.5 COMPLEX FOURIER SERIES So far in our discussion, we expressed Fourier series in terms of sines and cosines. We are now ready to re-express a Fourier series as a series of complex exponentials. There are two reasons for this. First, in certain engineering and scientific applications of Fourier series, the expansion of a function in terms of complex exponentials results in coefficients of considerable simplicity and clarity. Second, these complex Fourier series point the way to the development of the Fourier transform in the next chapter. We begin by introducing the variable n=n /L, where n=0, 1, 2,... Using Euler's formula we can replace the sine and cosine in the Fourier series by exponentials and find that (4.5.1) (4.5.2) If we define then (4.5.3) (4.5.4) 236 Advanced Engineering Mathematics with MATLAB Similarly, the complex conjugate of cn, equals (4.5.5) To simplify (4.5.2) we note that (4.5.6) which yields the result that (4.5.7) so that we can write (4.5.2) as (4.5.8) Letting n= m in the second summation on the right side of (4.5.8), (4.5.9) where we introduced m=n into the last summation in (4.5.9). Therefore, (4.5.10) On the other hand, (4.5.11) because 0 =0 /L=0. Thus, our final result is Fourier Series 237 (4.5.12) where (4.5.13) and n=0, 1, 2,.... Note that even though cn is generally complex, the summation (4.5.12) always gives a real-valued function f(t). Just as we can represent the function f(t) graphically by a plot of t against f(t), we can plot cn as a function of n, commonly called the frequency spectrum. Because cn is generally complex, it is necessary to make two plots. Typically the plotted quantities are the amplitude spectra |cn| and the phase spectra n, where n is the phase of cn. However, we could just as well plot the real and imaginary parts of cn. Because n is an integer, these plots consist merely of a series of vertical lines representing the ordinates of the quantity |cn| or n for each n. For this reason we refer to these plots as the line spectra. Because 2cn=an ibn, the coefficients cn for an even function will be purely real; the coefficients cn for an odd function are purely imaginary. It is important to note that we lose the advantage of even and odd functions in the sense that we cannot just integrate over the interval 0 to L and then double the result. In the present case we have a line integral of a complex function along the real axis. Example 4.5.1 Let us find the complex Fourier series for (4.5.14) which has the periodicity f(t+2 )=f(t). With L= and = , n=n /L=n. Therefore, (4.5.15) 238 Advanced Engineering Mathematics with MATLAB (4.5.16) (4.5.17) if n 0. Because en i=cos(n )+i sin(n )=( 1)n and e n i =cos( n )+ i sin( n )=( 1)n, then (4.5.18) with (4.5.19) In this particular problem we must treat the case n=0 specially because (4.5.16) is undefined for n=0. In that case, (4.5.20) Because c0=0, we can write the expansion: (4.5.21) since we can write all odd integers as 2m 1, where m=0, 1, 2, 3,.... Using the MATLAB script max = 31; % total number of harmonics mid = (max+1)/2; % in the array, location of c_0 for m = 1:max; n = m - mid; % compute value of harmonic % compute complex Fourier coefficient c_n = (cnr, cni) if mod(n,2) == 0; cnr(m)= 0; cni(m) = 0; else; cnr(m) = 0; cni(m) = - 2/(pi*n); end; end nn=(1-mid):(max-mid); % create indices for x-axis fzero=zeros(size(nn));% create the zero line Fourier Series clf % clear any figures amplitude = sqrt (cnr.*cnr+cni.*cni); phase = atan2 (cni,cnr); % plot amplitude of c_n subplot (2,1,1), stem (nn,amplitude,'filled') % label amplitude plot text(6,0.75,'amplitude','FontSize',20) subplot(2,l,2), stem (nn,phase,'filled')% plot phases of c_n text (7,1,' phase','FontSize',20) % label phase plot xlabel('n','Fontsize',20) % label x- axis, 239 we plot the amplitude and phase spectra for the function (4.5.14) as a function of n in Figure 4.5.1. Example 4.5.2 The concept of Fourier series can be generalized to multivariable functions. Consider the function f(x, y) defined over 0<x<L and 0<y<H. Taking y constant, we have that (4.5.22) Figure 4.5.1: Amplitude and phase spectra for the function (4.5.14). Similarly, holding n constant, 240 Advanced Engineering Mathematics with MATLAB (4.5.23) Therefore, the (complex) Fourier coefficient for the two-dimensional function f(x,y) is (4.5.24) assuming that the integral exists. To recover f(x,y) given cnm, we reverse the process of deriving cnm. Starting with (4.5.25) we find that (4.5.26) Therefore, (4.5.27) Problems Find the complex Fourier series for the following functions. Then use MATLAB to plot the corresponding spectra. 1. f(t)=|t|, t t 2. f(t)=e , 0<t<2 3. f(t)=t, 0<t<2 4. f(t)=t2, t 5. 6. f(t)=t, 1<t<1 Fourier Series 4.6 THE USE OF FOURIER SERIES IN THE SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS 241 An important application of Fourier series is the solution of ordinary differential equations. Structural engineers especially use this technique because the occupants of buildings and bridges often subject these structures to forcings that are periodic in nature.17 Example 4.6.1 Let us find the general solution to the ordinary differential equation y +9y=f(t), (4.6.1) where the forcing is f(t)=|t|, t , f(t+2 )=f(t). (4.6.2) This equation represents an oscillator forced by a driver whose displacement is the saw-tooth function. We begin by replacing the function f(t) by its Fourier series representation because the forcing function is periodic. The advantage of expressing f(t) as a Fourier series is its validity for any time t. The alternative would be to construct a solution over each interval n <t<(n+1) and then piece together the final solution assuming that the solution and its first derivative is continuous at each junction t=n . Because the function is an even function, all of the sine terms vanish and the Fourier series is (4.6.3) Next, we note that the general solution consists of the complementary solution, which equals yH (t)=A cos(3t)+B sin(3t), (4.6.4) and the particular solution yp(t) which satisfies the differential equation 17 Timoshenko, S.P., 1943: Theory of suspension bridges. Part II. J.Franklin Inst., 235, 327349; Inglis, C.E., 1934: A Mathematical Treatise on Vibrations in Railway Bridges. Cambridge University Press, 203 pp. 242 Advanced Engineering Mathematics with MATLAB (4.6.5) To determine this particular solution, we write (4.6.5) as (4.6.6) By the method of undetermined coefficients, we guess the particular solution: (4.6.7) or (4.6.8) Because (4.6.9) (4.6.10) or Fourier Series 243 (4.6.11) Because (4.6.11) must hold true for any time, each harmonic must vanish separately and (4.6.12) and bn=0. All of the coefficients an are finite except for n=2, where a2 becomes undefined. This coefficient is undefined because the harmonic cos(3t) in the forcing function resonates with the natural mode of the system. Let us review our analysis to date. We found that each harmonic in the forcing function yields a corresponding harmonic in the particular solution (4.6.8). The only difficulty arises with the harmonic n=2. Although our particular solution is not correct because it contains cos(3t), we suspect that if we remove that term then the remaining harmonic solutions are correct. The problem is linear, and difficulties with one harmonic term should not affect other harmonics. But how shall we deal with the cos(3t) term in the forcing function? Let us denote that particular solution by Y(t) and modify our particular solution as follows: (4.6.13) Substituting this solution into the differential equation and simplifying, everything cancels except (4.6.14) The solution of this equation by the method of undetermined coefficients is (4.6.15) This term, called a secular term, is the most important one in the solution. While the other terms merely represent simple oscillatory motion, the term t sin(3t) grows linearly with time and eventually becomes the dominant term in the series. Consequently, the 244 Advanced Engineering Mathematics with MATLAB general solution equals the complementary plus the particular solution or (4.6.16) Example 4.6.2 Let us redo the previous problem only using complex Fourier series. That is, let us find the general solution to the ordinary differential equation (4.6.17) From the method of undetermined coefficients we guess the particular solution for (4.6.17) to be (4.6.18) Then (4.6.19) Substituting (4.6.18) and (4.6.19) into (4.6.17), (4.6.20) Because (4.6.20) must be true for any t, (4.6.21) Therefore, (4.6.22) Fourier Series 245 However, there is a problem when n= 1 and n=2. Therefore, we modify (4.6.22) to read (4.6.23) Substituting (4.6.23) into (4.6.17) and simplifying, (4.6.24) The general solution is then (4.6.25) The first two terms on the right side of (4.6.25) represent the complementary solution. Although (4.6.25) is equivalent to (4.6.16), we have all of the advantages of dealing with exponentials rather than sines and cosines. These advantages include ease of differentiation and integration, and writing the series in terms of amplitude and phase. Example 4.6.3: Temperature within a spinning satellite In the design of artificial satellites, it is important to determine the temperature distribution on the spacecraft's surface. An interesting special case is the temperature fluctuation in the skin due to the spinning of the vehicle. If the craft is thin-walled so that there is no radial dependence, Hrycak18 showed that he could approximate the nondimensional temperature field at the equator of the rotating satellite by (4.6.26) where (4.6.27) 18 Hrycak, P., 1963: Temperature distribution in a spinning spherical space vehicle. AIAA J., 1, 9699. 246 Advanced Engineering Mathematics with MATLAB (4.6.28) a is the thermal diffusivity of the shell, f is the rate of spin, r is the radius of the spacecraft, S is the net direct solar heating, is the ratio of the emissivity of the interior shell to the emissivity of the exterior surface, is the overall emissivity of the exterior surface, is the satellite's skin conductance, and is the Stefan-Boltzmann constant. The independent variable is the longitude along the equator with the effect of rotation subtracted out (2 = 2 ft). The reference temperature T equals the temperature that the spacecraft would have if it spun with infinite angular speed so that the solar heating would be uniform around the craft. We nondimensionalized the temperature with respect to T . We begin by introducing the new variables (4.6.29) and so that (4.6.26) becomes (4.6.30) Next, we expand F( ) as a Fourier series because it is a periodic function of period 1. Because it is an even function, (4.6.31) where (4.6.32) Fourier Series 247 (4.6.33) and (4.6.34) (4.6.35) if n 2. Therefore, (4.6.36) From the method of undetermined coefficients, the particular solution is (4.6.37) which yields (4.6.38) and (4.6.39) Substituting into (4.6.30), 248 Advanced Engineering Mathematics with MATLAB (4.6.40) To satisfy (4.6.40) for any , we set (4.6.41) (4.6.42) (4.6.43) (4.6.44) and (4.6.45) or (4.6.46) (4.6.47) Fourier Series 249 (4.6.48) and (4.6.49) Figure 4.6.1: Temperature distribution along the equator of a spinning spherical satellite. (From Hrycak, P., 1963: Temperature distribution in a spinning spherical space vehicle. AIAA J., 1, 97. 1963 AIAA, reprinted with permission.) Substituting for a0, a1, b1, a2n, and b2n, the particular solution is (4.6.50) 250 Advanced Engineering Mathematics with MATLAB Figure 4.6.1 is from Hrycak's paper and shows the variation of the nondimensional temperature as a function of for the spinning rate v0. The other parameters are typical of a satellite with aluminum skin and fully covered with glass-protected solar cells. As a check on the solution, we show the temperature field (the dashed line) of a nonrotating satellite where we neglect the effects of conduction and only radiation occurs. The difference between the v0=0 solid solid and dashed lines arises primarily due to the linearization of the nonlinear radiation boundary condition during the derivation of the governing equations. Problems Solve the following ordinary differential equations by Fourier series if the forcing is given by the periodic function and f(t)=f(t+2 ): 1. y y=f(t), 2. y +y=f(t), 3. y 3y +2y=f(t). Solve the following ordinary differential equations by complex Fourier series if the forcing is given by the periodic function f(t)=|t| t , and f(t)=f(t+2 ): 4. y y=f(t), 5. y +4y=f(t). 6. An object radiating into its nocturnal surrounding has a temperature y(t) governed by the equation19 where the constant a is the heat loss coefficient and the Fourier series describes the temporal variation of the atmospheric air temperature and the effective sky temperature. If y(0)=T0, find y(t). 7. The equation that governs the charge q on the capacitor of an LRC electrical circuit is q +2 q + 19 2 q= 2 E, Reprinted from Solar Energy, 28, M.S.Sodha, Transient radiative cooling, 541, 1982, with the kind permission from Elsevier Science Ltd, The Boulevard, Langford Lane, Kidlington, OX5 1GB, UK. Fourier Series 251 where =R/(2L), 2=1/(LC), R denotes resistance, C denotes capacitance, L denotes the inductance, and E is the electromotive force driving the circuit. If E is given by find q(t). 4.7 FINITE FOURIER SERIES In many applications we must construct a Fourier series from values given by data or a graph. Unlike the situation with analytic formulas where we have an infinite number of data points and, consequently, an infinite number of terms in the Fourier series, the Fourier series contain a finite number of sines and cosines where the number of coefficients equals the number of data points. Assuming that these series are useful, the next question is how do we find the Fourier coefficients? We could compute them by numerically integrating (4.1.6). However, the results would suffer from the truncation errors that afflict all numerical schemes. On the other hand, we can avoid this problem if we again employ the orthogonality properties of sines and cosines, now in their discrete form. Just as in the case of conventional Fourier series, we can use these properties to derive formulas for computing the Fourier coefficients. These results will be exact except for roundoff errors. We start by deriving some preliminary results. Let us define xm= mP/(2N). Then, if k is an integer, (4.7.1) (4.7.2) because r2N=exp(2 ki)=1 if r 1. If r=1, then the sum consists of 2N terms, each of which equals one. The condition r=1 corresponds to k=0, 2N, 4N,.... Taking the real and imaginary part of (4.7.2), (4.7.3) 252 Advanced Engineering Mathematics with MATLAB and (4.7.4) for all k. Consider now the following sum: (4.7.5) (4.7.6) Let us simplify the right side of (4.7.6) by restricting ourselves to k+j lying between 0 to 2N. This is permissible because of the periodic nature of (4.7.5). If k+j=0, k=j=0; if k+j=2N, k=j=N. In either case, k j=0 and the right side of (4.7.6) equals 2N. Consider now the case k j. Then k+j 0 or 2N and k j 0 or 2N. The right side of (4.7.6) must equal 0. Finally, if k=j 0 or N, then k+j 0 or 2N but k j=0 and the right side of (4.7.6) equals N. In summary, (4.7.7) In a similar manner, (4.7.8) for all k and j and (4.7.9) Armed with (4.7.7)(4.7.9) we are ready to find the coefficients An and Bn of the finite Fourier series, Fourier Series 253 (4.7.10) where we have 2N data points and now define P as the period of the function. To find Ak we proceed as before and multiply (4.7.10) by cos(2 jx/P) (j may take on values from 0 to N) and sum from 0 to 2N 1. At the point x=xm, (4.7.11) If j 0 or N, then the first summation on the right side vanishes by (4.7.3), the third by (4.7.9), and the fourth by (4.7.7). The second summation does not vanish if k=j and equals N. Similar considerations lead to the formulas for the calculation of Ak and Bk: (4.7.12) and (4.7.13) If there are 2N+1 data points and f(x0)=f(x2N), then (4.7.12)(4.7.13) is still valid and we need only consider the first 2N points. If f(x0) f(x2N), we can still use our formulas if we require that the endpoints have the value of [f(x0)+f(x2N)]/2. In this case the formulas for the coefficients Ak and Bk are (4.7.14) 254 Advanced Engineering Mathematics with MATLAB where k=0, 1, 2,..., N, and (4.7.15) where k=1, 2,..., N 1. It is important to note that 2N data points yield 2N Fourier coefficients Ak and Bk. Consequently our sampling frequency will always limit the amount of information, whether in the form of data points or Fourier coefficients. It might be argued that from the Fourier series representation of f(t) we could find the value of f(t) for any given t, which is more than we can do with the data alone. This is not true. Although we can calculate f(t) at any t using the finite Fourier series, the values may or may not be correct since the constraint on the finite Fourier series is that the series must fit the data in a least squared sense. Despite the limitations imposed by only having a finite number of Fourier coefficients, the Fourier analysis of finite data sets yields valuable physical insights into the processes governing many physical systems. Example 4.7.1: Water depth at Buffalo, NY Each entry20 in Table 4.7.1 gives the observed depth of water at Buffalo, NY (minus the low-water datum of 568.6ft) on the 15th of the corresponding Table 4.7.1: The Depth of Water in the Harbor at Buffalo, NY (Minus the Low-Water Datum of 568.8ft) on the 15th Day of Each Month During 1977 mo Jan Feb Mar Apr n 1 2 3 4 depth 1.61 1.57 2.01 2.68 mo May Jun Jul Aug n 5 6 7 8 depth 3.16 2.95 3.10 2.90 mo Sep Oct Nov Dec n 9 10 11 12 depth 2.42 2.95 2.74 2.63 month during 1977. Assuming that the water level is a periodic function of 1 year, and that we took the observations at equal intervals, let us construct a finite Fourier series from these data. This corresponds to computing the Fourier coefficients A0, A1,..., A6, B1,..., B5, which give the mean level and harmonic fluctuations of the depth of water, the harmonics having the periods 12 months, 6 months, 4 months, and so forth. 20 National Ocean Survey, 1977: Great Lakes Water Level, 1977, Daily and Monthly Average Water Surface Elevations. National Oceanic and Atmospheric Administration. Fourier Series 255 In this problem, P equals 12 months, N=P/2=6mo and xm= mP/(2N)=m(12mo) /12mo=m. That is, there should be a data point for each month. From (4.7.12) and (4.7.13), (4.7.16) and (4.7.17) Substituting the data into (4.7.16)(4.7.17) yields A0=twice the mean level =+5.120ft A1=harmonic component with a period of 12mo= 0.566ft B1=harmonic component with a period of 12mo= 0.128ft A2=harmonic component with a period of 6mo= 0.177ft B2=harmonic component with a period of 6mo= 0.372ft A3=harmonic component with a period of 4mo= 0.110ft B3=harmonic component with a period of 4mo= 0.123ft A4=harmonic component with a period of 3mo= 0.025ft B4=harmonic component with a period of 3mo=+0.052ft A5=harmonic component with a period of 2.4mo= 0.079ft B5=harmonic component with a period of 2.4mo= 0.131ft A6=harmonic component with a period of 2mo= 0.107ft Figure 4.7.1 is a plot of our results using (4.7.10). Note that when we include all of the harmonic terms, the finite Fourier series fits the data points exactly. The values given by 256 Advanced Engineering Mathematics with MATLAB Figure 4.7.1: Partial sums of the finite Fourier series for the depth of water in the harbor of Buffalo, NY during 1977. Circles indicate observations on the 15th of the month; crosses are observations on the first. the series at points between the data points may be right or they may not. To illustrate this, we also plotted the values for the first of each month. Fourier Series 257 Sometimes the values given by the Fourier series and these intermediate data points are quite different. Let us now examine our results in terms of various physical processes. In the long run the depth of water in the harbor at Buffalo, NY depends upon the three-way balance between precipitation, evaporation, and inflow-outflow of any rivers. Because the inflow and outflow of the rivers depends strongly upon precipitation, and evaporation is of secondary importance, the water level should correlate with the precipitation rate. It is well known that more precipitation falls during the warmer months rather than the colder months. The large amplitude of the Fourier coefficient A1 and B1, corresponding to the annual cycle (k=1), reflects this. Another important term in the harmonic analysis corresponds to the semiannual cycle (k=2). During the winter months around Lake Ontario, precipitation falls as snow. Therefore, the inflow from rivers is greatly reduced. When spring comes, the snow and ice melt and a jump in the water level occurs. Because the second harmonic gives periodic variations associated with seasonal variations, this harmonic is absolutely necessary if we want to get the correct answer while the higher harmonics do not represent any specific physical process. Example 4.7.2: Numerical computation of Fourier coefficients At the begining of this chapter, we showed how you could compute the Fourier coefficients a0, an, and bn from (4.1.6) given a function f(t). All of this assumed that you could carry out the integrations. What do you do if you cannot perform the integrations? The obvious solution is perform it numerically. In this section we showed that the best approximation to (4.1.6) is given by (4.7.12)(4.7.13). In the case when we have f(t) this is still true but we may choose N as large as necessary to obtain the desired number of Fourier coefficients. To illustrate this we have redone Example 4.1.1 and ploted the exact (analytic) and numerically computed Fourier coefficients in Figure 4.7.2. This figure was created using the MATLAB script 258 Advanced Engineering Mathematics with MATLAB Figure 4.7.2: The computation of Fourier coefficients using a finite Fourier series when f(t) is given by (4.1.8). The circles give an and bn as computed from (4.1.9), (4.1.11), and (4.1.13). The crosses give the corresponding Fourier coefficients given by the finite Fourier series with N=15. Fourier Series 259 It shows that a relative few data points can yield quite reasonable answers. Let us examine this script a little closer. One of the first things that you will note is that there is no explicit reference to (4.7.12)(4.7.13). How did we get the correct answer? Although we could have coded (4.7.12)(4.7.13), no one does that any more. In the 1960s, J.W.Cooley and J.W.Tukey21 devised an incredibly clever method of performing (4.7.12)(4.7.13). This method, commonly called a fast Fourier transform or FFT, is so popular that all computational packages contain it as an intrinsic function and MATLAB is no exception, calling it fft. This is what has been used here. Although we now have a fft to compute the coefficients, this routine does not directly give the coefficients an and bn but rather some mysterious (complex) number that is related to an+ibn. This is a common problem in using a package's FFT rather than your own and why the script divides by N and we keep changing the sign. The best method for discovering how to extract the coefficients an and bn is to test it with a dataset created by a simple, finite series such as f(x)=20+cos(t)+3sin(t)+6cos(2t) 20sin(2t) 10cos(3t) 30sin(3t). (4.7.18) If the code is correct, it must give back the coefficient in (4.7.18) to within round-off. Otherwise, something is wrong. Finally, most FFTs assume that the dataset will start repeating after the final data point. Therefore, when reading in the dataset, the point corresponding to x=L must be excluded. Example 4.7.3: Aliasing In the previous example, we could only resolve phenomena with a period of 2 months or greater although we had data for each of the 12 months. This is an example of Nyquist's sampling criteria22: At least two samples are required to resolve the highest frequency in a periodically sampled record. Figure 4.7.3 will help explain this phenomenon. In case (a) we have quite a few data points over one cycle. Consequently our picture, constructed from data, is fairly good. 21 Cooley, J.W., and J.W.Tukey, 1965: An algorithm for machine calculation of complex Fourier series. Math. Comput., 19, 297301. Nyquist, H., 1928: Certain topics in telegraph transmission theory. AIEE Trans., 47, 617644. 22 260 Advanced Engineering Mathematics with MATLAB Figure 4.7.3: The effect of sampling in the representation of periodic functions. In case (b), we took only samples at the ridges and troughs of the wave. Although our picture of the real phenomenon is poor, at least we know that there is a wave. From this picture we see that even if we are lucky enough to take our observations at the ridges and troughs of a wave, we need at least two data points per cycle (one for the ridge, the other for the trough) to resolve the highest-frequency wave. In case (c) we have made a big mistake. We have taken a wave of frequency N Hz and misrepresented it as a wave of frequency N/2Hz. This misrepresentation of a highfrequency wave by a lower-frequency wave is called aliasing. It arises because we are sampling a continuous signal at equal intervals. By comparing cases (b) and (c), we see that there is a cutoff between aliased and nonaliased frequencies. This frequency is called the Nyquist or folding frequency. It corresponds to the highest frequency resolved by our finite Fourier analysis. Because most periodic functions require an infinite number of harmonics for their representation, aliasing of signals is a common problem. Thus the question is not "can I avoid aliasing?" but "can I live with it?" Quite often, we can construct our experiments to say yes. An example where aliasing is unavoidable occurs in a Western at the movies when we see the rapidly rotating spokes of the stagecoach's wheel. A movie is a sampling of continuous motion where we present the data as a succession of pictures. Consequently, a film aliases the high rate of revolution of the stagecoach's wheel in such a manner so that it appears to be stationary or rotating very slowly. Fourier Series 261 Figure 4.7.4: The sea elevation at the mouth of the Chesapeake Bay from its average depth as a function of time after 1 July 1985. Example 4.7.4: Spectrum of the Chesapeake Bay For our final example, we perform a Fourier analysis of hourly sea-level measurements taken at the mouth of the Chesapeake Bay during the 2000 days from 9 April 1985 to 29 June 1990. Figure 4.7.4 shows 200 days of this record, starting from 1 July 1985. As this figure shows, the measurements contain a wide range of oscillations. In particular, note the large peak near day 90 which corresponds to the passage of hurricane Gloria during the early hours of 27 September 1985. Utilizing the entire 2000 days, we plotted the amplitude of the Fourier coefficients as a function of period in Figure 4.7.5. We see a general rise of the amplitude as the period increases. Especially noteworthy are the sharp peaks near periods of 12 and 24 hours. The largest peak is at 12.417 hours and corresponds to the semidiurnal tide. Thus, our Fourier analysis shows that the dominant oscillations at the mouth of the Chesapeake Bay are the tides. A similar situation occurs in Baltimore harbor. Furthermore, with this spectral information we could predict high and low tides very accurately. Although the tides are of great interest to some, they are a nuisance to others because they mask other physical processes that might be occurring. For that reason we would like to remove them from the tidal gauge history and see what is left. One way would be to zero out the Fourier coefficients corresponding to the tidal components and then plot the resulting Fourier series. Another method is to replace each hourly report with an average of hourly reports that occurred 24 hours ahead and behind of a particular report. We construct this average in such a manner that waves with periods of the tides sum to zero.23 23 See Godin, G., 1972: The Analysis of Tides. University of Toronto Press, 2.1. 262 Advanced Engineering Mathematics with MATLAB Figure 4.7.5: The amplitude of the Fourier coefficients for the sea elevation at the Chesapeake Bay bridge and tunnel (top) and Baltimore harbor (bottom) as a function of period. Such a filter is a popular method for eliminating unwanted waves from a record. Filters play an important role in the analysis of data. We plotted the filtered sea level data in Figure 4.7.6. Note that summertime (050 days) produces little variation in the sea level compared to wintertime (100150 days) when intense coastal stor ms occur. Fourier Series 263 Figure 4.7.6: Same as Figure 4.7.4 but with the tides removed. Problems Find the finite Fourier series for the following pieces of data: 1. f(0)=0, f(1)=1, f(2)=2, f(3)=3, and N=2. 2. f(0)=1, f(1)=1, f(2)= 1, f(3)= 1, and N=2. Project: Spectrum of the Earth's Orography Table 4.7.2 gives the orographic height of the earth's surface used in an atmospheric general circulation model (GCM) at a resolution of 2.5 longitude along the latitude belts of 28S, 36N, and 66N. In this project you will find the spectrum of this orographic field along the various latitude belts. Step 1: Write a MATLAB script that reads in the data and find An and Bn and then construct the amplitude spectra for this data. Step 2: Construct several spectra by using every data point, every other data point, etc. How do the magnitudes of the Fourier coefficient change? You might like to read about leakage from a book on harmonic analysis.24 For example, Bloomfield, P., 1976: Fourier Analysis of Time Series: An Introduction. John Wiley &: Sons, 258 pp. 24 264 Advanced Engineering Mathematics with MATLAB Figure 4.7.7: The orography of the earth and its spectrum in meters along three latitude belts using a topography dataset with a resolution of 1.25 longitude. Step 3: Compare and contrast the spectra from the various latitude belts. How do the magnitudes of the Fourier coefficients decrease with n? Why are there these differences? Step 4: You may have noted that some of the heights are negative, even in the middle of the ocean! Take the original data (for any latitude belt) and zero out all of the negative heights. Find the spectra for this new data set. How have the spectra changed? Is there a reason why the negative heights were introduced? Fourier Series Table 4.7.2: Orographic Heights (in m) Times the Gravitational Acceleration Constant (g=9.81m/s2) Along Three Latitude Belts 265 Longitude 180.0 177.5 175.0 172.5 170.0 167.5 165.0 162.5 160.0 157.5 155.0 152.5 150.0 147.5 145.0 142.5 140.0 137.5 135.0 132.5 130.0 127.5 125.0 122.5 120.0 117.5 115.0 112.5 110.0 107.5 105.0 102.5 100.0 28S 4. 1. 1. 1. 1. 1. 1. 0. 1. 0. 0. 1. 1. 6. 14. 6. 2. 0. 2. 1. 2. 0. 2. 1. 3. 2. 3. 7. 12. 9. 5. 3. 5. 36N 3. 2. 2. 3. 1. 3. 1. 0. 6. 1. 3. 2. 4. 1. 3. 1. 6. 3. 5. 2. 0. 5. 423. 3688. 10919. 16148. 17624. 18132. 19511. 22619. 20273. 12914. 7434. 66N 2532. 1665. 1432. 1213. 501. 367. 963. 1814. 2562. 3150. 4008. 4980. 6011. 6273. 5928. 6509. 7865. 7752. 6817. 6272. 5582. 4412. 3206. 2653. 2702. 3062. 3344. 3444. 3262. 3001. 2931. 2633. 1933. Longitude 82.5 80.0 77.5 75.0 72.5 70.0 67.5 65.0 62.5 60.0 57.5 55.0 52.5 50.0 47.5 45.0 42.5 40.0 37.5 35.0 32.5 30.0 27.5 25.0 22.5 20.0 17.5 15.0 12.5 10.0 7.5 5.0 2.5 28S 36. 64. 138. 363. 4692. 19317. 21681. 9222. 1949. 774. 955. 2268. 4636. 4621. 1300. 91. 57. 25. 13. 10. 8. 4. 6. 2. 3. 3. 1. 1. 0. 1. 0. 1. 0. 36N 4047. 3938. 1669. 236. 31. 8. 0. 2. 2. 0. 5. 6. 1. 2. 4. 1. 1. 4. 1. 6. 2. 22. 33. 39. 2. 11. 6. 19. 18. 490. 2164. 4728. 5347. 66N 737. 185. 71. 160. 823. 1830. 3000. 3668. 2147. 391. 77. 601. 3266. 9128. 17808. 22960. 20559. 14296. 9783. 5969. 1972. 640. 379. 286. 981. 1971. 2576. 1692. 357. 21. 5. 10. 0. 266 Advanced Engineering Mathematics with MATLAB 97.5 95.0 92.5 90.0 87.5 85.0 15.0 17.5 20.0 22.5 25.0 27.5 30.0 32.5 35.0 37.5 40.0 42.5 45.0 47.5 50.0 52.5 55.0 57.5 60.0 62.5 65.0 67.5 70.0 72.5 75.0 77.5 80.0 82.5 85.0 87.5 6. 8. 8. 12. 18. 23. 2208. 6566. 9091. 10690. 12715. 14583. 11351. 3370. 15. 49. 31. 20. 17. 19. 18. 6. 2. 3. 3. 2. 1. 2. 0. 2. 1. 1. 0. 1. 2. 1. 4311. 2933. 2404. 1721. 1681. 2666. 1313. 862. 1509. 2483. 1697. 3377. 7682. 9663. 10197. 10792. 11322. 13321. 15414. 12873. 6114. 2962. 4913. 6600. 4885. 3380. 5842. 12106. 23032. 35376. 36415. 26544. 19363. 17915. 22260. 30442. 1473. 1689. 2318. 2285. 1561. 1199. 5263. 5646. 3672. 1628. 889. 1366. 1857. 1534. 993. 863. 756. 620. 626. 836. 1029. 946. 828. 1247. 2091. 2276. 1870. 1215. 680. 531. 539. 579. 554. 632. 791. 1455. 0.0 2.5 5.0 7.5 10.0 12.5 97.5 100.0 102.5 105.0 107.5 110.0 112.5 115.0 117.5 120.0 122.5 125.0 127.5 130.0 132.5 135.0 137.5 140.0 142.5 145.0 147.5 150.0 152.5 155.0 157.5 160.0 162.5 165.0 167.5 170.0 4. 5. 7. 13. 28. 107. 0. 2. 0. 4. 2. 17. 302. 1874. 4005. 4989. 4887. 4445. 4362. 4368. 3485. 1921. 670. 666. 1275. 1865. 2452. 3160. 2676. 697. 67. 25. 12. 10. 5. 0. 2667. 1213. 1612. 1744. 1153. 838. 35538. 31985. 23246. 17363. 14315. 12639. 10543. 4967. 1119. 696. 475. 1631. 2933. 1329. 88. 598. 1983. 2511. 866. 13. 11. 4. 1. 0. 3. 3. 1. 4. 2. 1. 6. 1. 31. 58. 381. 2472. 6222. 5523. 4823. 4689. 4698. 4674. 4435. 3646. 2655. 2065. 1583. 3072. 7290. 8541. 7078. 7322. 9445. 10692. 9280. 8372. 6624. 3617. 2717. 3474. 4337. 4824. 5525. 6323. 5899. 4330. Fourier Series 90.0 92.5 95.0 3. 1. 0. 33601. 30873. 31865. 3194. 4878. 5903. 172.5 175.0 177.5 0. 4. 3. 4. 3. 1. 267 3338. 3408. 3407. Chapter 5 The Fourier Transform In the previous chapter we showed how we could expand a periodic function in terms of an infinite sum of sines and cosines. However, most functions encountered in engineering are aperiodic. As we shall see, the extension of Fourier series to these functions leads to the Fourier transform. 5.1 FOURIER TRANSFORMS The Fourier transform is the natural extension of Fourier series to a function f(t) of infinite period. To show this, consider a periodic function f(t) of period 2T that satisfies the so-called Dirichlet's conditions.1 If the integral complex Fourier series exists, this function has the (5.1.1) where (5.1.2) Equation (5.1.1) applies only if f(t) is continuous at t; if f(t) suffers from a jump discontinuity at t, then the left side of (5.1.1) equals f(t+)=limx t+ f(x) and f(t )=limx t f(x). Substituting (5.1.2) into (5.1.1), where (5.1.3) Let us now introduce the notation n =n /T so that n = n+1 n = /T. Then, A function f(t) satisfies Dirichlet's conditions in the interval (a, b) if (1) it is bounded in (a, b), and (2) it has at most a finite number of discontinuities and a finite number of maxima and minima in that interval. 1 The Fourier Transform 269 (5.1.4) where (5.1.5) As T , n approaches a continuous variable , and infinitesimal d . Therefore, ignoring any possible difficulties, n 2 may be interpreted as the (5.1.6) and (5.1.7) Equation (5.1.7) is the Fourier transform of f(t) while (5.1.6) is the inverse Fourier transform which converts a Fourier transform back to f(t). Alternatively, we may combine (5.1.6)(5.1.7) to yield the equivalent real form (5.1.8) Hamming3 suggested the following analog in understanding the Fourier transform. Let us imagine that f(t) is a light beam. Then the Fourier transform, like a glass prism, breaks up the function into its component frequencies each of intensity F( ). In optics, the various frequencies are called colors; by analogy the Fourier transform gives us the color 2 For a rigorous derivation, see Titchmarsh, E.C., 1948: Introduction to the Theory of Fourier Integrals. Oxford University Press, Chapter 1. Hamming, R.W., 1977: Digital Filters. Prentice-Hall, p. 136. 3 270 Advanced Engineering Mathematics with MATLAB spectrum of a function. On the other hand, the inverse Fourier transform blends a function's spectrum to give back the original function. Most signals encountered in practice have Fourier transforms because they are absolutely integrable since they are bounded and of finite duration. However, there are some notable exceptions. Examples include the trigonometric functions sine and cosine. Example 5.1.1 Let us find the Fourier transform for (5.1.9) From the definition of the Fourier transform, (5.1.10) (5.1.11) where sinc(x)=sin(x)/x is the sinc function. Although this particular example does not show it, the Fourier transform is, in general, a complex function. The most common method of displaying it is to plot its amplitude and phase on two separate graphs for all values of . Another problem here is ratio of 0/0 when =0. Applying L'HpitaPs rule, we find that F(0)=2. Thus, we can plot the amplitude and phase of F( ) using the MATLAB script: The Fourier Transform 271 Figure 5.1.1: Graph of the Fourier transform for (5.1.9). Figure 5.1.1 shows the output from the MATLAB script. Of these two quantities, the amplitude is by far the more popular one and is given the special name of frequency spectrum From the definition of the inverse Fourier transform, (5.1.12) An important question is what value does f(t) converge to in the limit as ta and t ? Because Fourier transforms are an extension of Fourier series, the behavior at a jump is the same as that for a Fourier series. For that reason, and 272 Advanced Engineering Mathematics with MATLAB Figure 5.1.2: Graph of the function given in (5.1.15) for =300. Example 5.1.2: Dirac delta function Of the many functions that have a Fourier transform, a particularly important one is the (Dirac) delta function.4 For example, in 5.6 we will use it to solve differential equations. We define it as the inverse of the Fourier transform F( )=1. Therefore, (5.1.13) To give some insight into the nature of the delta function, consider another band-limited transform (5.1.14) where is real and positive. Then, (5.1.15) , f (t) Figure 5.1.2 illustrates f (t) for a large value of . We observe that as becomes very large near t=0 as well as very narrow. On the other hand, f (t) rapidly approaches zero as |t| increases. Therefore, the delta function is given by the limit (5.1.16) 4 Dirac, P.A.M., 1947: The Principles of Quantum Mechanics. Oxford University Press, 15. The Fourier Transform or 273 (5.1.17) Table 5.1.1: The Fourier Transforms of Some Commonly Encountered Functions f(t), |t|< 1. 2. e atH(t), a>0 eatH( t) a>0 te atH(t), a>0 teatH( t), a>0 tne atH(t), Re(a)>0, n=1, 2,... e a|t|, a>0 te a|t|, a>0 F( ) 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. Note: The Heaviside step function H(t) is defined by (5.1.31). 274 Advanced Engineering Mathematics with MATLAB Because the Fourier transform of the delta function equals one, (5.1.18) Since (5.1.18) must hold for any , we take =0 and find that (5.1.19) Thus, the area under the delta function equals unity. Taking (5.1.17) into account, we can also write (5.1.19) as (5.1.20) Finally, from the law of the mean of integrals, we have the sifting property that (5.1.21) if a<t0<b. This property is given its name because (t t0) acts as a sieve, selecting from all possible values of f(t) its value at t=t0. We can also use several other functions with equal validity to represent the delta function. These include the limiting case of the following rectangular or triangular distributions: (5.1.22) or (5.1.23) The Fourier Transform and the Gaussian function: 275 (5.1.24) Note that the delta function is an even function. Example 5.1.3: Multiple Fourier transforms The concept of Fourier transforms can be extended to multivariable functions. Consider a two-dimensional function f(x, y). Then, holding y constant, (5.1.25) Then, holding constant, (5.1.26) Therefore, the double Fourier transform of f(x, y) is (5.1.27) assuming that the integral exists. In a similar manner, we can compute f(x, y) given F( , ) by reversing the process. Starting with (5.1.28) followed by (5.1.29) 276 Advanced Engineering Mathematics with MATLAB we find that (5.1.30) Example 5.1.4: Computation of Fourier transforms using MATLAB The Heaviside (unit) step function is a piecewise continuous function defined by (5.1.31) where a 0. We will have much to say about this very useful function in the chapter on Laplace transforms. Presently we will use it to express functions whose definition changes over different ranges of t. For example, the "top hat" function (5.1.9) can be rewritten f(t)=H(t+a) H(t a). We can see that this is correct by considering various ranges of t. For example, if t< a, both step functions equal zero and f(t)=0. On the other hand, if t>a, both step functions equal one and again f(t)=0. Finally, for a<t<a, the first step function equals one while the second one equals zero. In this case, f(t)=1. Therefore, f(t)=H(t+a) H(t a) is equivalent to (5.1.9). This ability to rewrite functions in terms of the step function is crucial if you want to use MATLAB to compute Fourier transform via the MATLAB routine fourier. For example, how would we compute the Fourier transform of the signum function? The MATLAB commands Problems 1. (a) Show that the Fourier transform of f(t)=e is |t| , a>0, Using MATLAB, plot the amplitude and phase spectra for this transform. (b) Use MATLAB's fourier to find F( ). The Fourier Transform 2. (a) Show that the Fourier transform of f(t)=te is a|t| 277 , a>0, Using MATLAB, plot the amplitude and phase spectra for this transform. (b) Use MATLAB's fourier to find F( ). 3. (a) Show that the Fourier transform of is Using MATLAB, plot the amplitude and phase spectra for this transform. (b) Use MATLAB's fourier to find F( ). 4. (a) Show that the Fourier transform of is Using MATLAB, plot the amplitude and phase spectra for this transform. (b) Rewrite f(t) in terms of step functions. Then use MATLAB's fourier to find F( ). 5. (a) Show that the Fourier transform of is 278 Advanced Engineering Mathematics with MATLAB Using MATLAB, plot the amplitude and phase spectra for this transform. (b) Rewrite f(t) in terms of step functions. Then use MATLAB's fourier to find F( ). 6. (a) Show that the Fourier transform of is Using MATLAB, plot the amplitude and phase spectra for this transform. (b) Rewrite f(t) in terms of step functions. Then use MATLAB's fourier to find F( ). 7. (a) Show that the Fourier transform of is Using MATLAB, plot the amplitude and phase spectra for this transform. (b) Rewrite f(t) in terms of step functions. Then use MATLAB's fourier to find F( ). 8. (a) Show that the Fourier transform of is Using MATLAB, plot the amplitude and phase spectra for this transform. (b) Rewrite f(t) in terms of step functions. Then use MATLAB's fourier to find F( ). The Fourier Transform 9. (a) Show that the Fourier transform of 279 is Using MATLAB, plot the amplitude and phase spectra for this transform. (b) Rewrite f(t) in terms of step functions. Then use MATLAB's fourier to find F( ). 10. (a) Show that the Fourier transform of is Using MATLAB, plot the amplitude and phase spectra for this transform. (b) Rewrite f(t) in terms of step functions. Then use MATLAB's fourier to find F( ). 11. (a) Show that the Fourier transform of is Using MATLAB, plot the amplitude and phase spectra for this transform. (b) Rewrite f(t) in terms of step functions. Then use MATLAB's fourier to find F( ). 12. The integral representation5 of the modified Bessel function Kv( ) is 5 Watson, G.N., 1966: A Treatise on the Theory of Bessel Functions. Cambridge University Press, p. 185. 280 Advanced Engineering Mathematics with MATLAB where ( ) is the gamma function, v 0 and a>0. Use this relationship to show that 13. Show that the Fourier transform of a constant K is 2 14. Show that ( )K. Hint: Use integration by parts. 15. For the real function f(t) with Fourier transform F( ), prove that |F( )|=|F( and the phase of F( ) is an odd function of . 5.2 FOURIER TRANSFORMS CONTAINING THE DELTA FUNCTION )| In the previous section we stressed the fact that such simple functions as cosine and sine are not absolutely integrable. Does this mean that these functions do not possess a Fourier transform? In this section we shall show that certain functions can still have a Fourier transform even though we cannot compute them directly. The reason why we can find the Fourier transform of certain functions that are not absolutely integrable lies with the introduction of the delta function because (5.2.1) for all t. Thus, the inverse of the Fourier transform ( or 0 ) is the complex exponential (5.2.2) This yields immediately the result that F(1)=2 ( ), (5.2.3) The Fourier Transform if we set 0 281 =0. Thus, the Fourier transform of 1 is an impulse at =0 with weight 2 . Because the Fourier transform equals zero for all 0, f(t)=1 does not contain a nonzero frequency and is consequently a DC signal. Another set of transforms arises from Euler's formula because we have that (5.2.4) = [ ( 0 ) ( + 0 )]/i (5.2.5) = i ( 0 )+ i ( + 0 )( + 0 ) (5.2.6) and (5.2.7) = [ ( 0 )+ ( + 0 )]. (5.2.8) Note that although the amplitude spectra of sin( 0 t) and cos( 0 t) are the same, their phase spectra are different. Let us consider the Fourier transform of any arbitrary periodic function. Recall that any such function f(t) with period 2L can be rewritten as the complex Fourier series (5.2.9) where 0 = /L. The Fourier transform of f(t) is (5.2.10) Therefore, the Fourier transform of any arbitrary periodic function is a sequence of impulses with weight 2 cn located at =n 0 with n=0, 1, 2, .... Thus, the Fourier series and transform of a periodic function are closely related. 282 Advanced Engineering Mathematics with MATLAB Example 5.2.1: Fourier transform of the sign function Consider the sign function (5.2.11) The function is not absolutely integrable. However, let us approximate it by where is a small positive number. This new function is absolutely integrable and we have that (5.2.12) (5.2.13) If 0, (5.2.13) equals 2/i . If =0, (5.2.13) equals 0 because (5.2.14) Thus, we conclude that (5.2.15) Example 5.2.2: Fourier transform of the step function An important function in transform methods is the (Heaviside) step function (5.2.16) In terms of the sign function it can be written (5.2.17) The Fourier Transform Because the Fourier transforms of 1 and sgn(t) are 2 have that 283 ( ) and 2/i , respectively, we (5.2.18) These transforms are used in engineering but the presence of the delta function requires extra care to ensure their proper use. Problems 1. Verify that 2. Verify that 3. Using the definition of Fourier transforms and (5.2.18), show that 4. Following Example 5.2.1, show that and 5.3 PROPERTIES OF FOURIER TRANSFORMS In principle we can compute any Fourier transform from its definition. However, it is far more efficient to derive some simple relationships that relate transforms to each other. This is the purpose of this section. 284 Advanced Engineering Mathematics with MATLAB Linearity If f(t) and g(t) are functions with Fourier transforms F( ) and G( ), respectively, then F[c1f(t)+c2g(t)]=c1F( )+c2G( ), (5.3.1) where c1 and c2 are (real or complex) constants. This result follows from the integral definition (5.3.2) (5.3.3) =c1F( )+c2G( ). (5.3.4) Figure 5.3.1: The amplitude and phase spectra of the Fourier transform for cos(2t) H(t) (solid line) and cos[2(t 1)]H(t 1) (dashed line). The amplitude becomes infinite at =2. The Fourier Transform Time shifting If f(t) is a function with a Fourier transform F( ), then F[f(t This follows from the definition of the Fourier transform )]= e i 285 F( ). (5.3.5) (5.3.6) Example 5.3.1 The Fourier transform of f(t)=cos(at)H(t) is F( )=i /(a2 Therefore, F{cos[a(t k)]H(t k)}=e ik 2 )+ [ ( +a)+ ( a)]/2. F[cos(at)H(t)], (5.3.7) or (5.3.8) In Figure 5.3.1 we present the amplitude and phase spectra for cos(2t) H(t) (the solid line) while the dashed line gives these spectra for cos[2(t 1)]H(t 1). This figure shows that the amplitude spectra are identical (why?) while the phase spectra are considerably different. Scaling factor Let f(t) be a function with a Fourier transform F( ) and k be a real, nonzero constant. Then F[f(kt)]=F(+/k)/|k|. From the definition of the Fourier transform: (5.3.9) 286 Advanced Engineering Mathematics with MATLAB Example 5.3.2 The Fourier transform of f(t)=e H(t) is F( )=1/(1+ i). Therefore, the Fourier transform for f(at)=e atH(t), a>0, is (5.3.10) To illustrate this scaling property we use the MATLAB script t Figure 5.3.2: The amplitude and phase spectra of the Fourier transform for e tH(t) (solid line) and e 2tH(t) (dashed line) The Fourier Transform 287 to plot the amplitude and phase when a=1 and a=2. Figure 5.3.2 shows the results from the MATLAB script: The amplitude spectra decreased by a factor of two for e 2tH(t) compared to e tH(t) while the differences in the phase are smaller. Symmetry If the function f(t) has the Fourier transform F( ), then F[F(t)]= 2 F( From the definition of the inverse Fourier transform, ). (5.3.11) Then (5.3.12) Example 5.3.3 The Fourier transform of 1/(1+t2) is e | | . Therefore, (5.3.13) or (5.3.14) Derivatives of functions Let f(k)(t), k=0, 1, 2,..., n 1, be continuous and f(n)(t) be piecewise continuous. Let |f(k)(t)| Ke bt, b>0, 0 t< ;|f(k)(t)| Meat, a> 0, <t 0, k=0, 1,..., n. Then, F[f(n) (t)]=(i )n F( ). 288 Advanced Engineering Mathematics with MATLAB We begin by noting that if the transform f[f (t)] exists, then (5.3.15) (5.3.16) (5.3.17) (5.3.18) Finally, f[f(n)(t)]=i F[f(n 1) (t)]=(i )2F[f(n 2) (t)]=...=(i )nF( ). (5.3.19) Example 5.3.4 The Fourier transform of f(t)=1/(1+t2) is F( )= e | | . Therefore, (5.3.20) or (5.3.21) The Fourier Transform 289 Figure 5.3.3: The (amplitude) spectrum of a rectangular pulse (5.1.9) with a half width a=10 that has been modulated with cos(5t). Modulation In communications a popular method of transmitting information is by amplitude modulation (AM). In this process the signal is carried according to the expression where 0 is the carrier frequency and f(t) is an arbitrary function of time 0 whose amplitude spectrum peaks at some frequency that is usually small compared to We now show that the Fourier transform of is F( 0 . ), where F( ) is the Fourier transform of f(t). We begin by using the definition of the Fourier transform or (5.3.22) =F( 0 ). (5.3.23) Therefore, if we have the spectrum of a particular function f(t), then the Fourier transform of the modulated function centered on the frequency is the same as that for f(t) except that it is now rather than on the zero frequency. 0 290 Advanced Engineering Mathematics with MATLAB Example 5.3.5 Let us determine the Fourier transform of a square pulse modulated by a cosine wave as shown in Figures 5.3.3 and 5.3.4. Because Fourier transform of a square pulse is F( )=2sin( a)/ , and the (5.3.24) Figure 5.3.4: The (amplitude) spectrum of a rectangular pulse (5.1.9) with a half width a=10 that has been modulated with cos(t/2). Therefore, the Fourier transform of the modulated pulse equals one half of the sum of the Fourier transform of the pulse centered on 0 and . See Figures 5.3.3 and 5.3.4. 0 In many practical situations, effect on the peak at = . 0 Example 5.3.6 The Fourier transform of f(t)=e bt 0 /a. In this case we may treat each term as completely = 0 independent from the other; the contribution from the peak at has a negligible H(t) is F( )=1/(b+i ). Therefore, (5.3.25) (5.3.26) The Fourier Transform 291 (5.3.27) (5.3.28) We illustrate this result using e 2t H(t) and e 2t cos(4t)H(t) in Figure 5.3.5. Example 5.3.7: Frequency modulation In contrast to amplitude modulation, frequency modulation (FM) transmits information by instantaneous variations of the carrier frequency. It can be Figure 5.3.5: The amplitude and phase spectra of the Fourier transform for e 2tH(t) (solid line) and e 2t cos(4t)H(t) (dashed line). where C is a constant. To illustrate this concept, let us find the Fourier transform of a simple frequency modulation as exp (5.3.29) and C= 1 T/2. In this case, the signal in the time domain is 292 Advanced Engineering Mathematics with MATLAB (5.3.30) (5.3.31) We illustrate this signal in Figures 5.3.6 and 5.3.7. The Fourier transform of the signal G( ) equals (5.3.32) Figure 5.3.6: The (amplitude) spectrum |G( )|/T of a frequency-modulated signal (shown top) when 1T=2 and 0T=10 . The transform becomes undefined at = 0. The Fourier Transform 293 (5.3.33) Applying the fact that (5.3.34) (5.3.35) (5.3.36) Figures 5.3.6 and 5.3.7 illustrate the amplitude spectrum for various parameters. In general, the transform is not symmetric, with an increasing number of humped curves as T increases. 1 Parseval's equality In applying Fourier methods to practical problems we may encounter a situation where we are interested in computing the energy of a system. 294 Advanced Engineering Mathematics with MATLAB Figure 5.3.7: The (amplitude) spectrum |G( )|/T of a frequency-modulated signal (shown top) when 1T=8 and 0T=10 . The transform becomes undefined at = 0. Energy is usually expressed by the integral integral if we only have the Fourier transform of F( )? From the definition of the inverse Fourier transform Can we compute this (5.3.37) we have that (5.3.38) Interchanging the order of integration on the right side of (5.3.38), (5.3.39) However, Therefore, (5.3.40) The Fourier Transform 295 (5.3.41) Table 5.3.1: Some General Properties of Fourier Transforms function, f(t) 1. Linearity 2. Complex conjugate 3. Scaling 4. Delay 5. Frequency translation 6. Duality-time frequency 7. Time differentiation F(t) f (t) c1f(t)+c2g(t) f*(t) f( t) f(t ) Fourier transform, F( ) c1F( )+c2G( ) F*( ) F( / )/| | e i F( ) F( 2 f( 0 ) ) i F( ) This is Parseval's equality6 as it applies to Fourier transforms. The quantity |F( )|2 is called the power spectrum. Example 5.3.8 In Example 5.1.1, we showed that the Fourier transform for a unit rectangular pulse between a<t<a is 2sin( a)/ . Therefore, by Parseval's equality, (5.3.42) or (5.3.43) 6 Apparently first derived by Rayleigh, J.W., 1889: On the character of the complete radiation at a given temperature. Philos. Mag., Ser. 5, 27, 460469. 296 Advanced Engineering Mathematics with MATLAB Poisson's summation formula If f(x) is integrable over ( , ), there exists a relationship between the function and its Fourier transform, commonly called Poisson's summation formula.7 We begin by inventing a periodic function g(x) defined by (5.3.44) Because g(x) is a periodic function of 2 , it can be represented by the complex Fourier series: (5.3.45) or (5.3.46) Computing cn, we find that (5.3.47) (5.3.48) (5.3.49) where F( ) is the Fourier transform of f(x). Substituting (5.3.49) into (5.3.46), we obtain (5.3.50) Poisson, S.D., 1823: Suite du mmoire sur les intgrales dfinies et sur la sommation des sries. J. cole Polytech., 19, 404509. See page 451. 7 The Fourier Transform or 297 (5.3.51) Example 5.3.9 One of the popular uses of Poisson's summation formula is the evaluation of infinite series. For example, let f(x)=1(a2+x2) with a real and nonzero. Then, F( )= e |a | /|a| and (5.3.52) (5.3.53) Problems 1. Find the Fourier transform of 1/(1+a2t2), where a is real, given that F[1/(1+t2)]= e | |. 2. Find the Fourier transform of cos(at)/(1+t2), where a is real, given that F[1/(1+t2)]= e | |. 3. Use the fact that F[e atH(t)]=1/(a+i ) with a>0 and Parseval's equality to show that 4. Use the fact that F[1/(1+t2)]= e | | and Parseval's equality to show that 5. Use the function f(t)=e at sin(bt)H(t) with >0 and Parseval's equality to show that 298 Advanced Engineering Mathematics with MATLAB 6. Using the modulation property and F[e bt H(t)] =1/(b+i ), show that Use MATLAB to plot and compare the amplitude and phase spectra for e tH(t) and e sin(2t) H(t). 7. Use Poisson's summation formula with f(t)=e |t| to show that t 8. Use Poisson's summation formula to prove8 that 9. Use Poisson's summation formula to prove that where ( ) is the Dirac delta function. 10. Prove the two-dimensional form9 of Poisson's summation formula: where First proved by Ewald, P.P., 1921: Die Berechnung optischer und elektrostatischer Gitterpotentiale. Ann. Phys., 4te Folge, 64, 253287. 9 8 Taken from Lucas, S.K., R.Sipcic, and H.A.Stone, 1997: An integral equation solution for the steady-state current at a periodic array of surface microelectrodes. SIAM J. Appl. Math., 57, 16151638. The Fourier Transform 5.4 INVERSION OF FOURIER TRANSFORMS 299 Having focused on the Fourier transform in the previous sections, we now consider the inverse Fourier transform. Recall that the improper integral (5.1.6) defines the inverse. Consequently one method of inversion is direct integration. Example 5.4.1 Let us find the inverse of F( )= e | | . From the definition of the inverse Fourier transform, (5.4.1) (5.4.2) An alternative to direct integration is the MATLAB function ifourier. For example, invert f F( )= e | |, we type in the commands: Another method for inverting Fourier transforms is rewriting the Fourier transform using partial fractions so that we can use transform tables. The following example illustrates this technique. Example 5.4.2 Let us invert the transform (5.4.3) 300 Advanced Engineering Mathematics with MATLAB We begin by rewriting (5.4.3) as (5.4.4) (5.4.5) Using Table 5.1.1, we invert (5.4.5) term by term and find that (5.4.6) To check our answer, we type the following commands into MATLAB: Although we may find the inverse by direct integration or partial fractions, in many instances the Fourier transform does not lend itself to these techniques. On the other hand, if we view the inverse Fourier transform as a line integral along the real axis in the complex -plane, then perhaps some of the techniques that we developed in Chapter 1 might be applicable to this problem. To this end, we rewrite the inversion integral (5.1.6) as (5.4.7) where C denotes a closed contour consisting of the entire real axis plus a new contour CR that joins the point ( , 0) to ( , 0). There are countless possibilities for CR. For , R) to ( , 0) with R>0. However, example, it could be the loop ( , 0) to ( , R) to ( The Fourier Transform any choice of CR must be such that we can compute 301 When we take that constraint into account, the number of acceptable contours decreases to just a few. The best is given by Jordan's lemma.10 Jordan's lemma: Suppose that, on a circular arc CR with radius R and center at the origin, f(z)0 uniformly as R . Then (1) (5.4.8) if CR lies in the first and/or second quadrant; (2) (5.4.9) if CR lies in the third and/or fourth quadrant; (3) (5.4.10) if CR lies in the second and/or third quadrant; and (4) (5.4.11) if CR lies in the first and/or fourth quadrant. Technically, only (1) is actually Jordan's lemma while the remaining points are variations. Proof: We shall prove the first part; the remaining portions follow by analog. We begin by noting that 10 Jordan, C., 1894: Cours D'Analyse de l'cole Polytechnique. Vol 2. Gauthier-Villars, pp. 285286. See also Whittaker, E.T., and G.N.Watson, 1963: A Course of Modern Analysis. Cambridge University Press, p. 115. 302 Advanced Engineering Mathematics with MATLAB (5.4.12) Now |dz|=Rd , |f(z)| MR, (5.4.13) |eimz|=|exp(imRe i)|=|exp{imR[cos( )+isin( )]}|=e mRsin( ) . (5.4.14) Therefore, (5.4.15) where 0 we take 0 0 < 1 . Because the integrand is positive, the right side of (5.4.15) is largest if 1 =0 and = . Then (5.4.16) We cannot evaluate the integrals in (5.4.16) as they stand. However, because sin( ) 2 / if 0 /2, we can bound the value of the integral by (5.4.17) If m>0, |IR| tends to zero with MR as R . Consider now the following inversions of Fourier transforms: Example 5.4.3 For our first example we find the inverse for (5.4.18) The Fourier Transform From the inversion integral, 303 (5.4.19) Figure 5.4.1: Contour used to find the inverse of the Fourier transform (5.4.18). The contour C consists of the line integral along the real axis plus CR. or (5.4.20) where C denotes a closed contour consisting of the entire real axis plus CR. Because f(z)=1/(z22ibz a2 b2) tends to zero uniformly as |z| and m=t, the second integral in (5.4.20) vanishes by Jordan's lemma if CR is a semicircle of infinite radius in the upper half of the z-plane when t>0 and a semicircle in the lower half of the z-plane when t<0. Next we must find the location and nature of the singularities. They are located at z2 2ibz a2 b2=0, (5.4.21) or z=a+bi. (5.4.22) 304 Advanced Engineering Mathematics with MATLAB Therefore we can rewrite (5.4.20) as (5.4.23) Thus, all of the singularities are simple poles. Consider now t>0. As stated earlier, we close the line integral with an infinite semicircle in the upper half-plane. See Figure 5.4.1. Inside this closed contour there are two singularities: z=a+bi. For these poles, (5.4.24) (5.4.25) where we used Euler's formula to eliminate eiat. Similarly, (5.4.26) Consequently the inverse Fourier transform follows from (5.4.23) after applying the residue theorem and equals (5.4.27) for t>0. For t<0 the semicircle is in the lower half-plane because the contribution from the semicircle vanishes as R . Because there are no singularities within the closed contour, f(t)=0. Therefore, we can write in general that (5.4.28) Example 5.4.4 Let us find the inverse of the Fourier transform where a is real and positive. (5.4.29) The Fourier Transform From the inversion integral, 305 (5.4.30) (5.4.31) where C denotes a closed contour consisting of the entire real axis plus CR. The contour CR is determined by Jordan's lemma because 1/(z2+a2)0 uniformly as |z| . Since m=t 1, the semicircle CR of infinite radius lies in the upper half-plane if t>1 and in the lower half-plane if t<1. Thus, if t>1, (5.4.32) whereas for t<1, (5.4.33) The minus sign in front of the 2 i arises from the clockwise direction or negative sense of the contour. We can write the inverse as the single expression (5.4.34) Example 5.4.5 Let us evaluate the integral (5.4.35) where a, k>0. We begin by noting that 306 Advanced Engineering Mathematics with MATLAB (5.4.36) where C1 denotes a line integral along the real axis from to . A quick check shows that the integrand of the right side of (5.4.36) satisfies Jordan's lemma. Therefore, (5.4.37) (5.4.38) where C denotes the closed infinite semicircle in the upper half-plane. Taking the real and imaginary parts of (5.4.38), (5.4.39) Figure 5.4.2: Contour used in Example 5.4.6. and (5.4.40) The Fourier Transform Example 5.4.6 307 Let us now invert the Fourier transform F( )=2a/(a2 2), where a is real. The interesting aspect of this problem is the presence of singularities at = which lie along the contour of integration. How do we use contour integration to compute (5.4.41) The answer to this question involves the concept of Cauchy principal value integrals which allows us to extend the conventional definition of integrals to include integrands that become infinite at a finite number of points. See 1.10. Thus, by treating (5.4.41) as a Cauchy principal value integral, we again convert (5.4.41) into a closed contour integration by closing the line integration along the real axis as shown in Figure 5.4.2. The semicircles at infinity vanish by Jordan's lemma and (5.4.42) For t>0, (5.4.43) Figure 5.4.3: Contour used in Example 5.4.7. 308 Advanced Engineering Mathematics with MATLAB We have the factor because we are only passing over the "top" of the singularity at z=a and z= a. Computing the residues and simiplifying the results, we obtain f(t)=sin(at). (5.4.44) Similarly, when t<0, (5.4.45) These results can be collapsed down to the single expression f(t)=sgn(t)sin(at). (5.4.46) Example 5.4.7 So far, we used only the first two points of Jordan's lemma. In this example11 we illustrate how the remaining two points may be applied. Consider the contour integral where c>0 and , are re+al. Let us evaluate this contour integral where the contour is shown in Figure 5.4.3. From the residue theorem, 11 Reprinted from Int. J. Heat M ss Transfer, 15, T.C.Hsieh and R.Greif, Theoretical determination of the absorption coefficient and the total band absorptance including a specific application to carbon monoxide, 14771487, 1972, with kind permission from Elsevier Science Ltd., The Boulevard, Langford Lane, Kidlington OX5 1GB, UK. The Fourier Transform 309 (5.4.47) Now (5.4.48) (5.4.49) (5.4.50) (5.4.51) and (5.4.52) 310 Advanced Engineering Mathematics with MATLAB (5.4.53) Therefore, (5.4.54) (5.4.55) where cot( )=i(e2i +1)/(e2i 1) and we made extensive use of Euler's formula. Let us now evaluate the contour integral by direct integration. The contribution from the integration along the semicircle at infinity vanishes according to Jordan's lemma. Indeed that is why this particular contour was chosen. Therefore, (5.4.56) Now, because z=iy, (5.4.57) The Fourier Transform 311 (5.4.58) (5.4.59) (5.4.60) and (5.4.61) In the limit of (5.4.62) (5.4.63) or 312 Advanced Engineering Mathematics with MATLAB (5.4.64) If we let y=x/2 , (5.4.65) Example 5.4.8 An additional benefit of understanding inversion by the residue method is the ability to qualitatively anticipate the inverse by knowing the location of the poles of F( ). This intuition is important because many engineering analyses discuss stability and performance entirely in terms of the properties of the system's Fourier transform. In Figure 5.4.4 we graphed the location of the poles of F( ) and the corresponding f(t). The student should go through the mental exercise of connecting the two pictures. Problems 1. Use direct integration to find the inverse of the Fourier transform Check your answer using MATLAB. Use partial fractions to invert the following Fourier transforms: 2. 3. 4. 5. Then check your answer using MATLAB. The Fourier Transform 313 By taking the appropriate closed contour, find the inverse of the following Fourier transforms by contour integration. The parameter a is real and positive. 6. 7. 8. 9. 10. 11. 12. 13. Then check your answer using MATLAB. 14. Find the inverse of F( )=cos( )/( 2+a2), a>0, by first rewriting the transform as 314 Advanced Engineering Mathematics with MATLAB Figure 5.4.4: The correspondence between the location of the simple poles of the Fourier transform F( ) and the behavior of f(t). and then using the residue theorem on each term. The Fourier Transform 15. Find12 the inverse Fourier transform for 315 where a>0 and R>1. Hint: You must find separate inverses for different time intervals. For example, in the case of F+( ), you must examine the special cases of t<0 and t>0. 16. As we shall show shortly, Fourier transforms can be used to solve differential equations. During the solution of the heat equation, Taitel et al.13 inverted the Fourier transform where y and p are real. Show that they should have found In this case, our time variable t was their spatial variable x 17. Find the inverse of the Fourier transform . where L, , and are real and positive and sgn(z)=1 if Re(z)>0 and 1 if Re(z)< 0. Use the residue theorem to verify the following integrals: 18. 19. 12 Taken from Scharstein, R.W., 1992: Transient electromagnetic plane wave reflection from a dielectric slab. IEEE Trans. Educ., 35, 170175. Reprinted from Int. J. Heat M ss Transfer, 16, Y.Taitel, M.Bentwich, and A. Tamir, Effects of upstream and downstream boundary conditions on heat (mass) transfer with axia1 diffusion, 359369, 1973, with kind permission from Elsevier Science Ltd., The Boulevard, Langford Lane, Kidlington OX5 1GB, UK. 13 316 Advanced Engineering Mathematics with MATLAB 20. 21. 22. The concept of forced convection is normally associated with heat streaming through a duct or past an obstacle. Bentwich14 showed that a similar transport can exist when convection results from a wave traveling through an essentially stagnant fluid. In the process of computing the amount of heating he proved the following identity: Confirm his result. 5.5 CONVOLUTION The most important property of Fourier transforms is convolution. We shall use it extensively in the solution of differential equations and the design of filters because it yields in time or space the effect of multiplying two transforms together. The convolution operation is (5.5.1) Then, (5.5.2) (5.5.3) Thus, the Fourier transform of the convolution of two functions equals the product of the Fourier transforms of each of the functions. 14 Reprinted from Int. J. Heat M ss Transfer, 9, M.Bentwich, Convection enforced by surface and tidal waves, 663670, 1966, with kind permission from Elsevier Science Ltd., The Boulevard, Langford Lane, Kidlington OX5 1GB, UK. The Fourier Transform Example 5.5.1 317 Let us verify the convolution theorem using the functions f(t)=H(t+ a) H(t a) and g(t)=e tH(t), where a>0. The convolution of f(t) with g(t) is (5.5.4) (5.5.5) If t< a, then the integrand of (5.5.5) is always zero and f(t)*g(t)=0. If t>a, (5.5.6) Finally, for a<t<a, (5.5.7) In summary, (5.5.8) An alternative to examining various cases involving the value of t, we could have used MATLAB to evaluate (5.5.5). The MATLAB instructions are as follows: 318 Advanced Engineering Mathematics with MATLAB The Fourier transform of f(t)*g(t) is (5.5.9) (5.5.10) (5.5.11) and the convolution theorem is true for this special case. The Fourier transform (5.5.11) could also be obtained by substituting our earlier MATLAB result into fourier and then using simplify(ans). Example 5.5.2 Let us consider the convolution of f(t)=f+(t)H(t) with g(t)=g+H(t). Note that both of the functions are nonzero only for t>0. From the definition of convolution, (5.5.12) (5.5.13) For t<0, the integrand is always zero and f(t)*g(t)=0. For t>0, (5.5.14) The Fourier Transform Therefore, in general, 319 (5.5.15) This is the definition of convolution that we will use for Laplace transforms where all of the functions equal zero for t<0. The convolution operation also applies to Fourier transforms, in what is commonly known as frequency convolution. We now prove that (5.5.16) where (5.5.17) where F( ) and G( ) are the Fourier transforms of f(t) and g(t), respectively. Proof: Starting with (5.5.18) we can multiply the inverse of F( ) by g(t) so that we obtain (5.5.19) Then, taking the Fourier transform of (5.5.19), we find that (5.5.20) (5.5.21) (5.5.22) 320 Advanced Engineering Mathematics with MATLAB Thus, the multiplication of two functions in the time domain is equivalent to the convolution of their spectral densities in the frequency domain. Problems 1. Show that e tH(t)*e tH(t)=te tH(t). Then verify your result using MATLAB. 2. Show that Then verify your result using MATLAB. 3. Show that e tH(t)*e 2t H(t)=(e t e 2t ) H(t). Then verify your result using MATLAB. 4. Show that Then verify your result using MATLAB. 5. Show that Then try and verify your result using MATLAB. What do you have to do to make it work? 6. Show that e |t|*e |t| =(1+|t|)e |t|. 7. Prove that the convolution of two Dirac delta functioris is a Dirac delta function. The Fourier Transform 5.6 SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS BY FOURIER TRANSFORMS 321 As with Laplace transforms, we may use Fourier transforms to solve ordinary differential equations. However, this method gives only the particular solution and we must find the complementary solution separately. Consider the differential equation (5.6.1) Taking the Fourier transform of both sides of (5.6.1), (5.6.2) where we used the derivative rule (5.3.19) to obtain the transform of y and Y( )=F[y(t)]. Therefore, (5.6.3) Applying the inversion integral to (5.6.3), (5.6.4) We evaluate (5.6.4) by contour integration. For t>0 we close the line integral with an infinite semicircle in the upper half of the -plane. The integration along this arc equals zero by Jordan's lemma. Within this closed contour we have a second-order pole at z=i. Therefore, (5.6.5) (5.6.6) 322 Advanced Engineering Mathematics with MATLAB and (5.6.7) For t<0, we again close the line integral with an infinite semicircle but this time it is in the lower half of the -plane. The contribution from the line integral along the arc vanishes by Jordan's lemma. Within the contour, we have a simple pole at z= i. Therefore, (5.6.8) and (5.6.9) The minus sign in front of the 2 i results from the contour being taken in the clockwise direction or negative sense. Using the step function, we can combine (5.6.7) and (5.6.9) into the single expression (5.6.10) Note that we only found the particular or forced solution to (5.6.1). The most general solution therefore requires that we add the complementary solution Ae t, yielding (5.6.11) The arbitrary constant A would be determined by the initial condition which we have not specified. We could also have solved this problem using MATLAB. The MATLAB script The Fourier Transform 323 which is equivalent to (5.6.10). Consider now a more general problem of y +y=f(t), <t< (5.6.12) where we assume that f(t) has the Fourier transform F( ). Then the Fouriertransformed solution to (5.6.12) is (5.6.13) or y(t)=g(t)*f(t), (5.6.14) where g(t)=F l[1/(1+ i)]=e tH(t). Thus, we can obtain our solution in one of two ways. First, we can take the Fourier transform of f(t), multiply this transform by G( ), and finally compute the inverse. The second method requires a convolution of f(t) with g(t). Which method is easiest depends upon f(t) and g(t). The function g(t) can also be viewed as the particular solution of (5.6.12) resulting from the forcing function (t), the Dirac delta function, because F[ (t)]=1. Traditionally this forced solution g(t) is called the Green's function and G( ) is called the frequency response or steady-state transfer function of our system. Engineers often extensively study the frequency response in their analysis rather than the Green's function because the frequency response is easier to obtain experimentally and the output from a linear system is just the product of two transforms [see (5.6.13)] rather than an integration. 324 Advanced Engineering Mathematics with MATLAB In summary, we can use Fourier transforms to find particular solutions to differential equations. The complete solution consists of this particular solution plus any homogeneous solution that we need to satisfy the initial conditions. Convolution of the Green's function with the forcing function also gives the particular solution. Example 5.6.1: Spectrum of a damped harmonic oscillator Second-order differential equations are ubiquitous in engineering. In electrical engineering many electrical circuits are governed by second-order, linear ordinary differential equations. In mechanical engineering they arise during the application of Newton's second law. For example, in mechanics the damped oscillations of a mass m attached to a spring with a spring constant k and damped with a velocity dependent resistance are governed by the equation my +cy +ky=f(t), (5.6.15) where y(t) denotes the displacement of the oscillator from its equilibrium position, c denotes the damping coefficient, and f(t) denotes the forcing. Assuming that both f(t) and y(t) have Fourier transforms, let us analyze this system by finding its frequency response. We begin by solving for the Green's function g(t) which is given by mg +cg +kg= (t), (5.6.16) because the Green's function is the response of a system to a delta function forcing. Taking the Fourier transform of both sides of (5.6.16), the frequency response is (5.6.17) is the natural frequency of the system. The most useful quantity to where plot is the frequency response or (5.6.18) (5.6.19) The Fourier Transform 325 In Figure 5.6.1 we plotted the frequency response as a function of c2/(km). Note that as the damping becomes larger, the sharp peak at = 0 essentially vanishes. As c2/(km)0, we obtain a very finely tuned response curve. Let us now find the Green's function. From the definition of the inverse Fourier transform, (5.6.20) where (5.6.21) and =c/2m>0. We can evaluate (5.6.20) by residues. Clearly the poles always lie in the upper half of the -plane. Thus, if t<0 in (5.6.20) we can close the line integration along the real axis with a semicircle of infinite radius in the lower half of the -plane by Jordan's lemma. Because the integrand is analytic within the closed contour, g(t)=0 for t<0. This is simply the causality condition,15 the impulse forcing being the cause of the excitation. Clearly, causality is closely connected with the analyticity of the frequency response in the lower half of the -plane. Figure 5.6.1: The variation of the frequency response for a damped harmonic oscillator as a function of driving frequency . See the text for the definition of the parameters. 15 The principle stating that an event cannot precede its cause. 326 Advanced Engineering Mathematics with MATLAB If t>0, we close the line integration along the real axis with a semicircle of infinite radius in the upper half of the -plane and obtain (5.6.22) (5.6.23) Let us now examine the damped harmonic oscillator by describing the migration of the poles 1, 2 in the complex -plane as increases from 0 to . See Figure 5.6.2. For 0 (weak damping), the poles 1, 2 are very near to the real axis, above the points 0 respectively. This corresponds to the narrow resonance band discussed earlier and we have an underdamped harmonic oscillator. As increases from 0 to 0, the poles approach the positive imaginary axis, moving along a semicircle of radius the origin. They coalesce at the point i a critically damped oscillator. For > 0 0 0 centered at for = 0 , yielding repeated roots, and we have , the poles move in opposite directions along the positive imaginary axis; one of them approaches the origin, while the other tends to i as . The solution then has two purely decaying, overdamped solutions. During the early 1950s, a similar diagram was invented by Evans16 where the movement of closed-loop poles is plotted for all values of a system parameter, usually the gain. This root-locus method is very popular in system control 16 Evans, W.R., 1948: Graphical analysis of control systems. Trans. AIEE, 67, 547551; Evans, W.R., 1954: Control-System Dynamics. McGraw-Hill, 282 pp. The Fourier Transform 327 Figure 5.6.2: The migration of the poles of the frequency response of a damped harmonic oscillator as a function of . theory for two reasons. First, the investigator can easily determine the contribution of a particular closed-loop pole to the transient response. Second, he can determine the manner in which open-loop poles or zeros should be introduced or their location modified so that he will achieve a desired performance characteristic for his system. Example 5.6.2: Low frequency filter Consider the ordinary differential equation (5.6.24) where R and C are real, positive constants. If y(t) denotes current, then (5.6.24) would be the equation that gives the voltage across a capacitor in a RC circuit. Let us find the frequency response and Green's function for this system. We begin by writing (5.6.24) as (5.6.25) where g(t) denotes the Green's function. If the Fourier transform of g(t) is G( ), the frequency response G( ) is given by 328 Advanced Engineering Mathematics with MATLAB (5.6.26) Figure 5.6.3: The variation of the frequency response (5.6.28) as a function of driving frequency . See the text for the definition of the parameters. or (5.6.27) and (5.6.28) where p =1/(RC) is an intrinsic constant of the system. In Figure 5.6.3 we plotted |G( )| as a function of . From this figure, we see that the response is largest for small and decreases as increases. This is an example of a low frequency filter because relatively more signal passes through at lower frequencies than at higher frequencies. To understand this, let us drive the system with a forcing function that has the Fourier transform F( ). The response of the system will be G( )F( ). Thus, that portion of the forcing function's spectrum at the lower frequencies is relatively unaffected because |G( )| is near unity. However, at higher frequencies where |G( )| is smaller, the magnitude of the output is greatly reduced. The Fourier Transform Example 5.6.3 329 During his study of tumor growth, Adam17 found the particular solution to an ordinary differential equation which, in its simpliest form, is (5.6.29) by the method of Green's functions. Let us retrace his steps and see how he did it. The first step is finding the Green's function. We do this by solving g 2 g= (x), (5.6.30) subject to the boundary conditions lim|x| g(x)0. Taking the Fourier transform of (5.6.30), we obtain (5.6.31) The function G( ) is the frequency response for our problem. Straightforward inversion yields the Green's function (5.6.32) Therefore, by the convolution integral (5.6.14), (5.6.33) To evaluate (5.6.33) we must consider four separate cases: and L<x< . Turning to the <x< L case first, we have <x< L, L<x<0, 0<x<L, (5.6.34) 17 Reprinted from Math. Biosci., 81, J.A.Adam, A simplified mathematical model of tumor growth, 229244, 1986, with permission from Elsevier Science. 330 Advanced Engineering Mathematics with MATLAB (5.6.35) (5.6.36) Similarly, for x>L, (5.6.37) (5.6.38) (5.6.39) On the other hand, for L<x< 0, we find that (5.6.40) (5.6.41) (5.6.42) Finally, for 0<x<L, we have that (5.6.43) The Fourier Transform 331 (5.6.44) (5.6.45) These results can be collapsed down into (5.6.46) if |x|>L and (5.6.47) if |x|>L. Problems Find the particular solutions for the following differential equations. For Problems 13, verify your solution using MATLAB. 1. y +3y +2y=e tH(t) 2. 3. y 4. yiv 4y +4y=e tH(t) 4 y= (x), where has a positive real part and a negative imaginary part. Chapter 6 The Laplace Transform The previous chapter introduced the concept of the Fourier integral. If the function is nonzero only when t>0, a similar transform, the Laplace transform,1 exists. It is particularly useful in solving initial-value problems involving linear, constant coefficient, ordinary and partial differential equations. The present chapter develops the general properties and techniques of Laplace transforms. 6.1 DEFINITION AND ELEMENTARY PROPERTIES Consider a function f(t) such that f(t)=0 for t<0. Then the Laplace integral: (6.1.1) defines the Laplace transform of f(t), which we shall write L[f(t)] or F(s). The Laplace transform converts a function of t into a function of the transform variable s. Not all functions have a Laplace transform because the integral (6.1.1) may fail to exist. For example, the function may have infinite discontinuities. For this reason, f(t)=tan(t) does not have a Laplace transform. We can avoid this difficulty by requiring that f(t) be piece-wise continuous. That is, we can divide a finite range into a finite number of intervals in such a manner that f(t) is continuous inside each interval and approaches finite values as we approach either end of any interval from the interior. Another unacceptable function is f(t)=1/t because the integral (6.1.1) fails to exist. This leads to the requirement that the product tn|f(t)| is bounded near t=0 for some number n<1. Finally |f(t)| cannot grow too rapidly or it could overwhelm the e st term. To express this, we introduce the concept of functions of exponential order. By exponential order we mean that there exist some constants, M and k, for which 1 The standard reference for Laplace transforms is Doetsch, G., 1950: Handbuch der LaplaceTransformation. Band 1. Theorie der Laplace-Transformation. Birkhuser Verlag, 581 pp.; Doetsch, G., 1955: Handbuch der Laplace-Transformation. Band 2. Anwendungen der LaplaceTransformation. 1. Abteilung. Birkhuser Verlag, 433 pp.; Doetsch, G., 1956: Handbuch der Laplace-Transformation. Band 3. Anwendungen der Laplace-Transformation. 2. Abteilung. Birkhuser Verlag, 298 pp. 334 Advanced Engineering Mathematics with MATLAB |f(t)| Mekt (6.1.2) for all t>0. Then, the Laplace transform of f(t) exists if s, or just the real part of s, is greater than k. In summary, the Laplace transform of f(t) exists, for sufficiently large s, provided f(t) satisfies the following conditions: f(t)=0 for t<0, f(t) is continuous or piece-wise continuous in every interval, tn|f(t)|< as t0 for some number n, where n<1, as t , for some number s0. The quantity s0 is called the abscissa of convergence. Example 6.1.1 Let us find the Laplace transform of 1, eat, sin(at), cos(at), and tn from the definition of the Laplace transform. From (6.1.1), direct integration yields (6.1.3) (6.1.4) (6.1.5) (6.1.6) (6.1.7) (6.1.8) The Laplace Transform 335 (6.1.9) and (6.1.10) where n is a positive integer. MATLAB provides the routine laplace to compute the Laplace transform for a given function. For example, The Laplace transform inherits two important properties from its integral definition. First, the transform of a sum equals the sum of the transforms or (6.1.11) This linearity property holds with complex numbers and functions as well. Example 6.1.2 Success with Laplace transforms often rests with the ability to manipulate a given transform into a form which you can invert by inspection. Consider the following examples. Given F(s)=4/s3, then 336 Advanced Engineering Mathematics with MATLAB (6.1.12) from (6.1.10). Given (6.1.13) then f(t)=cos(t)+2sin(t) (6.1.14) by (6.1.7), (6.1.9), and (6.1.11). Because (6.1.15) by partial fractions, then f(t)=et 1 (6.1.16) by (6.1.3), (6.1.5), and (6.1.11). MATLAB also provides the routine ilaplace to compute the inverse Laplace transform for a given function. For example, The second important property deals with derivatives. Suppose f(t) is continuous and has a piece-wise continuous derivative f (t). Then The Laplace Transform 337 (6.1.17) by integration by parts. If f(t) is of exponential order, e stf(t) tends to zero as t , for large enough s, so that (6.1.18) Similarly, if f(t) and f (t) are continuous, f (t) is piece-wise continuous, and all three functions are of exponential order, then (6.1.19) Table 6.1.1: The Laplace Transforms of Some Commonly Encountered Functions f(t), t 0 1. 1 F(s) 2. e at 3. 4. 5. 6. 7. 8. sin(at) cos(at) sinh(at) 338 Advanced Engineering Mathematics with MATLAB 9. 10. cosh(at) t sin(at) 11. 1 cos(at) 12. at sin(at) 13. t cos(at) 14. sin(at) atcos(at) 15. t sinh(at) 16. t cosh(at) 17. atcosh(at) sinh(at) 18. e bt sin(at) 19. 20. e btcos(at) (1+a2t2)sin(at) atcos(at) sin(at)cosh(at) cos(at)sinh(at) 21. 22. sin(at)sinh(at) 23. sinh(at) sin(at) The Laplace Transform 24. 25. cosh(at) cos(at) 339 26. 27. 28. 29. tn, n 0 30. tne at, n 0 s [n +(1/2)] J0(at) I0(at) 31. 32. 33. 34. 35. 36. 37. 38. 340 Advanced Engineering Mathematics with MATLAB 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. Notes: Error function: erf (x) Complementary error function: erfc(x)=1 erf(x) In general, (6.1.20) on the assumption that f(t) and its first n 1 derivatives are continuous, f(n)(t) is piece-wise continuous, and all are of exponential order so that the Laplace transform exists. The Laplace Transform The converse of (6.1.20) is also of some importance. If 341 (6.1.21) then (6.1.22) (6.1.23) and (6.1.24) where u(0)=0. Problems Using the definition of the Laplace transform, find the Laplace transform of the following functions. For Problems 14, check your answer using MATLAB. 1. f(t)=cosh(at) 2. f(t)=cos2(at) 3. f(t)=(t+1)2 4. f(t) (t+1)e at 5. 6. Using your knowledge of the transform for 1, eat, sin(at), cos(at), and tn, find the Laplace transform of 7. f(t)=2 sin(t) cos(2t)+cos(3) t 8. f(t)=t 2+e 5t sin(5t)+cos(2). Find the inverse of the following transforms. Verify your result using MATLAB. 9. F(s)=1/(s+3) 10. F(s)=1/s4 342 Advanced Engineering Mathematics with MATLAB 11. F(s)=1/(s2+9) 12. F(s)=(2s+3)/(s2+9) 13. F(s)=2/(s2+1) 15/s3+2/(s+1) 6s/(s2+4) 14. F(s)=3/s+15/s3+(s+5)/(s2+1) 6/(s 2). 15. Verify the derivative rule for Laplace transforms using the function f(t)= sin(at). 16. Show that L[f(at)]=F(s/a)/a, where F(s)=L[f(t)]. 17. Using the trigonometric identity sin2(x)=[1 cos(2x)]/2, find the Laplace transform of f(t)=sin2[ t/(2T)]. 6.2 THE HEAVISIDE STEP AND DIRAC DELTA FUNCTIONS Change can occur abruptly. We throw a switch and electricity suddenly flows. In this section we introduce two functions, the Heaviside step and Dirac delta, that will give us the ability to construct complicated discontinuous functions to express these changes. Heaviside step function We define the Heaviside step function as (6.2.1) where a 0. From this definition, (6.2.2) The Laplace Transform 343 Figure 6.2.1: Largely a self-educated man, Oliver Heaviside (18501925) lived the life of a recluse. It was during his studies of the implications of Maxwell's theory of electricity and magnetism that he re-invented Laplace transforms. Initially rejected, it would require the work of Bromwich to justify its use. (Portrait courtesy of the Institution of Electrical Engineers, London.) Note that this transform is identical to that for f(t)=1 if a=0. This should not surprise us. As pointed out earlier, the function f(t) is zero for all t<0 by definition. Thus, when dealing with Laplace transforms f(t)=1 and H (t) are identical. Generally we will take 1 rather than H(t) as the inverse of 1/s. The Heaviside step function is essentially a bookkeeping device that gives us the ability to "switch on" and "switch off" a given function. For example, if we want a function f(t) to become nonzero at time t=a, we represent this process by the product f(t)H(t a). On the other hand, if we only want the function to be "turned on" when a<t<b, the desired expression is then f(t)[H(t a) H(t b)]. For t<a, both step functions in the brackets have the value of zero. For a<t<b, the first step function has the value of unity and the second step function has the value of zero, so that we have f(t). For t>b, both step functions equal unity so that their difference is zero. Example 6.2.1 Quite often we need to express the graphical representation of a function by a mathematical equation. We can conveniently do this through the use of step functions in a two-step procedure. The following example illustrates this procedure. 344 Advanced Engineering Mathematics with MATLAB Figure 6.2.2: Graphical representation of (6.2.5). Consider Figure 6.2.2. We would like to express this graph in terms of Heaviside step functions. We begin by introducing step functions at each point where there is a kink (discontinuity in the first derivative) or jump in the graph--in the present case at t=0, t=1, t=2, and t=3. These are the points of abrupt change. Thus, f(t)=a0(t)H(t)+a1(t)H(t 1)+a2(t)H(t 2)+a3(t)H(t 3), (6.2.3) where the coefficients a0(t),a1(t),...are yet to be determined. Proceeding from left to right in Figure 6.2.2, the coefficient of each step function equals the mathematical expression that we want after the kink or jump minus the expression before the kink or jump. As each Heaviside turns on, we need to add in the new t behavior and subtract out the old t behavior. Thus, in the present example, f(t)=(t 0)H(t)+(1 t)H(t 1)+[(3 t) 1]H(t 2)+[0 (3 t)]H(t 3) (6.2.4) or f(t)=tH(t) (t 1)H(t 1) (t 2)H(t 2)+(t 3)H(t 3). (6.2.5) We can easily find the Laplace transform of (6.2.5) by the "second shifting" theorem introduced in the next section. Example 6.2.2 Laplace transforms are particularly useful in solving initial-value problems involving linear, constant coefficient, ordinary differential equations where the nonhomogeneous The Laplace Transform 345 term is discontinuous. As we shall show in the next section, we must first rewrite the nonhomogeneous term using the Heaviside step function before we can use Laplace transforms. For example, given the nonhomogeneous ordinary differential equation: (6.2.6) we can rewrite the right side of (6.2.6) as y +3y +2y=t tH(t 1)=t (t 1)H(t 1) H(t 1). (6.2.7) In 6.8 we will show how to solve this type of ordinary differential equation using Laplace transforms. Dirac delta function The second special function is the Dirac delta function or impulse function. We define it by (6.2.8) where a 0. A popular way of visualizing the delta function is as a very narrow rectangular pulse: (6.2.9) where height is some small number and a>0. See Figure 6.2.3. This pulse has a width and its center at t=a so that its area is unity. Now as this pulse shrinks in width its height increases so that it remains centered at t=a and its area equals unity. If we continue this process, always keeping the area unity and the pulse symmetric about t=a, eventually we obtain an extremely narrow, very large amplitude pulse at t=a. If we proceed to the limit, where the width approaches zero and the height approaches infinity (but still with unit area), we obtain the delta function (t a). The delta function was introduced earlier during our study of Fourier transforms. So what is the difference between the delta function introduced then and the delta function now? Simply put, the delta function can now only be used on the interval [0, ). Outside of that, we shall use it very much as we did with Fourier transforms. 346 Advanced Engineering Mathematics with MATLAB Figure 6.2.3: The Dirac delta function. Using (6.2.9), the Laplace transform of the delta function is (6.2.10) (6.2.11) (6.2.12) =e as . (6.2.13) In the special case when a=0, L[ (t)]=1, a property that we will use in 6.9. Note that this is exactly the result that we obtained for the Fourier transform of the delta function. If we integrate the impulse function, (6.2.14) The Laplace Transform 347 according to whether the impulse does or does not come within the range of integration. This integral gives a result that is precisely the definition of the Heaviside step function so that we can rewrite (6.2.14) (6.2.15) Consequently the delta function behaves like the derivative of the step function or (6.2.16) Because the conventional derivative does not exist at a point of discontinuity, we can only make sense of (6.2.16) if we extend the definition of the derivative. Here we extended the definition formally, but a richer and deeper understanding arises from the theory of generalized functions.2 Example 6.2.3 Let us find the (generalized) derivative of f(t)=3t2[H(t) H(t 1)]. (6.2.17) Proceeding formally, f (t)=6t[H(t) H(t 1)]+3t2[ (t) (t 1)] (6.2.18) =6t[H(t) H(t 1)]+03 (t 1) (6.2.19) =6t[H(t) H(t 1)] 3 (t 1), (6.2.20) because f(t) (t t0)=f(t0) (t t0). The generalization of the definition of a function so that it can express in a mathematically correct form such idealized concepts as the density of a material point, a point charge or point dipole, the space charge of a simple or double layer, the intensity of an instantaneous source, etc. 2 348 Advanced Engineering Mathematics with MATLAB Example 6.2.4 MATLAB also includes the step and Dirac delta functions among its intrinsic functions. There are two types of step functions. In symbolic calculations, the function is Heaviside while stepfunction is used in numerical calculations. For example, the Laplace transform of (6.2.5) is In a similar manner, the symbolic function for the Dirac delta function is Dirac. Therefore, the Laplace transform of (t 1) (t 2) is Problems Sketch the following functions and express them in terms of the Heaviside step functions: 1. 2. Rewrite the following nonhomogeneous ordinary differential equations using the Heaviside step functions: 3. 4. 5. 6. The Laplace Transform 7. 8. 9. 10. 349 6.3 SOME USEFUL THEOREMS Although at first sight there would appear to be a bewildering number of transforms to either memorize or tabulate, there are several useful theorems which can extend the applicability of a given transform. First shifting theorem Consider the transform of the function e definition, at f(t), where a is any real number. Then, by (6.3.1) or L[e at f(t)]=F(s+a). (6.3.2) That is, if F(s) is the transform of f(t) and a is a constant, then F(s+a) is the transform of e atf(t). Example 6.3.1 Let us find the Laplace transform of f(t)=e sin(bt) is b/(s2+b2), at sin(bt). Because the Laplace transform of (6.3.3) 350 Advanced Engineering Mathematics with MATLAB where we simply replaced s by s+a in the transform for sin(bt). Example 6.3.2 Let us find the inverse of the Laplace transform (6.3.4) Rearranging terms, (6.3.5) (6.3.6) Immediately, from the first shifting theorem, (6.3.7) Second shifting theorem The second shifting theorem states that if F(s) is the transform of f(t), then e bsF(s) is the transform of f(t b)H(t b), where b is real and positive. To show this, consider the Laplace transform of f(t b)H(t b). Then, from the definition, (6.3.8) (6.3.9) (6.3.10) The Laplace Transform or L[f(t b)H(t b)=e bs 351 F(s), (6.3.11) where we set x=t b. This theorem is of fundamental importance because it allows us to write down the transforms for "delayed" time functions. That is, functions which "turn on" b units after the initial time. Example 6.3.3 Let us find the inverse of the transform (1 e s)/s. Since (6.3.12) (6.3.13) because L 1(1/s) and f(t 1)=1. Example 6.3.4 Let us find the Laplace transform of f(t)=(t2 1)H(t 1). We begin by noting that (t2 1)H(t 1)=[(t 1+l)21]H(t 1) (6.3.14) =[(t 1)2+2(t 1)]H(t 1) (6.3.15) =(t 1)2H(t 1)+2(t 1)H(t 1). (6.3.16) A direct application of the second shifting theorem leads then to (6.3.17) 352 Advanced Engineering Mathematics with MATLAB Example 6.3.5 In Example 6.2.2 we discussed the use of Laplace transforms in solving ordinary differential equations. One further step along the road consists of finding Y(s)=L[y(t)]. Now that we have the second shifting theorem, let us do this. Continuing Example 6.2.2 with y(0)=0 and y (0)=1, let us take the Laplace transform of (6.2.8). Employing the second shifting theorem and (6.1.20), we find that (6.3.18) Substituting in the initial conditions and solving for Y(s), we finally obtain (6.3.19) Laplace transform of tnf(t) In addition to the shifting theorems, there are two other particularly useful theorems that involve the derivative and integral of the transform F(s). For example, if we write (6.3.20) and differentiate with respect to s, then (6.3.21) In general, we have that F(n)(s)=( 1)nL[tnf(t)]. (6.3.22) Laplace transform of f(t)/t Consider the following integration of the Laplace transform F(s): (6.3.23) The Laplace Transform Upon interchanging the order of integration, we find that 353 (6.3.24) (6.3.25) Therefore, (6.3.26) Example 6.3.6 Let us find the transform of t sin(at). From (6.3.21), (6.3.27) Example 6.3.7 Let us find the transform of [1 cos(at)]/t. To solve this problem, we apply (6.3.26) and find that (6.3.28) (6.3.29) (6.3.30) 354 Advanced Engineering Mathematics with MATLAB Initial-value theorem Let f(t) and f (t) possess Laplace transforms. Then, from the definition of the Laplace transform, (6.3.31) Because s is a parameter in (6.3.31) and the existence of the integral is implied by the derivative rule, we can let s before we integrate. In that case, the left side of (6.3.31) vanishes to zero, which leads to (6.3.32) This is the initial-value theorem. Example 6.3.8 Let us verify the initial-value theorem using f(t)=e3t. Because F(s)= 1/(s 3), lims s/(s 3)=1. This agrees with f(0)=1. In the common case when the Laplace transform is ratio to two polynomials, we can use MATLAB to find the initial value. This consists of two steps. First, we construct sF(s) by creating vectors which describe the numerator and denominator of sF(s) and then evaluate the numerator and denominator using very large values of s. For example, in the previous example, num = [1 0]; den = [1 -3]; initialvalue = polyval(num, 1e20)/polyval(den,1e20) initialvalue = 1 Final-value theorem Let f(t) and f (t) possess Laplace transforms. Then, in the limit of s0, (6.3.31) becomes (6.3.33) The Laplace Transform 355 Because f(0) is not a function of t or s, the quantity f(0) cancels from the (6.3.33), leaving (6.3.34) Equation (6.3.34) is the final-value theorem. It should be noted that this theorem assumes that limtt f(t) exists. For example, it does not apply to sinusoidal functions. Thus, we must restrict ourselves to Laplace transforms that have singularities in the left half of the s-plane unless they occur at the origin. Example 6.3.9 Let us verify the final-value theorem using f(t)=t. Because F(s)=1/s2, (6.3.35) The limit of f(t) as t is also undefined. Just as we can use MATLAB to find the initial value of a Laplace transform in the case when F(s) is a ratio of two polynomials, we can do the same here for the final value. Again we define vectors num and den that give sF(s) and then evaluate them at s=0. Using the previous example, the MATLAB commands are: num = [0 1 0]; den = [1 0 0]; finalvalue = polyval(num,0)/polyval(den,0) Warning: Divide by zero. finalvalue = NaN This agrees with the result from a hand calculation and shows what happens when the denominator has a zero. Example 6.3.10 Looking ahead, we will shortly need to find the Laplace transform of y(t) which is defined by a differential equation. For example, we will want Y(s) where y(t) is governed by y +2y +2y=cos(t)+ (t /2), y(0)=y (0)=0. (6.3.36) 356 Advanced Engineering Mathematics with MATLAB Applying Laplace transforms to both sides of (6.3.36), we have that (6.3.37) or (6.3.38) Substituting for y(0) and y (0) and solving for Y(s), we find that (6.3.39) Presently this is as far as we can go. How would we use MATLAB to find Y(s)? The following MATLAB script shows you how: clear % define symbolic variables syms pi s t Y % take Laplace transform of left side of differential equation LHS = laplace(diff (diff (sym ( 'y(t) ')))+2*diff (sym('y(t)'))... +2*sym('y(t)')); % take Laplace transform of right side of differential equation RHS = laplace(cos(t)+'Dirac(t-pi/2)',t,s); % set Y for Laplace transform of y % and introduce initial conditions newLHS = subs (LHS,'laplace(y(t) ,t,s) ','y(0) ','D (y) (0)',Y,0,0); % solve for Y Y = solve(newLHS-RHS,Y) It yields Y= (s+exp (-1/2*pi*s)*s^2+exp(-1/2*pi*s))(s^4+3*s 2+2*s^3+2*s+2) ^ Problems Find the Laplace transform of the following functions and then check your work using MATLAB. 1. f(t)=e t sin(2t) 2. f(t)=e 2t cos(2t) The Laplace Transform 3. f(t)=t2H(t 1) 4. f(t)=e2tH(t 3) 5. f(t)=tet+sin(3t)et+cos(5t)e2t 6. f(t)=t4e 2t+sin (3t)et+cos(4t)e2t 7. f(t)=t2e t+sin(2t)et+cos(3t)e 3t 8. f(t)=t2H(t 1)+et H(t 2) 9. f(t)=(t2+2) H(t 1)+H(t 2) 10. f(t)=(t+1)2H(t 1)+et H(t 2) 11. 12. 13. f(t)=te 3t sin (2t) Find the inverse of the following Laplace transforms by hand and using MATLAB: 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 357 358 Advanced Engineering Mathematics with MATLAB 27. 28. Find the Laplace transform of f(t)=tet[H(t 1) H(t 2)] by using (a) the definition of the Laplace transform, and (b) a joint application of the first and second shifting theorems. 29. Write the function in terms of Heaviside's step functions. Then find its transform using (a) the definition of the Laplace transform, and (b) the second shifting theorem. In Problems 3033, write the function f(t) in terms of the Heaviside step functions and then find its transform using the second shifting theorem. Check your answer using MATLAB. 30. 31. 32. 33. Find Y(s) for the following ordinary differential equations and then use MATLAB to check your work. 34. y +3y +2y=H(t 1); y(0)=y (0)=0 35. y +4y=3H(t 4); y(0)=1, y (0)=0 36. y +4y +4y=tH(t 2); y(0)=0, y (0)=2 37. y +3y +2y=et H(t 1); y(0)=y (0)=0 38. y 3y +2y=e t H(t 2); y(0) 2, y (0)=0 39. y 3y +2y t2H(t 1); y(0)=0, y (0)=5 40. y +y=sin(t)[1 H(t )]; y(0) y (0)=0 41. y +3y +2y=t+[ae (t ) t] H(t a); y(0)=y (0)=0. For each of the following functions, find its value at t=0. Then check your answer using the initial-value theorem by hand and using MATLAB. 42. f(t)=t 43. f(t)=cos(at) 44. f(t)=te t 45. f(t)=etsin(3t) The Laplace Transform 359 For each of the following Laplace transforms, state whether you can or cannot apply the final-value theorem. If you can, find the final value by hand and using MATLAB. Check your result by finding the inverse and finding the limit as t . 46. 47. 48. 49. 50. 51. 6.4 THE LAPLACE TRANSFORM OF A PERIODIC FUNCTION Periodic functions frequently occur in engineering problems and we shall now show how to calculate their transform. They possess the property that f(t+T)=f(t) for t>0 and equal zero for t<0, where T is the period of the function. For convenience let us define a function x(t) which equals zero except over the interval (0, T) where it equals f(t): (6.4.1) By definition (6.4.2) (6.4.3) Now let z=t kT, where k=0, 1, 2,..., in the kth integral and F(s) becomes (6.4.4) 360 Advanced Engineering Mathematics with MATLAB However, x(z)=f(z)=f(z+T)=...=f(z+kT)=..., (6.4.5) because the range of integration in each integral is from 0 to T. Thus, F(s) becomes (6.4.6) or F(s)=(1+e sT +e 2sT +...+e ksT +...)X(s). (6.4.7) The first term on the right side of (6.4.7) is a geometric series with common ratio e |e sT|<1, then the series converges and sT . If (6.4.8) Example 6.4.1 Let us find the Laplace transform of the square wave with period T: (6.4.9) By definition x(t) is (6.4.10) The Laplace Transform Then 361 (6.4.11) (6.4.12) and (6.4.13) If we multiply numerator and denominator by exp(sT/4) and recall that tanh(u)= (eu e u)/(eu+e u), we have that (6.4.14) Example 6.4.2 Let us find the Laplace transform of the periodic function (6.4.15) By definition x(t) is (6.4.16) Then (6.4.17) Hence, (6.4.18) 362 Advanced Engineering Mathematics with MATLAB (6.4.19) Problems Find the Laplace transform for the following periodic functions: 1. f(t)=sin(t), 0 t 2. 3. 4. , f(t)=f(t+ ) 6.5 INVERSION BY PARTIAL FRACTIONS: HEAVISIDE'S EXPANSION THEOREM In the previous sections, we devoted our efforts to calculating the Laplace transform of a given function. Obviously we must have a method for going the other way. Given a transform, we must find the corresponding function. This is often a very formidable task. In the next few sections we shall present some general techniques for the inversion of a Laplace transform. The first technique involves transforms that we can express as the ratio of two polynomials: F(s)=q(s)/p(s). We shall assume that the order of q(s) is less than p(s) and we have divided out any common factor between them. In principle we know that p(s) has n zeros, where n is the order of the p(s) polynomial. Some of the zeros may be complex, some of them may be real, and some of them may be duplicates of other zeros. In the case when p(s) has n simple zeros (nonrepeating roots), a simple method exists for inverting the transform. We want to rewrite F(s) in the form: (6.5.1) where s1, s2,..., sn are the n simple zeros of p(s). We now multiply both sides of (6.5.1) by s s1 so that (6.5.2) The Laplace Transform 363 If we set s=s1, the right side of (6.5.2) becomes simply a1. The left side takes the form 0/0 and there are two cases. If p(s)=(s s1)g(s), then factor out s s1, l'Hspital's rule gives 1 =q(s1)/g(s1). If we cannot explicitly (6.5.3) In a similar manner, we can compute all of the coefficients Therefore, k , where k= 1, 2,..., n. (6.5.4) (6.5.5) This is Heaviside's expansion theorem, applicable when p(s) has only simple poles. Example 6.5.1 Let us invert the transform s/[(s+2)(s2+1)]. It has three simple poles at s= 2 and s=i. From our earlier discussion, q(s)=s, p(s)=(s+ 2)(s2+1), and p (s)=3s2+4s+1. Therefore, (6.5.6) (6.5.7) (6.5.8) (6.5.9) where we used sin(t)= (eit e it), and cos(t)= (eit+e it). 364 Advanced Engineering Mathematics with MATLAB Example 6.5.2 Let us invert the transform 1/[(s 1)(s 2)(s 3)]. There are three simple poles at s1=1, s2=2, and s3=3. In this case, the easiest method for computing a1, a2 and a3 is (6.5.10) (6.5.11) and (6.5.12) Therefore, (6.5.13) (6 .5.14) Note that for inverting transforms of the form F(s)e s with a>0, you should use Heaviside's expansion theorem to first invert F(s) and then apply the second shifting theorem. Let us now find the expansion when we have multiple roots, namely (6.5.15) where the order of the denominator, m1+m2+...+mn, is greater than that for the numerator. Once again we eliminated any common factor between the numerator and denominator. Now we can write F(s) as The Laplace Transform 365 (6.5.16) Multiplying (6.5.16) by (s sk)mk, (6.5.17) where we grouped together into the square-bracketed term all of the terms except for those with kj coefficients. Taking the limit as ssk, (6.5.18) Let us now take the derivative of (6.5.17), (6.5.19) Taking the limit as ssk, (6.5.20) In general, (6.5.21) and by direct inversion, 366 Advanced Engineering Mathematics with MATLAB (6.5.22) Example 6.5.3 Let us find the inverse of (6.5.23) We first note that the denominator has simple zeros at s=i and a repeated root at s= 2. Therefore, (6.5.24) where (6.5.25) (6.5.26) (6.5.27) and (6.5.28) Thus, (6.5.29) The Laplace Transform 367 (6.5.30) In 6.10 we shall see that we can invert transforms just as easily with the residue theorem. Let us now find the inverse of (6.5.31) by Heaviside's expansion theorem. Then (6.5.32) (6.5.33) where =tan 1(d/c). Note that we must choose d. Taking the inverse of (6.5.33), so that it gives the correct sign for c and (6.5.34) (6.5.35) Equation (6.5.35) is the amplitude/phase form of the inverse of (6.5.31). It is particularly popular with electrical engineers. Example 6.5.4 Let us express the inverse of (6.5.36) 368 Advanced Engineering Mathematics with MATLAB in the amplitude/phase form. Starting with (6.5.37) (6.5.38) or f(t)=5.1017e 2t+3it+38.3675i +5.1017e 2t 3it 38.3675i (6.5.39) =10.2034e 2t cos(3t+38.3675). (6.5.40) Example 6.5.5: The design of film jectors For our final example we anticipate future work. The primary use of Laplace transforms is the solution of differential equations. In this example we illustrate this technique that includes Heaviside's expansion theorem in the form of amplitude and phase. This problem3 arose in the design of projectors for motion pictures. An early problem was ensuring that the speed at which the film passed the electric eye remairied essentially constant; otherwise, a frequency modulation of the reproduced sound resulted. Figure 6.5.1(A) shows a diagram of the projector. Many will remember this design from their days as a school projectionist. In this section we shall show that this particular design filters out variations in the film speed caused by irregularities either in the driving-gear trains or in the engagement of the sprocket teeth with the holes in the film. 3 Cook, E.D., 1935: The technical aspects of the high-fidelity reproducer. J. Soc. Motion Pict. Eng., 25, 289312. The Laplace Transform 369 Figure 6.5.1: (A) The schematic for the scanning light in a motion-picture projector and (B) interior of the film drum head. Let us now focus on the film head--a hollow drum of small moment of inertia J1. See Figure 6.5.1(B). Within it there is a concentric inner flywheel of moment of inertia J2, where J2J1. The remainder of the space within the drum is filled with oil. The inner flywheel rotates on precision ball bearings on the drum shaft. The only coupling between the drum and flywheel is through fluid friction and the very small friction in the ball bearings. The flection of the film loops between the drum head and idler pulleys provides the spring restoring force for the system as the film runs rapidly through the system. From Figure 6.5.1 the dynamical equations governing the outer case and inner flywheel are (1) the rate of change of the outer casing of the film head equals the frictional torque given to the casing from the inner flywheel plus the restoring torque due to the flection of the film, and (2) the rate of change of the inner flywheel equals the negative of the frictional torque given to the outer casing by the inner flywheel. Assuming that the frictional torque between the two flywheels is proportional to the difference in their angular velocities, the frictional torque given to the casing from the inner flywheel is B( 2 1), where B is the frictional resistance, 1 and 2 are the deviations of the drum and inner flywheel from their normal angular velocities, respectively. If r is the ratio of the diameter of the winding sprocket to the diameter of the drum, the restoring torque due to the flection of the film and its corresponding angular twist equals K where K is the rotational stiffness and 0 is the deviation of the winding 0 sprocket from its normal angular velocity. The quantity r gives the angular velocity at which the film is running through the projector because the winding sprocket is the mechanism that pulls the film. Consequently the equations governing this mechanical system are and (6.5.41) 370 Advanced Engineering Mathematics with MATLAB (6.5.42) With the winding sprocket, the drum, and the flywheel running at their normal uniform angular velocities, let us assume that the winding sprocket introduces a disturbance equivalent to an unit increase in its angular velocity for 0.15 second, followed by the resumption of its normal velocity. It is assumed that the film in contact with the drum cannot slip. The initial conditions are 1(0)= 2(0)=0. Taking the Laplace transform of (6.5.41)(6.5.42) using (6.1.18), (6.5.43) and B 1 (s)+(J2s+B) 1 2 (s)=0. (6.5.44) The solution of (6.5.43)(6.5.44) for (s) is (6.5.45) where typical values4 are (6.5.46) (6.5.47) The transform s3= 3.32 11.6i. Because the sprocket angular velocity deviation 0 1 (s) has three simple poles located at s1= 1.58, s2= 3.32+11.6i, and (t) is a pulse of unit amplitude and 0.15 second duration, we express it as the difference of two Heaviside step functions 0 4 (t)=H(t) H(t 0.15). J1=1.84 104 dyne cm sec2 per radian, J2=8.43 104 dyne cm sec2 per radian, B=12.4 104 dyne cm sec per radian, K=2.89 106 dyne cm per radian, and r=0.578. The Laplace Transform Its Laplace transform is 371 (6.5.48) (6.5.49) Figure 6.5.2: The deviation 1(t) of a film drum head from its uniform angular velocity when the sprocket angular velocity is perturbed by a unit amount for the duration of 0.15 second. so that (6.5.45) becomes (6.5.50) The inversion of (6.5.50) follows directly from the second shifting theorem and Heaviside's expansion theorem or (6.5.51) where (6.5.52) 372 Advanced Engineering Mathematics with MATLAB (6.5.53) (6.5.54) and (6.5.55) Using Euler's identity cos(t)=(eit+e it)/2, we can write (6.5.51) as (6.5.56) Equation (6.5.56) is plotted in Figure 6.5.2. Note that fluctuations in 1 (t) are damped out by the particular design of this film projector. Because this mechanical device dampens unwanted fluctuations (or noise) in the motionpicture projector, this particular device is an example of a mechanical filter. Problems Use Heaviside's expansion theorem to find the inverse of the following Laplace transforms: 1. 2. 3. 4. The Laplace Transform 373 Find the inverse of the following transforms and express them in amplitude/phase form: 5. 6. 7. 8. 9. 6.6 CONVOLUTION In this section we turn to a fundamental concept in Laplace transforms: convolution. We shall restrict ourselves to its use in finding the inverse of a transform when that transform consists of the product of two simpler transforms. In subsequent sections we will use it to solve ordinary differential equations. We begin by formally introducing the mathematical operation of the convolution product (6.6.1) In most cases the operations required by (6.6.1) are straightforward. Example 6.6.1 Let us find the convolution between cos(t) and sin(t). (6.6.2) (6.6.3) 374 Advanced Engineering Mathematics with MATLAB (6.6.4) Example 6.6.2 Similarly, the convolution between t2 and sin(t) is (6.6.5) (6.6.6) (6.6.7) =t2+2cos(t) 2 (6.6.8) by integration by parts. Example 6.6.3 Consider now the convolution between et and the discontinuous function H(t 1) H(t 2): (6.6.9) (6.6.10) In order to evaluate the integral (6.6.10) we must examine various cases. If t<1, then both of the step functions equal zero and the convolution equals zero. However, when 1<t<2, the first step function equals one while the second equals zero as the dummy variable x runs between 1 and t. Therefore, The Laplace Transform 375 (6.6.11) because the portion of the integral from zero to one equals zero. Finally, when t>2, the integrand is only nonzero for that portion of the integration when 1<x<2. Consequently, (6.6.12) Thus, the convolution of et with the pulse H(t 1) H(t 2) is (6.6.13) MATLAB can also be used to find the convolution of two functions. For example, in the present case the commands syms x t positive int ( ' exp (t-x) * (Heaviside (x-1) -Heaviside (x-2) ) ', x, 0, t) yields ans = -Heaviside (t-1) +Heaviside (t-1) *exp (t-1) +Heaviside (t-2) -Heaviside (t-2) *exp (t-2) The reason why we introduced convolution stems from the following fundamental theorem (often called Borel's theorem5). If (t)=u(t)* (t) (6.6.14) then W(s)=U(s)V(s). (6.6.15) In other words, we can invert a complicated transform by convoluting the inverses to two simpler functions. The proof is as follows: 5 Borel, ., 1901: Leons sur les sries divergentes. Gauthier-Villars, p. 104. 376 Advanced Engineering Mathematics with MATLAB (6.6.16) (6.6.17) (6.6.18) (6.6.19) where t=r+x. Example 6.6.4 Let us find the inverse of the transform (6.6.20) (6.6.21) from Example 6.6.1. Example 6.6.5 Let us find the inverse of the transform (6.6.22) The Laplace Transform Therefore, 377 (6.6.23) (6.6.24) (6.6.25) (6.6.26) Example 6.6.6 Let us use the results from Example 6.6.3 to verify the convolution theorem. We begin by rewriting (6.6.13) in terms of the Heaviside step functions. Using the method outline in Example 6.2.1, f(t)*g(t)=(et 1 1)H(t 1)+(1 et 2)H(t 2). (6.6.27) Employing the second shifting theorem, (6.6.28) (6.6.29) (6.6.30) and the convolution theorem holds true. If we had not rewritten (6.6.13) in terms of step functions, we could still have found from the definition of the Laplace transform. 378 Advanced Engineering Mathematics with MATLAB Problems Verify the following convolutions and then show that the convolution theorem is true. Use MATLAB to check your answer. 1. 1*1=t 2. 1*cos(at)=sin(at)/a 3. 1*et=et 1 4. t*et=t3/6 5. t*sin(t)=t sin(t) 6. t*et=et t 1 7. 8. 9. H(t a)*H(t b)=(t a b)H(t a b) 10. Use the convolution theorem to invert the following functions: 11. 12. 13. Prove that the convolution of two Dirac delta functions is a Dirac delta function. 6.7 INTEGRAL EQUATIONS An integral equation contains the dependent variable under an integral sign. The convolution theorem provides an excellent tool for solving a very special class of these equations, Volterra equation of the second kind:6 (6.7.1) These equations appear in history-dependent problems, such as epidemics,7 vibration problems,8 and viscoelasticity.9 6 Fock, 1924: ber eine Klasse von Integralgleichungen. Math. Zeit., 21, 161173; Koizumi, S., 1931: On Heaviside's operational solution of a Volterra's integral equation when its nucleus is a function of (x ). Philos. Mag., Ser. 7, 11, 432441. Wang, F.J.S., 1978: Asymptotic behavior of some deterministic epidemic models. SIAM J. Math. Anal, 9, 529534. 8 9 7 Lin, S.P., 1975: Damped vibration of a string. J. Fluid Mech., 72, 787797. Rogers, T.G., and E.H.Lee, 1964: The cylinder problem in viscoelastic stress analysis. Q. Appl. Math., 22, 117131. The Laplace Transform Example 6.7.1 Let us find f(t) from the integral equation 379 (6.7.2) The integral in (6.7.2) is such that we can use the convolution theorem to find its Laplace transform. Then, because the convolution theorem yields (6.7.3) Therefore, the Laplace transform converts (6.7.2) into (6.7.4) Solving for F(s), (6.7.5) By partial fractions, or by inspection, (6.7.6) Therefore, inverting term by term, (6.7.7) Note that the integral equation (6.7.8) 380 Advanced Engineering Mathematics with MATLAB also has the same solution. Example 6.7.2 Let us solve the equation (6.7.9) Again the integral is one of the convolution type; it differs from the previous example in that it includes a derivative. Taking the Laplace transform of (6.7.9), (6.7.10) Because f(0)=0, (6.7.10) simplifies to (6.7.11) Solving for F(s), (6.7.12) Using partial fractions to invert (6.7.12), (6.7.13) Problems Solve the following integral equations: 1. The Laplace Transform 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Solve the following equation for f(t) with the condition that f(0)=4: 381 15. Solve the following equation for f(t) with the condition that f(0)=0: 16. During a study of nucleation involving idealized active sites along a boiling surface, Marto and Rohsenow10 solved the integral equation From Marto, P.J., and W.M.Rohsenow, 1966: Nucleate boiling instability of alkali metals. J. Heat Transfer, 88, 183193 with permission. 10 382 Advanced Engineering Mathematics with MATLAB to find the position x(t) of the liquid/vapor interface. If A, B, and C are constants and x(0)=0, find the solution for them. 17. Solve the following equation for x(t) with the condition that x(0)=0: where c is constant. 18. During a study of the temperature f(t) of a heat reservoir attached to a semi-infinite 11 heat-conducting rod, Huber solved the integral equation where and are constants and f(0)=0. Find f(t) for him. Hint: 19. During the solution of a diffusion problem, Zhdanov, Chikhachev, and Yavlinskii12 solved an integral equation similar to where erf (x) dy is the error function. What should they have found? Hint: You will need to prove that 20. The Laguerre polynomial13 11 From Huber, A., 1934: Eine Methode zur Bestimmung der Wrme- und Temperaturleitfahigkeit. Monatsh. Math. Phys., 41, 3542. Zhdanov, S.K., A.S.Chikhachev, and Yu.N.Yavlinskii, 1976: Diffusion boundary-value problem for regions with moving boundaries and conservation of particles. Sov. Phys. Tech. Phys., 21, 883884. 13 See 5.3 in Andrews, L.C., 1985: Special Functions for Engineers and Applied Mathematicians. MacMillian, 357 pp. 12 The Laplace Transform 383 satisfies the ordinary differential equation ty +(1 t)y +ny=(ty ) ty +ny=0, with y(0)=1 and y (0)= n. step 1: Using (6.1.20) and (6.3.22), show that the Laplace transformed version of this differential equation is where Y(s) is the Laplace transform of y(t). Step 2: Using (6.3.22) and the convolution theorem, show that Laguerre polynomials are the solution to the integral equation 6.8 SOLUTION OF LINEAR DIFFERENTIAL EQUATIONS WITH CONSTANT COEFFICIENTS For the engineer, as it was for Oliver Heaviside, the primary use of Laplace transforms is the solution of ordinary, constant coefficient, linear differential equations. These equations are important not only because they appear in many engineering problems but also because they may serve as approximations, even if locally, to ordinary differential equations with nonconstant coefficients or to nonlinear ordinary differential equations. For all of these reasons, we wish to solve the initial-value problem (6.8.1) 384 Advanced Engineering Mathematics with MATLAB by Laplace transforms, where a1, a2,...are constants and we know the value of y, y ,..., y(n 1) at t=0. The procedure is as follows. Applying the derivative rule (6.1.20) to (6.8.1), we reduce the differential equation to an algebraic one involving the constants a1, a2, an, the parameter s, the Laplace transform of f(t), and the values of the initial conditions. We then solve for the Laplace transform of y(t), Y(s). Finally, we apply one of the many techniques of inverting a Laplace transform to find y(t). Similar considerations hold with systems of ordinary differential equations. The Laplace transform of the system of ordinary differential equations results in an algebraic set of equations containing Y1(s), Y2(s),..., Yn(s). By some method we solve this set of equations and invert each transform Y1(s), Y2(s),..., Yn(s) in turn to give y1(t), y2(t),..., yn(t). The following examples will illustrate the details of the process. Example 6.8.1 Let us solve the ordinary differential equation y +2y =8t, (6.8.2) subject to the initial conditions that y (0)=y(0)=0. Taking the Laplace transform of both sides of (6.8.2), (6.8.3) or (6.8.4) where Y(s), Substituting the initial conditions into (6.8.4) and solving for (6.8.5) (6.8.6) The Laplace Transform 385 Matching powers of s in the numerators of (6.8.6), C+D=0, B+2C=0, A+2B=0, and 2A=8 or A=4, B= 2, C=1 and D= 1. Therefore, (6.8.7) Finally, performing term-by-term inversion of (6.8.7), the final solution is y(t)=2t2 2t+1 e 2t . (6.8.8) We could have performed the same operations using the symbolic toolbox with MATLAB. The MATLAB script clear % define symbolic variables syms s t Y % take Laplace transform of left side of differential equation LHS = laplace (diff (diff (sym ( 'y (t) ' ) ) ) +2*diff (sym('y(t)'))); % take Laplace transform of right side of differential equation RHS = laplace(8*t); % set Y for Laplace transform of y % and introduce initial conditions newLHS = subs(LHS,'laplace(y(t),t,s)','y(0)','D(y)(0)',Y,0,0); % solve for Y Y = solve (newLHS-RHS, Y) ; % invert Laplace transform and find y(t) y = ilaplace(Y,s,t) yields the result y = 1 exp( 2*t) 2*t+2*t^2 which agrees with (6.8.8). Example 6.8.2 Let us solve the ordinary differential equation y +y=H(t) H(t 1) (6.8.9) 386 Advanced Engineering Mathematics with MATLAB with the initial conditions that y (0)=y(0)=0. Taking the Laplace transform of both sides of (6.8.9), (6.8.10) where Y(s), Substituting the initial conditions into (6.8.10) and solving for (6.8.11) Using the second shifting theorem, the final solution is y(t)=1 cos(t) [1 cos(t 1)]H(t 1). We can check our results using the MATLAB script clear % define symbolic variables syms s t Y % take Laplace transform of left side of differential equation LHS = laplace(diff(diff(sym('y(t)'))) +sym('y(t)')); % take Laplace transform of right side of differential equation RHS = laplace('Heaviside(t) Heaviside(t 1)',t,s); % set Y for Laplace transform of y % and introduce initial conditions newLHS = subs(LHS,'laplace(y(t),t,s)','y(0)','D(y)(0)',Y,0,0); % solve for Y Y = solve(newLHS-RHS,Y); % invert Laplace transform and find y(t) y = ilaplace (Y,s,t) (6.8.12) which yields y = 1 cos(t) Heaviside(t 1)+Heaviside(t 1)*cos(t 1) The Laplace Transform Example 6.8.3 Let us solve the ordinary differential equation y +2y +y=f(t) 387 (6.8.13) with the initial conditions that y (0)=y(0)=0, where f(t) is an unknown function whose Laplace transform exists. Taking the Laplace transform of both sides of (6.8.13), s2Y(s) sy(0) y (0)+2sY(s) 2y(0)+Y(s)=F(s), (6.8.14) where Y(s), Substituting the initial conditions into (6.8.14) and solving for (6.8.15) We wrote (6.8.15) in this form because the transform Y(s) equals the product of two transforms 1/(s+1)2 and F(s). Therefore, by the convolution theorem we can immediately write (6.8.16) Without knowing f(t), this is as far as we can go. Example 6.8.4: Forced harmonic oscillator Let us solve the simple harmonic oscillator forced by a harmonic forcing y + 2 y=cos( t), (6.8.17) subject to the initial conditions that y (0)=y(0)=0. Although the complete solution could be found by summing the complementary solution and a particular solution obtained, say, from the method of undetermined coefficients, we now illustrate how we can use Laplace transforms to solve this problem. Taking the Laplace transform of both sides of (6.8.17), substituting in the initial conditions, and solving for Y(s), 388 Advanced Engineering Mathematics with MATLAB (6.8.18) and (6.8.19) Equation (6.8.19) gives an oscillation that grows linearly with time although the forcing function is simply periodic. Why does this occur? Recall that our simple harmonic oscillator has the natural frequency . But that is exactly the frequency at which we drive the system. Consequently, our choice of forcing has resulted in resonance where energy continuously feeds into the oscillator. Example 6.8.5 Let us solve the system of ordinary differential equations: 2x +y=cos(t), and y 2x=sin(t), (6.8.21) (6.8.20) subject to the initial conditions that x(0)=0, and y(0)=1. Taking the Laplace transform of (6.8.20) and (6.8.21), (6.8.22) and (6.8.23) after introducing the initial conditions. Solving for X(s) and Y(s), The Laplace Transform 389 (6.8.24) and (6.8.25) Taking the inverse of (6.8.24)(6.8.25) term by term, (6.8.26) and y(t)=t sin(t)+cos(t). (6.8.27) The MATLAB script clear % define symbolic variables syms s t X Y % take Laplace transform of left side of differential equations LHS1 = laplace(2*diff(sym('x(t)')) +sym('y(t)')); LHS2 = laplace(diff(sym('y(t)')) 2*sym('x(t)')); % take Laplace transform of right side of differential equations RHS1 = laplace(cos(t)); RHS2=laplace(sin(t)); % set X and Y for Laplace transforas of x and y % and introduce initial conditions newLHS1 = subs(LHS1,'laplace(x(t),t,s)','laplace(y(t),t,s)',... 'x(0)','y(0)',X,Y,0,1); newLHS2 = subs(LHS2,'laplace(x(t),t,s)','laplace(y(t),t,s)',... 'x(0)','y(0)',X,Y,0,1); % solve for X and Y [X,Y] = solve(newLHS1 RHS1, newLHS2 RHS2,X,Y); % invert Laplace transform and find x(t) and y(t) x = ilaplace(X,s,t);y = ilaplace(Y,s,t) 390 Advanced Engineering Mathematics with MATLAB uses the symbolic toolbox to solve (6.8.20)(6.8.21). MATLAB finally gives x = 1/2*t*cos(t) 1/2*sin(t) y = t*sin(t)+cos(t) Example 6.8.6 Let us determine the displacement of a mass m attached to a spring and excited by the driving force (6.8.28) The dynamical equation governing this system is (6.8.29) where 2=k/m and k is the spring constant. Assuming that the system is initially at rest, the Laplace transform of the dynamical system is (6.8.30) or (6.8.31) Partial fraction yield (6.8.32) Inverting (6.8.32) term by term, The Laplace Transform 391 (6.8.33) The solution to this problem consists of two parts. The exponential terms result from the forcing and will die away with time. This is the transient portion of the solution. The sinusoidal terms are those natural oscillations that are necessary so that the solution satisfies the initial conditions. They are the steady-state portion of the solution and endure forever. Figure 6.8.1 illustrates the solution when T=0.1, 1, and 2. Note that the displacement decreases in magnitude as the nondimensional frequency of the oscillator increases. Example 6.8.7 Let us solve the equation y +16y= (t /4) (6.8.34) with the initial conditions that y(0)=1, and y (0)=0. Taking the Laplace transform of (6.8.34) and inserting the initial conditions, (s2+16)Y(s)=s+e s /4 , (6.8.35) or (6.8.36) 392 Advanced Engineering Mathematics with MATLAB Figure 6.8.1: Displacement of a simple harmonic oscillator with nondimensional frequency T as a function of time t/T. The top frame shows the forcing function. Applying the second shifting theorem, (6.8.37) (6.8.38) We can check our results using the MATLAB script clear % define symbolic variables syms pi s t Y % take Laplace transform of left side of differential equation The Laplace Transform 393 LHS = laplace(diff(diff(sym('y(t)')))+16*sym('y(t)')); % take Laplace transform of right side of differential equation RHS = laplace (' Dirac(t-pi/4)',t,s); % set Y for Laplace transf orm of y % and introduce initial conditions newLHS = subs(LHS,'laplace(y(t),t,s)','y(0)','D(y)(0)',Y,1,0); % solve for Y Y = solve (newLHS-RHS, Y); % invert Laplace transform and find y(t) y = ilaplace (Y,s,t) which yields y = cos(4*t) 1/4*Heaviside(t 1/4*pi)*sin(4*t) We can also verify that (6.8.38) is the solution to our initial-value problem by computing the (generalized) derivative of (6.8.38) or (6.8.39) (6.8.40) (6.8.41) since f(t) (t t0)=f(t0) (t t0). Similarly, (6.8.42) (6.8.43) (6.8.44) 394 Advanced Engineering Mathematics with MATLAB Substituting (6.8.38) and (6.8.44) into (6.8.34) completes the verification. A quick check of y(0) and y (0) also shows that we have the correct solution. Example 6.8.8: Oscillations in electric circuits During the middle of the nineteenth century, Lord Kelvin14 analyzed the LCR electrical circuit shown in Figure 6.8.2 which contains resistance R, capacitance C, and inductance L. For reasons that we shall shortly show, this LCR circuit has become one of the quintessential circuits for electrical engineers. In this example, we shall solve the problem by Laplace transforms. Because we can add the potential differences across the elements, the equation governing the LCR circuit is (6.8.45) where I denotes the current in the circuit. Let us solve (6.8.45) when we close the circuit and the initial conditions are I(0)=0 and Q(0)= Q0. Taking the Laplace transform of (6.8.45), (6.8.46) Figure 6.8.2: Schematic of a LCR circuit. 14 Thomson, W., 1853: On transient electric currents. Philos. Mag., Ser. 4, 5, 393405. The Laplace Transform Solving for (s), 395 (6.8.47) where =R/(2L), and From the first shifting theorem, (6.8.48) 2 where 2= >0. The quantity is the natural frequency of the circuit, which is lower than the free frequency 0 of a circuit formed by a condenser and coil. Most importantly, the solution decays in amplitude with time. Although Kelvin's solution was of academic interest when he originally published it, this radically changed with the advent of radio telegraphy15 because the LCR circuit described the fundamental physical properties of wireless transmitters and receivers.16 The inescapable conclusion from numerous analyses was that no matter how cleverly the receiver was designed, eventually the resistance in the circuit would dampen the electrical oscillations and thus limit the strength of the received signal. This technical problem was overcome by Armstrong17 who invented an electrical circuit that used De Forest's audion (the first vacuum tube) for generating electrical oscillations and for amplifying externally impressed oscillations by "regenerative action." The effect of adding the "thermionic amplifier" is seen by again considering the LRC circuit as shown in Figure 6.8.3 with the modification suggested by Armstrong.18 Stone, J S., 1914: The resistance of the spark and its effect on the oscillations of electrical oscillators. Proc. IRE, 2, 307324. 16 15 See Hogan, J.L., 1916: Physical aspects of radio telegraphy. Proc. IRE, 4, 397420. 17 Armstrong, E.H., 1915: Some recent developments in the audion receiver. Proc. IRE, 3, 215247. 18 From Ballantine, S., 1919: The operational characteristics of thermionic amplifiers. Proc. IRE, 7, 129161. IRE (now IEEE). 396 Advanced Engineering Mathematics with MATLAB Figure 6.8.3: Schematic of a LCR circuit with the addition of a thermionic amplifier. [From Ballantine, S., 1919: The operational characteristics of thermionic amplifiers. Proc. IRE, 7, 155. IRE (now IEEE).] The governing equations of this new circuit are (6.8.49) and (6.8.50) where the plate circuit has the current Ip, the resistance R0, the inductance L2, and the electromotive force (emf) of The mutual inductance between the two circuits is given by M. Taking the Laplace transform of (6.8.49)(6.8.50), (6.8.51) and (6.8.52) The Laplace Transform Eliminating p 397 (s) between (6.8.51)(6.8.52) and solving for (s), (6.8.53) For high-frequency radio circuits, we can approximate the roots of the denominator of (6.8.53) as (6.8.54) and (6.8.55) In the limit of M and R0 vanishing, we recover our previous result for the LRC circuit. However, in reality, R0 is very large and our solution has three terms. The term associated with s1 is a rapidly decaying transient while the s2 and s3 roots yield oscillatory solutions with a slight amount of damping. Thus, our analysis shows that in the ordinary regenerative circuit, the tube effectively introduces sufficient "negative" resistance so that the resultant positive resistance of the equivalent LCR circuit is relatively low, and the response of an applied signal voltage at the resonant frequency of the circuit is therefore relatively great. Later, Armstrong19 extended his work on regeneration by introducing an electrical circuit--the superregenerative circuit--where the regeneration is made large enough so that the resultant resistance is negative, and self-sustained oscillations can occur. 20 It was this circuit21 which led to the explosive development of radio in the 1920s and 1930s. Armstrong, E.H., 1922: Some recent developments of regenerative circuits. Proc. IRE, 10, 244260. 20 19 See Frink, F.W., 1938: The basic principles of superregenerative reception. Proc. IRE, 26, 76106. Lewis, T., 1991: Empire of the Air: The Men Who Made Radio. HarperCollins Publishers, 421 pp. 21 398 Advanced Engineering Mathematics with MATLAB Example 6.8.9: Resonance transformer circuit One of the fundamental electrical circuits of early radio telegraphy22 is the resonance transformer circuit shown in Figure 6.8.4. Its development gave transmitters and receivers the ability to tune to each other. The governing equations follow from Kirchhoff 's law and are (6.8.56) and (6.8.57) Let us examine the oscillations generated if initially the system has no currents or charges and the forcing function is E(t)= (t). Figure 6.8.4: Schematic of a resonance transformer circuit. Fleming, J.A., 1919: The Principles of Electric Wave Telegraphy and Telephony. Longmans, Green, 911 pp. 22 The Laplace Transform Taking the Laplace transform of (6.8.56)(6.8.57), 399 (6.8.58) and (6.8.59) Because the current in the second circuit is of greater interest, we solve for that 2 and find (6.8.60) where =R/(2L2), and k2=M2/(L1L2), the so-called coefficient of coupling. We can obtain analytic solutions if we assume that the coupling is weak (k21). Equation (6.8.60) becomes (6.8.61) Using partial fractions and inverting term by term, we find that (6.8.62) 400 Advanced Engineering Mathematics with MATLAB Figure 6.8.5: The resonance curve transformer circuit with r= 2 for a resonance / 1 . where The exponentially damped solutions will eventually disappear, leaving only the steady-state oscillations which vibrate with the angular frequency 1, the natural frequency of the primary circuit. If we rewrite this steadystate solution in amplitude/phase form, the amplitude is (6.8.63) where r= 2 / 1 . As Figure 6.8.5 shows, as r increases from zero to two, the amplitude rises until a very sharp peak occurs at r=1 and then decreases just as rapidly as we approach r=2. Thus, the resonance transformer circuit provides a convenient way to tune a transmitter or receiver to the frequency 1. Example 6.8.10: Delay differential equation Laplace transforms provide a valuable tool in solving a general class of ordinary differential equations called delay differential equations. These equations arise in such diverse fields as chemical kinetics23 and population dynam ics.24 23 See Roussel, M.R., 1996: The use of delay differential equations in chemical kinetics. J. Phys. Chem., 100, 83238330. See the first chapter of MacDonald, N., 1989: Biological Delay Systems: Linear Stability Theory. Cambridge University Press, 235 pp. 24 The Laplace Transform To illustrate the technique,25 consider the differential equation x= x(t 1) 401 (6.8.64) with x(t)=1 at for 0<t<1. Clearly, x(0)=1. Multiplying (6.8.64) by e st and integrating from 1 to , (6.8.65) (6.8.66) (6.8.67) (6.8.68) since x (t)= a for 0<t<1. Solving for X(s), X(s)=(1+ae s/s a/s)/[s(1+ae s/s)]. (6.8.69) To facilitate the inversion of (6.8.69), we expand its denominator in terms of a geometric series and find that (6.8.70) 25 Reprinted with permission from Epstein, I.R., 1990: Differential delay equations in chemical kinetics: Some simple linear model systems. J. Chem. Phys., 92, 17021712. 1990, American Institute of Physics. 402 Advanced Engineering Mathematics with MATLAB The first and third sums cancel, except for the n=0 term in the first sum. Therefore, (6.8.71) and (6.8.72) Figure 6.8.6 illustrates (6.8.72) as a function of time for various values of a. For 0< <e 1, x(t) decays monotonically from 1 to an asymptotic limit of zero. For e 1<a< /2, the solution is a damped oscillatory function. If Figure 6.8.6: The solution to the differential delay equation (6.8.59) at various times t and values of a. /2<a, then x(t) is oscillatory with an exponentially increasing envelope. When a= /2, x(t) oscillates periodically. Example 6.8.11 Laplace transforms can sometimes be used to solve ordinary differential equations where the coefficients are powers of t. To illustrate this, let us solve (6.8.73) We begin by taking the Laplace transform of (6.8.73) and find that (6.8.74) The Laplace Transform 403 An interesting aspect of this problem is the fact that we not know y (0). To circumvent this difficulty, let us temporarily set y (0)= A so that (6.8.74) becomes (6.8.75) Later on, we will find A. Equation (6.8.75) is a first-order, linear, ordinary differential equation with s as its independent variable. To find Y(s), we use the standard technique of multiplying it by its integrating factor, here and rewriting it as (6.8.76) Integrating (6.8.76) from s to , we obtain (6.8.77) or (6.8.78) We must now evaluate A. From the final-value theorem, limt y(t)= lims0 sY(s)=0. Therefore, multiplying (6.8.78) by s and using the expansion for the complementary error function for small s, we have that (6.8.79) In order that lim Therefore, (6.8.80) The final step is to invert (6.8.80). Applying tables and the convolution theorem, (6.8.81) 404 Advanced Engineering Mathematics with MATLAB (6.8.82) Problems Solve the following ordinary differential equations by Laplace transforms. Then use MATLAB to verify your solution. 1. y 2y=1 t; y(0)=1 2. y 4y +3y=et; y(0)=0, y (0)=0 3. y 4y +3y=e2t; y(0)=0, y (0)=1 4. y 6y +8y=et; y(0)=3, y (0)=9 5. y +4y +3y=e t; y(0)=1, y (0)=1 6. y +y=t; y(0)=1, y (0)=0 7. y +4y +3y=et; y(0)=0, y (0)=2 8. y 4y +5y=0; y(0)=2, y (0)=4 9. y +y=tH(t 1); y(0)=0 10. y +3y +2y=H(t 1); y(0)=0, y (0)=1 11. y 3y +2y=H(t 1); y(0)=0, y (0)=1 12. y +4y=3H(t 4); y(0)=1, y (0)=0 13. y +4y +4y=4H(t 2); y(0)=0, y (0)=0 14. y +3y +2y=et 1 H(t 1); y(0)=0, y (0)=1 15. y 3y +2y=e (t 2)H(t 2); y(0)=0, y (0)=0 16. y 3y +2y=H(t 1) H(t 2); y(0)=0, y (0)=0 17. y +y=1 H(t T); y(0)=0, y (0)=0 18. 19. 20. 21. y 2y +y=3 (t 2); y(0)=0, y (0)=1 22. y 5y +4y= (t 1); y(0)=0, y (0)=0 23. y +5y +6y=3 (t 2) 4 (t 5); y(0)=y (0)=0 24. y + y =A (t ) BH(t ); y(0)=y (0)=0 25. x 2x+y=0, y 3x 4y=0; x(0)=1, y(0)=0 26. x 2y =1, x +y x=0; x(0)=y(0)=0 27. x + 2x y =0, x +y+x=t2; x(0)=y(0)=0 28. x +3x y=1, x +y +3x=0; x(0)=2, y(0)=0 The Laplace Transform 405 29. Forster, Escobal, and Lieske26 used Laplace transforms to solve the linearized equa tions of motion of a vehicle in a gravitational field created by two other bodies. A simplified form of this problem involves solving the following system of ordinary differential equations: x 2y =F1+x+2y, 2x +y =F2+2x+3y, subject to the initial conditions that x(0)=y(0)=x (0)=y (0)=0. Find the solution to this system. Use Laplace transforms to find the solution for the following ordinary differential equations: 30.y +2ty 8y=0, y(0)=1, y (0)=0 31.y ty +2y=0, y(0)= 1, y (0)=0 Step 1: Show that the Laplace transform for these differential equations is 30. 2sY (s)+(10 s2)Y(s)= s 31. sY (s)+(s2+3)Y(s)= s Step 2: Solve these first-order ordinary differential equations and show that 30.Y(s)=1/s+8/s3+32/s5+Aes2/4/s5 31.Y(s)=(A 2)e s2/2/s3+2/s3 1/s Step 3: Invert Y(s) and show that the general solutions are 30. y(t)=1+4t2+4t4/3 31. y(t)=t21 Use Laplace transforms to find the general solutions for the following ordinary differential equations: 32. ty (2 t)y y=0 33. ty 2(a+bt)y +b(2a+bt)y=0, a 0 Step 1: Show that the Laplace transform for these differential equations is 32. s(s+1)Y (s)+2(2s+1)Y(s)=3y(0) 33. (s b)2Y (s)+2(1+a)(s b)Y(s)=(1+2 )y(0) Step 2: Solve these first-order ordinary differential equations and show that 32.Y(s)=y(0)/(s +1)+y(0)/[2(s+1)2]+A/[s2(S+1)2] 33. Y(s)=y(0)/(s b)+A/(a b)2+2a Step 3: Invert Y(s) and show that the general solutions are 32. y(t)=C1(t+2)e t+C2(t 2) 33. y(t)=C1ebt+C2t2a+1ebt 26 Reprinted from Astronaut. Acta, 14, K.Forster, P.R.Escobal, and H.A.Lieske, Motion of a vehicle in the transition region of the three-body problem, 110, 1968, with kind permission from Elsevier Science Ltd, The Boulevard, Langford Lane, Kidlington OX5 1GB, UK. 406 Advanced Engineering Mathematics with MATLAB 6.9 TRANSFER FUNCTIONS, GREEN'S FUNCTION, AND INDICIAL ADMITTANCE One of the drawbacks of using Laplace transforms to solve ordinary differential equations with a forcing term is its lack of generality. Each new forcing function requires a repetition of the entire process. In this section we give some methods for finding the solution in a somewhat more general manner for stationary systems where the forcing, not any initially stored energy (i.e., nonzero initial conditions), produces the total output. Unfortunately, the solution must be written as an integral. In Example 6.8.3 we solved the linear differential equation y +2y +y=f(t), (6.9.1) subject to the initial conditions y(0)=y (0)=0. At that time we wrote the Laplace transform of y(t), Y(s), as the product of two Laplace transforms: (6.9.2) One drawback in using (6.9.2) is its dependence upon an unspecified Laplace transform F(s). Is there a way to eliminate this dependence and yet retain the essence of the solution? One way of obtaining a quantity that is independent of the forcing is to consider the ratio: (6.9.3) This ratio is called the transfer function because we can transfer the input F(s) into the output Y(s) by multiplying F(s) by G(s). It depends only upon the properties of the system. Let us now consider a related problem to (6.9.1), namely g +2g +g= (t), t>0, (6.9.4) with g(0)=g (0)=0. Because the forcing equals the Dirac delta function, g(t) is called the impulse response or Green's function.27 Computing G(s), (6.9.5) 27 For the origin of the Green's function, see Farina, J.E.G., 1976: The work and significance of George Green, the miller mathematician, 17931841. Bull. Inst. Math. Appl., 12, 98105. The Laplace Transform 407 From (6.9.3) we see that G(s) is also the transfer function. Thus, an alternative method for computing the transfer function is to subject the system to impulse forcing and the Laplace transform of the response is the transfer function. From (6.9.3), Y(s)=G(s)F(s), (6.9.6) or y(t)=g(t)*f(t). (6.9.7) That is, the convolution of the impulse response with the particular forcing gives the response of the system. Thus, we may describe a stationary system in one of two ways: (1) in the transform domain we have the transfer function, and (2) in the time domain there is the impulse response. Despite the fundamental importance of the impulse response or Green's function for a given linear system, it is often quite difficult to determine, especially experimentally, and a more convenient practice is to deal with the response to the unit step H(t). This response is called the indicial admittance or step response, which we shall denote by a(t). Because admittance because we can determine the transfer function from the indicial or sA(s)=G(s). Furthermore, because (6.9.8) then (6.9.9) from (6.1.18). Example 6.9.1 Let us find the transfer function, impulse response, and step response for the system y 3y +2y=f(t), (6.9.10) 408 Advanced Engineering Mathematics with MATLAB with y(0)=y (0)=0. To find the impulse response, we solve g 3g +2g= (t), (6.9.11) with g(0)=g (0)=0. Taking the Laplace transform of (6.9.11), we find that (6.9.12) which is the transfer function for this system. The impulse response equals the inverse of G(s) or g(t)=e2t et. (6.9.13) To find the step response, we solve a 3a +2a=H(t), (6.9.14) with a(0)=a (0)=0. Taking the Laplace transform of (6.9.14), (6.9.15) or (6.9.16) Note that a (t)=g(t). The Laplace Transform Example 6.9.2 409 MATLAB's control toolbox contains several routines for the numerical computation of impulse and step responses if the transfer function can be written as the ratio of two polynomials. To illustrate this capacity, let us redo the previous example where the transfer function is given by (6.9.12). The transfer function is introduced by loading in the polynomial in the numerator num and in the denominator den followed by calling tf. The MATLAB script clear % load in coefficients of the numerator and denominator % of the transfer function num = [0 0 1] ; den = [1 3 2] ; % create the transfer function sys = tf (num, den) ; % find the step response, a Figure 6.9.1: The impulse and step responses corresponding to the transfer function (6.9.12). [a, t] = step (sys) ; % plot the indicial admittance subplot (2, 1, 1) , plot (t, a, 'o') ylabel ( ' indicial response','Fontsize', 20) % find the impulse response, g [g, t] = impulse (sys) ; % plot the impulse response subplot (2, 1, 2), plot (t, g, 'o' ) ylabel ( ' impulse response','Fontsize' , 20) xlabel ( 'time', 'Fontsize' , 20 ) shows how the impulse and step responses are found. Both of them are shown in Figure 6.9.1. 410 Advanced Engineering Mathematics with MATLAB Example 6.9.3 There is an old joke about a man who took his car into a garage because of a terrible knocking sound. Upon his arrival the mechanic took one look at it and gave it a hefty kick.28 Then, without a moment's hesitation he opened the hood, bent over, and tightened up a loose bolt. Turning to the owner, he said, "Your car is fine. That'll be $50." The owner felt that the charge was somewhat excessive, and demanded an itemized account. The mechanic said, "The kicking of the car and tightening one bolt, cost you a buck. The remaining$49 comes from knowing where to kick the car and finding the loose bolt." Although the moral of the story may be about expertise as a marketable commodity, it also illustrates the concept of transfer function.29 Let us model the car as a linear system where the equation (6.9.17) governs the response y(t) to a forcing f(t). Assuming that the car has been sitting still, the initial conditions are zero and the Laplace transform of (6.9.17) is K(s)Y(s)=F(s), (6.9.18) where K(s)=ansn+an 1sn 1+...+ 1s+a0. (6.9.19) Hence (6.9.20) where the transfer function G(s) clearly depends only on the internal workings of the car. So if we know the transfer function, we understand how the car vibrates because 28 This is obviously a very old joke. 29 Originally suggested by Stern, M.D., 1987: Why the mechanic kicked the car--A teaching aid for transfer functions. Math. G z., 71, 6264. The Laplace Transform 411 (6.9.21) But what does this have to do with our mechanic? He realized that a short sharp kick mimics an impulse forcing with f(t)= (t) and y(t)=g(t). Therefore, by observing the response of the car to his kick, he diagnosed the loose bolt and fixed the car. In this section we showed how the response of any system can be expressed in terms of its Green's function and the arbitrary forcing. Can we also determine the response using the indicial admittance a(t)? Consider first a system that is dormant until a certain time t= 1. At that instant we subject the system to a forcing H(t equal the indicial admittance a(t 1 1 ). Then the response will be zero if t< 1 1 and will ) when t> because the indicial admittance is the 1 response of a system to the step function. Here t is the time measured from the instant of change. Next, suppose that we now force the system with the value f(0) when t=0 and hold that value until t= 1. We then abruptly change the forcing by an amount f( 1) f(0) to the value f( 1) at the time 1 and hold it at that value until t= 2. Then we again abruptly change the 2 forcing by an amount f( 2) f( 1) at the time , and so forth (see Figure 6.9.2). From Figure 6.9.2: Diagram used in the derivation of Duhamel's integral. the linearity of the problem the response after the instant t= y(t)=f(0) (t)+[f( 1) f(0)]a(t +...+[f( n) f( n 1 1 n equals the sum 2 )+[f( 2) f( 1)]a(t ) )] (t n ). (6.9.22) 412 Advanced Engineering Mathematics with MATLAB If we write f( k) f( k 1 )= fk and k k 1 = k , (6.9.22) becomes (6.9.23) Finally, proceeding to the limit as the number n of jumps becomes infinite, in such a manner that all jumps and intervals between successive jumps tend to zero, this sum has the limit (6.9.24) Because the total response of the system equals the weighted sum [the weights being (t)] of the forcing from the initial moment up to the time t, we refer to (6.9.24) as the superposition integral, or Duhamel's integral,30 named after the French mathematical physicist Jean-Marie-Constant Duhamel (17971872) who first derived it in conjunction with heat conduction. We can also express (6.9.24) in several different forms. Integration by parts yields (6.9.25) Example 6.9.4 Suppose that a system has the step response of a(t)=A[1 e t/T], where A and T are positive constants. Let us find the response if we force this system by f(t)=kt, where k is a constant. From the superposition integral (6.9.24), (6.9.26) Problems For the following nonhomogeneous differential equations, find the transfer function, impulse response, and step response. Assume that all of the necessary initial conditions are zero. If you have MATLAB's control toolbox, use MATLAB to check your work. 30 Duhamel, J.-M.-C., 1833: Memoire sur la mthode gnrale relative au mouvement de la chaleur dans les corps solides plongs dans des milieux dont la temprature varie avec le temps. J. cole Polytech., 22, 2077. The Laplace Transform 1. y +ky=f(t) 2. y 2y 3y=f(t) 3. y +4y+3y=f(t) 4. y 2y +5y=f(t) 5. y 3y +2y=f(t) 6. y +4y +4y=f(t) 7. y 9y=f(t) 8. y +y=f(t) 9. y y =f(t) 6.10 INVERSION BY CONTOUR INTEGRATION 413 In 6.5 and 6.6 we showed how we can use partial fractions and convolution to find the inverse of the Laplace transform F(s). In many instances these methods fail simply because of the complexity of the transform to be inverted. In this section we shall show how we can invert transforms through the powerful method of contour integration. Of course, the student must be proficient in the use of complex variables. Consider the piece-wise differentiable function f(x) which vanishes for x<0. We can express the function e cxf(x) by the complex Fourier representation of (6.10.1) for any value of the real constant c, where the integral (6.10.2) exists. By multiplying both sides of (6.10.1) by ecx and bringing it inside the first integral, (6.10.3) With the substitution z=c+ i, where z is a new, complex variable of integration, (6.10.4) 414 Advanced Engineering Mathematics with MATLAB The quantity inside the square brackets is the Laplace transform F(z). Therefore, we can express f(t) in terms of its transform by the complex contour integral (6.10.5) This line integral, Bromwich's integral,31 runs along the line x=c parallel to the imaginary axis and c units to the right of it, the so-called Bromwich contour. We select the value of c sufficiently large so that the integral (6.10.2) exists; subsequent analysis shows that this occurs when c is larger than the real part of any of the singularities of F(z). We must now evaluate the contour integral. Because of the power of the residue theorem in complex variables, the contour integral is usually transformed into a closed contour through the use of Jordan's lemma. See 5.4, Equations (5.4.12) and (5.4.13). The following examples will illustrate the proper use of (6.10.5). Example 6.10.1 Let us invert (6.10.6) From Bromwich's integral, (6.10.7) (6.10.8) Bromwich, T.J. I'A., 1916: Normal coordinates in dynamical systems. Proc. London Math. Soc., Ser. 2, 15, 401448. 31 The Laplace Transform 415 Figure 6.10.1: An outstanding mathematician at Cambridge University at the turn of the twentieth century, Thomas John I'Anson Bromwich (18751929) came to Heaviside's operational calculus through his interest in divergent series. Beginning a correspondence with Heaviside, Bromwich was able to justify operational calculus through the use of contour integrals by 1915. After his premature death, individuals such as J.R.Carson and Sir H. Jeffreys brought Laplace transforms to the increasing attention of scientists and engineers. (Portrait courtesy of the Royal Society of London.) where CR is a semicircle of infinite radius in either the right or left half of the z-plane and C is the closed contour that includes CR and Bromwich's contour. See Figure 6.10.2. Our first task is to choose an appropriate contour so that the integral along CR vanishes. By Jordan's lemma this requires a semicircle in the right half-plane if t 3<0 and a semicircle in the left half-plane if t 3>0. Consequently, by considering these two separate cases, we force the second integral in (6.10.8) to zero and the inversion simply equals the closed contour. Consider the case t<3 first. Because Bromwich's contour lies to the right of any singularities, there are no singularities within the closed contour and f(t)=0. Consider now the case t<3. Within the closed contour in the left halfplane, there is a second-order pole at z=0 and a simple pole at z=1. 416 Advanced Engineering Mathematics with MATLAB Figure 6.10.2: Contours used in the inversion of (6.10.6). Therefore, (6.10.9) where (6.10.10) (6.10.11) =2 t, (6.10.12) and (6.10.13) The Laplace Transform Taking our earlier results into account, the inverse equals f(t)=[et 3 417 (t 3) 1] H(t 3) (6.10.14) which we would have obtained from the second shifting theorem and tables. Example 6.10.2 For our second example of the inversion of Laplace transforms by complex integration, let us find the inverse of (6.10.15) where a is real. From Bromwich's integral, (6.10.16) Here c is greater than the real part of any of the singularities in (6.10.15). Using the infinite product for the hyperbolic sine,32 (6.10.17) Thus, we have a second-order pole at z=0 and simple poles at zn=n i/ , where n=1, 2, 3,.... We can convert the line integral (6.10.16), with the Bromwich contour lying parallel and slightly to the right of the imaginary axis, into a closed contour using Jordan's lemma through the addition of an infinite semicircle joining i to i as shown in Figure 6.10.3. We now apply the residue theorem. For the second-order pole at z=0, (6.10.18) (6.10.19) Gradshteyn, I.S., and I.M.Ryzhik, 1965: Table of Integrals, Series and Products. Academic Press, 1.431, Formula 2. 32 418 Advanced Engineering Mathematics with MATLAB (6.10.20) (6.10.21) after using sinh(az)=az+O(z3). For the simple poles zn=n i/ , (6.10.22) (6.10.23) (6.10.24) Figure 6.10.3: Contours used in the inversion of (6.10.15). The Laplace Transform because cosh(n i)=cos(n )=( 1)n. Thus, summing up all of the residues gives 419 (6.10.25) (6.10.26) In addition to computing the inverse of Laplace transforms, Bromwich's integral places certain restrictions on F(s) in order that an inverse exists. If denotes the minimum value that c may possess, the restrictions are threefold.33 First, F(z) must be analytic in the halfplane x , where z=x+iy. Second, in the same half-plane it must behave as z k, where k>1. Finally, F(x) must be real when x . Example 6.10.3 Is the function sin(s)/(s2 +4) a proper Laplace transform? Although the function satisfies the first and third criteria listed in the previous paragraph on the half-plane x>2, the function becomes unbounded as y for any fixed x>2. Thus, sin(s)/(s2+4) cannot be a Laplace transform. Example 6.10.4 An additional benefit of understanding inversion by the residue method is the ability to qualitatively anticipate the inverse by knowing the location of the poles of F(s). This intuition is important because many engineering analyses discuss stability and performance entirely in terms of the properties of the system's Laplace transform. In Figure 6.10.4 we have graphed the location of the poles of F(s) and the corresponding f(t). The student should go through the mental exercise of connecting the two pictures. Problems Use Bromwich's integral to invert the following Laplace transforms: 1. 2. 33 For the proof, see Churchill, R.V., 1972: Operational Mathematics. McGraw-Hill, 67. 420 Advanced Engineering Mathematics with MATLAB 3. 4. 5. 6. 7. 8. 9. Consider a function f(t) which has the Laplace transform F(z) which is analytic in the half-plane Re(z)>s0. Can we use this knowledge to find g(t) whose Laplace transform G(z) equals F[ (z)], where (z) is also analytic for Re(z)>s0? The answer to this question leads to the Schouten34-Van der Pol35 theorem. Step 1: Show that the following relationships hold true: and 34 Schouten, J.P., 1935: A new theorem in operational calculus together with an application of it. Physica, 2, 7580. Van der Pol, B., 1934: A theorem on electrical networks with applications to filters. Physica, 1, 521530. 35 The Laplace Transform 421 Figure 6.10.4: The correspondence between the location of the simple poles of the Laplace transform F(s) and the behavior of f(t). 422 Advanced Engineering Mathematics with MATLAB Step 2: Using the results from Step 1, show that This is the Schouten-Van der Pol theorem. show that Step 3: If Hint: Do not evaluate the contour integral. Instead, ask yourself: What function of time has a Laplace transform that equals e (z) , where is a parameter? Then use tables. Chapter 7 The Z-Transform Since the Second World War, the rise of digital technology has resulted in a corresponding demand for designing and understanding discrete-time (data sampled) systems. These systems are governed by difference equations in which members of the sequence yn are coupled to each other. One source of difference equations is the numerical evaluation of integrals on a digital computer. Because we can only have values at discrete time points tk=kT for k=0, 1, 2,..., the value of the integral d is (7.0.1) (7.0.2) =y[(k 1)T]+Tf(kT), (7.0.3) Equation (7.0.3) is an example of a firstorder because difference equation because the numerical scheme couples the sequence value y(kT) directly to the previous sequence value y[(k 1)T]. If (7.0.3) had contained y[(k 2)T], then it would have been a second-order difference equation, and so forth. Although we could use the conventional Laplace transform to solve these difference equations, the use of z-transforms can greatly facilitate the analysis, especially when we only desire responses at the sampling instants. Often the entire analysis can be done using only the transforms and the analyst does not actually find the sequence y(kT). 424 Advanced Engineering Mathematics with MATLAB Figure 7.1.1: Schematic of how a continuous function f(t) is sampled by a narrow-width pulse sampler (t) and an ideal sampler fs (t). In this chapter we will first define the z-transform and discuss its properties. Then we will show how to find its inverse. Finally we shall use them to solve difference equations. 7.1 THE RELATIONSHIP OF THE Z-TRANSFORM TO THE LAPLACE TRANSFORM1 Let f(t) be a continuous function that an instrument samples every T units of time. We See Figure 7.1.1. Taking the duration of denote this data-sampled function by an individual sampling event, to be small, we may approximate the narrow-width pulse in Figure 7.1.1 by flat-topped pulses. Then approximately equals (7.1.1) if T. Gera [Gera, A.E., 1999: The relationship between the z-transform and the discretetime Fourier transform. IEEE Trans. Auto. Control, AC-44, 370371] has explored the general relationship between the one-sided discrete-time Fourier transform and the onesided z-transform. See also Naumovi , M.B., 2001: Interrelationship between the one-sided discrete-time Fourier transform and one-sided delta transform. Electr. Engng., 83, 99101. 1 The Z-Transform 425 is troublesome in (7.1.1); it adds one more parameter to our Clearly the presence of problem. For this reason we introduce the concept of the ideal sampler, where the sampling time becomes infinitesimally small so that (7.1.2) (7.1.3) Let us now find the Laplace transform of this data-sampled function. From the linearity property of Laplace transforms, (7.1.4) (7.1.5) Because (7.1.5) simplifies to (7.1.6) If we now make the substitution that z=esT, then FS(s) becomes (7.1.7) where F(z) is the one-sided z-transform2 of the sequence f(nT), which we shall now 1 denote by fn. Here denotes the operation of taking the z-transform while 2 The standard reference is Jury, E.I., 1964: Theory and Application of the z-Transform Method John Wiley & Sons, 330 pp. 426 Advanced Engineering Mathematics with MATLAB represents the inverse z-transformation. We will consider methods for finding the inverse z-transform in 7.3. Just as the Laplace transform was defined by an integration in t, the z-transform is defined by a power series (Laurent series) in z. Consequently, every z-transform has a region of convergence which must be implicitly understood if not explicitly stated. Furthermore, just as the Laplace integral diverged for certain functions, there are sequences where the associated power series diverges and its z-transform does not exist. Consider now the following examples of how to find the z-transform. Example 7.1.1 Given the unit sequence fn=1, n 0, let us find F(z). Substituting fn into the definition of the z-transform leads to . (7.1.8) because is a complex-valued geometric series with common ratio z 1. This series converges if |z 1|<1 or |z|>1, which gives the region of convergence of F(z). MATLAB's symbolic toolbox provides an alternative to the hand computation of the z-transform. In the present case, the command syms z; syms n positive ztrans (1, n, z) yields ans = z/(z-1) Example 7.1.2 Let us find the z-transform of the sequence fn=e anT , n 0, (7.1.9) for a real and a imaginary. For a real, substitution of the sequence into the definition of the ztransform yields The Z-Transform 427 (7.1.10) If u=e aT z 1, then (7.1.10) is a geometric series so that (7.1.11) Because |u|=e Thus, aT |z 1|, the condition for convergence is that |z|>e aT . (7.1.12) For imaginary a, the infinite series in (7.1.10) converges if |z|>1, because |u|=|z 1| when a is imaginary. Thus, (7.1.13) Although the z-transforms in (7.1.12) and (7.1.13) are the same in these two cases, the corresponding regions of convergence are different. If a is a complex number, then (7.1.14) Checking our work using MATLAB, we type the commands: syms a z; syms n T positive ztrans(exp(-a*n*T),n,z); simplify(ans) which yields ans = z*exp(a*T)/(z*exp(a*T)-1) Example 7.1.3 Let us find the z-transform of the sinusoidal sequence 428 Advanced Engineering Mathematics with MATLAB fn=cos(n T), n 0. (7.1.15) Substituting (7.1.15) into the definition of the z-transform results in (7.1.16) From Euler's formula, (7.1.17) so that (7.1.16) becomes (7.1.18) or (7.1.19) From (7.1.13), (7.1.20) Substituting (7.1.20) into (7.1.19) and simplifying yields (7.1.21) Example 7.1.4 Let us find the z-transform for the sequence The Z-Transform 429 (7.1.22) From the definition of the z-transform, (7.1.23) (7.1.24) (7.1.25) We could also have obtained (7.1.25) via MATLAB by typing the commands: syms z;syms n positive ztrans('1+((1/2^n-1)*Heaviside(n-6)',n,z) which yields ans = 2*z/(2*z-1)+1/2/z+3/4/z^2+7/8/z^3+15/16/z^4+31/32/z^5 We summarize some of the more commonly encountered sequences and their transforms in Table 7.1.1 along with their regions of convergence. Example 7.1.5 In many engineering studies, the analysis is done entirely using transforms without actually finding any inverses. Consequently, it is useful to compare and contrast how various transforms behave in very simple test problems. Consider the time function f(t)=ae atH(t), a>0. Its Laplace and Fourier transform are identical, namely a/(a+i ), if we set s=i . In Figure 7.1.2 we illustrate its behavior as a function of positive . Let us now generate the sequence of observations that we would measure if we sampled f(t) every T units of time apart: fn=ae anT. Taking the 430 Advanced Engineering Mathematics with MATLAB Table 7.1.1: Z-Transforms of Some Commonly Used Sequences fn, n 0 1. f0=k=const. fn=0, n 1 2. fm=k=const. fn=0, for all values of n m 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. k=constant kn kn2 ke anT, a complex kne anT, a complex sin( 0nT) cos( 0nT) e anT sin( 0nT) e anT cos( 0nT) n F(z) k Region of convergence |z|>0 kz m |z|>0 kz/(z 1) kz/(z 1) 2 |z|>1 |z|>1 |z|>1 |z|>|e aT| |z|>|e aT| |z|>1 |z|>1 |z|>|e aT| |z|>|e aT| kz(z+1)/(z 1)3 kz/(z e aT) , constant n n n2 n z/(z z/(z ) )2 )3 |z|>| | |z|>| | |z|>| | |z|>cosh( 0T) |z|>sinh( 0T) z(z+ )/(z sinh( 0nT) cosh( 0nT) an/n! [ln(a)]n/n! ea/z a1/z |z|>0 |z|>0 The Z-Transform 431 Figure 7.1.2: The amplitude of the Laplace or Fourier transform (solid line) for ae atH(t) and the z-transform (dashed line) for fn=ae anT as a function of frequency for various positive values of a and T=1. z-transform of this sequence, it equals az/(z e aT). Recalling that z= esT=eiwT, we can also plot this transform as a function of positive . For small , the transforms agree, but as becomes larger they diverge markedly. Why does this occur? Recall that the z-transform is computed from a sequence comprised of samples from a continuous signal. One very important flaw in sampled data is the possible misrepresentation of high-frequency effects as lower-frequency phenomena. It is this aliasing or folding effect that we are observing here. Consequently, the z-transform of a sampled record can differ markedly from the corresponding Laplace or Fourier transforms of the continuous record at frequencies above one half of the sampling frequency. This also suggests that care should be exercised in interpolating between sampling instants. Indeed, in those applications where the output between sampling instants is very important, such as in a hybrid mixture of digital and analog systems, we must apply the so-called "modified z-transform." Problems From the fundamental definition of the z-transform, find the transform of the following sequences, where n 0. Then check your answer using MATLAB. 1. 2. 3. 4. 432 Advanced Engineering Mathematics with MATLAB 5. 7.2 SOME USEFUL PROPERTIES In principle we could construct any desired transform from the definition of the z-transform. However, there are several general theorems that are much more effective in finding new transforms. Linearity From the definition of the z-transform, it immediately follows that if hn=c1fn+c2gn, then H(z)=c1F(z)+c2G(z), (7.2.1) where F(z)= (fn), G(z)= (gn), H(z)= (hn), and c1, c2 are arbitrary constants. Multiplication by an exponential sequence If gn=e anT fn, n 0, then G(z)=F(zeaT). (7.2.2) This follows from (7.2.3) (7.2.4) This is the z-transform analog to the first shifting theorem in Laplace transforms. Shifting The Z-Transform 433 The effect of shifting depends upon whether it is to the right or to the left, as Table 7.2.1 illustrates. For the sequence fn 2, no values from the sequence fn are lost; thus, we anticipate that the z-transform of fn 2 only involves F(z). However, in forming the sequence fn+2, the first two values of fn are lost, and we anticipate that the z-transform of fn+2 cannot be expressed solely in terms of F(z) but must include those two lost pieces of information. Table 7.2.1: Examples of Shifting Involving Sequences n 0 1 2 3 4 fn 1 2 4 8 16 fn 2 0 0 1 2 4 fn+2 4 8 16 64 128 Let us now confirm these conjectures by finding the z-transform of fn+1 which is a sequence that has been shifted one step to the left. From the definition of the z-transform, it follows that (7.2.5) or (7.2.6) where we added zero in (7.2.6). This algebraic trick allows us to collapse the first two terms on the right side of (7.2.6) into one and (7.2.7) In a similar manner, repeated applications of (7.2.7) yield 434 Advanced Engineering Mathematics with MATLAB (7.2.8) where m>0. This shifting operation transforms fn+m into an algebraic expression involving m. Furthermore, we introduced initial sequence values, just as we introduced initial conditions when we took the Laplace transform of the nth derivative of f(t). We will make frequent use of this property in solving difference equations in 7.4. Consider now shifting to the right by the positive integer k, gn=fn kHn k, n 0, (7.2.9) where Hn k=0 for n<k and 1 for n k. Then the z-transform of (7.2.9) is G(z)=z kF(z), (7.2.10) where G(z)= (gn), and F(z)= (fn). This follows from (7.2.11) (7.2.12) This result is the z-transform analog to the second shifting theorem in Laplace transforms. In symbolic calculations involving MATLAB, the operator Hn k can be expressed by Heaviside(n k). Initial-value theorem The initial value of the sequence fn, f0, can be computed from F(z) using the initial-value theorem: (7.2.13) The Z-Transform From the definition of the z-transform, 435 (7.2.14) In the limit of z , we obtain the desired result. Final-value theorem The value of fn, as n , is given by the final-value theorem: (7.2.15) where F(z) is the z-transform of fn. We begin by noting that (7.2.16) Using the shifting theorem on the left side of (7.2.16), (7.2.17) Applying the limit as z approaches 1 to both sides of (7.2.17): (7.2.18) (7.2.19) (7.2.20) 436 Advanced Engineering Mathematics with MATLAB = f0+f . (7.2.21) Consequently, (7.2.22) Note that this limit has meaning only if f exists. This occurs if F(z) has no second-order or higher poles on the unit circle and no poles outside the unit circle. Multiplication by n Given gn=nfn, n 0, (7.2.23) this theorem states that (7.2.24) where G(z)= (gn), and F(z)= (fn). This follows from (7.2.25) Periodic sequence theorem Consider the N-periodic sequence: (7.2.26) The Z-Transform 437 (7.2.27) This theorem allows us to find the z-transform of fn if we can find the ztransform of xn via the relationship (7.2.28) where X(z)= (xn). This follows from (7.2.29) (7.2.30) Application of the shifting theorem in (7.2.30) leads to F(z)=X(z)+z NX(z)+z 2N X(z)+... (7.2.31) =X(z)[1+z N+z 2N +...]. (7.2.32) Equation (7.2.32) contains an infinite geometric series with common ratio z N, which converges if |zN|<1. Thus, (7.2.33) Convolution Given the sequences fn and gn, the convolution product of these two sequences is 438 Advanced Engineering Mathematics with MATLAB and the related sequence: (7.2.34) Given F(z) and G(z), we then have that W(z)=F(z)G(z). This follows from (7.2.35) because gn k=0 for k>n. Reversing the order of summation and letting m=n k, (7.2.36) (7.2.37) We can use MATLAB's command conv( ) which multiplies two polynomials to perform discrete convolution as follows: x = [1 1 1 1 1 1 1] ; y = [1 2 4 8 16 32 64] ; z = conv (x, y) produces z= 1 3 7 15 31 63 127 126 124 120 112 96 64 The first seven values of z contains the convolution of the sequence x with the sequence y. Consider now the following examples of the properties discussed in this section. Example 7.2.1 From (7.2.38) for n 0 and |z|>|a|, we have that The Z-Transform 439 (7.2.39) and (7.2.40) if n 0 and |z|>1. Therefore, the sequence fn=cos(nx) has the z-transform (7.2.41) (7.2.42) Example 7.2.2 Using the z-transform, (7.2.43) we find that (7.2.44) =(z) ( 1) (1 az 1) 2( a)( 1)z 2 (7.2.45) (7.2.46) Example 7.2.3 Consider F(z)=2az 1/(1 az 1)3, where |a|<|z| and |a|<1. Here we have that 440 Advanced Engineering Mathematics with MATLAB (7.2.47) from the initial-value theorem. This agrees with the inverse of F(z): fn=n(n+1)an, n 0. (7.2.48) If the z-transform consists of the ratio of two polynomials, we can use MATLAB to find f0. For example, if F(z)=2z2/(z 1)3, we can find f0 as follows: num = [2 0 0]; den = conv([1 -1],[1 -1]); den = conv(den,[1 -1]); initialvalue = polyval(num, 1e20) / polyval(den,1e20) initialvalue = 2.0000e-20 Therefore, f =0.0 Example 7.2.4 Given the z-transform F(z)=(1 a)z/[(z 1)(z a)], where |z|>1> a>0, then from the final-value theorem we have that (7.2.49) This is consistent with the inverse transform fn=1 an with n 0. Example 7.2.5 Using the sequences fn=1 and gn=an, where a is real, verify the convolution theorem. We first compute the convolution of fn with gn, namely (7.2.50) Taking the z-transform of n , The Z-Transform 441 (7.2.51) and convolution theorem holds true for this special case. Problems Use the properties of z-transforms and Table 7.1.1 to find the z-transform of the following sequences. Then check your answer using MATLAB. 1. 2. 3. fn=nTe anT 4. 5. 6. 7. 8. 9. fn=( 1)n (Hint: fn is a periodic sequence.) 10. Using the property stated in (7.2.23)(7.2.24) twice, find the z-transform of n =n[n(1)n]. Then verify your result using MATLAB. 2 fn=cos(n 2)Hn fn=3+e 2nT 0 2 fn=sin(n T+ ) 11. Verify the convolution theorem using the sequences fn=gn=1. Then check your results using MATLAB. 12. Verify the convolution theorem using the sequences fn=1 and gn=n. Then check your results using MATLAB. 13. Verify the convolution theorem using the sequences fn=gn=1/(n!). [Hint: Use the binomial theorem with x=1 to evaluate the summation.] Then check your results using MATLAB. (fn)=F(z). 14. If a is a real number, show that (anf )=F(z/ ), where n 442 Advanced Engineering Mathematics with MATLAB 7.3 INVERSE Z-TRANSFORMS In the previous two sections we dealt with finding the z-transform. In this section we find fn by inverting the z-transform F(z). There are four methods for finding the inverse: (1) power series, (2) recursion, (3) partial fractions, and (4) the residue method. We will discuss each technique individually. The first three apply only to those functions F(z) that are rational functions while the residue method is more general. For symbolic computations with MATLAB, you can use iztrans. Power series By means of the long-division process, we can always rewrite F(z) as the Laurent expansion: F(z)=a0+a1z 1+a2z 2+.... (7.3.1) From the definition of the z-transform, (7.3.2) the desired sequence fn is given by an. Example 7.3.1 Let (7.3.3) Using long division, N(z) is divided by D(z) and we obtain (7.3.4) Therefore, (7.3.5) The Z-Transform which suggests that f0= and fn=1 for n 1 is the inverse of F(z). Example 7.3.2 Let us find the inverse of the z-transform: 443 (7.3.6) By the long-division process, we have that Thus, f0=2, f1=1.5, f2=1.25, f3=1.125, and so forth, or fn=1+ n . In general, this technique only produces numerical values for some of the elements of the sequence. Note also that our long division must always yield the power series (7.3.1) in order for this method to be of any use. To check our answer using MATLAB, we type the commands: syms z;syms n positive iztrans((2*z^2-1.5*z)/(z^2-1.5*z+0.5),z,n) which yields a ns = 1+(1/2)^n Recursive method An alternative to long division was suggested3 several years ago. It obtains the inverse recursively. We begin by assuming that the z-transform is of the form 3 Jury, E.I., 1964: Theory and Application of the z-Transform Method. John Wiley & Sons, p. 41; Pierre, D.A., 1963: A tabular algorithm for z-transform inversion. Control Engng., 10(9), 110111. The present derivation is by Jenkins, L.B., 1967: A useful recursive form for obtaining inverse z-transforms. Proc. IEEE, 55, 574575. IEEE. 444 Advanced Engineering Mathematics with MATLAB (7.3.7) where some of the coefficients theorem, i and bi may be zero and b0 0. Applying the initial-value (7.3.8) Next, we apply the initial-value theorem to z[F(z) f0] and find that (7.3.9) (7.3.10) =(a1 b1f0)/b0. (7.3.11) Note that the coefficient a0 b0f0=0 from (7.3.8). Similarly, (7.3.12) (7.3.13) =(a2 b2f0 b1f1)/b0 (7.3.14) because a0 b0f0=a1 b1f0 f1b0=0. Continuing this process, we finally have that The Z-Transform fn=(an bnf0 bn 1f1 ... b1fn 1)/b0, 445 (7.3.15) where an=bn 0 for n>m. Example 7.3.3 Let us redo Example 7.3.2 using the recursive method. Comparing (7.3.7) to (7.3.6), =2, 1= 1.5, 2=0, b0=1, b1= 1.5, b2=0.5, and an=bn=0 if n 3. From (7.3.15), 0 f0=a0/b0=2/1=2, (7.3.16) f1=(a1 b1f0)/b0=[ 1.5 ( 1.5)(2)]/1=1.5, (7.3.17) f 2 =(a2 b2f0 b1f1)/b0 (7.3.18) =[0 (0.5)(2) ( 1.5)(1.5)]/1=1.25, (7.3.19) and f3=(a3 b3f0 b2f1 b1f2)/b0 (7.3.20) =[0 (0)(2) (0.5)(1.5) ( 1.5)(1.25)]/1=1.125. (7.3.21) Partial fraction expansion One of the popular methods for inverting Laplace transforms is partial fractions. A similar, but slightly different scheme works here. 446 Advanced Engineering Mathematics with MATLAB Example 7.3.4 Given F(z)=z/(z2 1), let us find fn. The first step is to obtain the partial fraction expansion of F(z)/z. Why we want F(z)/z rather than F(z) will be made clear in a moment. Thus, (7.3.22) where (7.3.23) and (7.3.24) Multiplying (7.3.22) by z, (7.3.25) Next, we find the inverse z-transform of z/(z 1) and z/(z+1) in Table 7.1.1. This yields (7.3.26) Thus, the inverse is (7.3.27) From this example it is clear that there are two steps: (1) obtain the partial fraction expansion of F(z)/z, and (2) find the inverse z-transform by referring to Table 7.1.1. Example 7.3.5 Given F(z)=2z2/[(z+2)(z+l)2], let us find fn. We begin by expanding F(z)/z as The Z-Transform 447 (7.3.28) where (7.3.29) (7.3.30) and (7.3.31) so that (7.3.32) or (7.3.33) From Table 7.1.1, (7.3.34) (7.3.35) 448 Advanced Engineering Mathematics with MATLAB and (7.3.36) Applying (7.3.34)(7.3.36) to (7.3.33), fn=4( 1)n 4( 2)n+2n( 1)n, n 0. Example 7.3.6 Given F(z)=(z2+z)/(z 2)2, let us determine fn. Because (7.3.38) (7.3.37) (7.3.39) Referring to Table 7.1.1, (7.3.40) Substituting (7.3.40) into (7.3.39) yields (7.3.41) Residue method The power series, recursive, and partial fraction expansion methods are rather limited. We now prove that fn may be computed from the following inverse integral formula: (7.3.42) The Z-Transform 449 where C is any simple curve, taken in the positive sense, that encloses all of the singularities of F(z). It is readily shown that the power series and partial fraction methods are special cases of the residue method. Proof: Starting with the definition of the z-transform (7.3.43) we multiply (7.3.43) by zn 1 and integrating both sides around any contour C which includes all of the singularities, (7.3.44) Let C be a circle of radius R, where R>R1. Then, changing variables to z=Rei , and dz=izd , (7.3.45) Substituting (7.3.45) into (7.3.44) yields the desired result that (7.3.46) We can easily evaluate the inversion integral (7.3.42) using Cauchy's residue theorem. Example 7.3.7 Let us find the inverse z-transform of (7.3.47) From the inversion integral, (7.3.48) 450 Advanced Engineering Mathematics with MATLAB Clearly the integral has simple poles at z=1 and z=2. However, when n=0 we also have a simple pole at z=0. Thus the cases n=0 and n>0 must be considered separately. Case 1: n=0. The residue theorem yields (7.3.49) Evaluating these residues, (7.3.50) (7.3.51) and (7.3.52) Substituting (7.3.50)(7.3.52) into (7.3.49) yields f0=0. Case 2: n>0. Here we only have contributions from z=1 and z=2. (7.3.53) where (7.3.54) and (7.3.55) The Z-Transform Thus, fn=2n 1 451 1, n>0. (7.3.56) Combining our results, (7.3.57) Example 7.3.8 Let us use the inversion integral to find the inverse of (7.3.58) The inversion theorem gives (7.3.59) where the pole at z=1 is second order. Consequently, the corresponding residue is (7.3.60) Thus, the inverse z-transform of (7.3.58) is fn=3n+1, n 0. (7.3.61) Example 7.3.9 Let F(z) be a z-transform whose poles lie within the unit circle |z|=1. Then (7.3.62) 452 Advanced Engineering Mathematics with MATLAB and (7.3.63) We now multiply both sides of (7.3.63) by z Therefore, 1 and integrate around the unit circle C. (7.3.64) after interchanging the order of integration and summation. Performing the integration, (7.3.65) which is Parseval's theorem for one-sided z-transforms. Recall that there are similar theorems for Fourier series and transforms. Example 7.3.10 Evaluation of partial summations4 Consider the partial summation SN= employed to compute SN. We begin by noting that (7.3.66) fn. We shall now show that z-transforms can be Here we employed the inversion integral to replace fn and reversed the order of integration and summation. This interchange is permissible since we only have a partial summation. Because the summation in (7.3.66) is a geometric series, we have the final result that Taken from Bunch, K.J., W.N.Cain, and R.W.Grow, 1990: The z-transform method of evaluating partial summations in closed form. J. Phys. A, 23, L1213L1215. The material has been used with the permission of the authors and IOP Publishing Limited. 4 The Z-Transform 453 (7.3.67) Therefore, we can use the residue theorem and z-transforms to evaluate partial summations. Let us find S = N n3. Because fn=n3, F(z)=z(z2+4z+1)/(z 1)4. Consequently (7.3.68) (7.3.69) (7.3.70) (7.3.71) Example 7.3.11 An additional benefit of understanding inversion by the residue method is the ability to qualitatively anticipate the inverse by knowing the location of the poles of F(z). This intuition is important because many engineering analyses discuss stability and performance entirely in terms of the properties of the system's z-transform. In Figure 7.3.1 we graphed the location of the poles of F(z) and the corresponding fn. The student should go through the mental exercise of connecting the two pictures. Problems Use the power series or recursive method to compute the first few values of fn of the following z-transforms. Then check your answers with MATLAB. 1. 2. 3. 454 Advanced Engineering Mathematics with MATLAB 4. Use partial fractions to find the inverse of the following z-transforms. Then verify your answers with MATLAB. 5. 6. 7. 8. 9. Using the property that the z-transform of gn=fn kHn the inverse of k if n 0 is G(z)=z kF(z), find Then check your answer with MATLAB. Use the residue method to find the inverse z-transform of the following z-transforms. Then verify your answer with MATLAB. 10. 11. 12. 13. F(z)=e /z The Z-Transform 455 Figure 7.3.1: The correspondence between the location of the simple poles of the z-transform F(z) and the behavior of fn. 456 Advanced Engineering Mathematics with MATLAB 7.4 SOLUTION OF DIFFERENCE EQUATIONS Having reached the point where we can take a z-transform and then find its inverse, we are ready to use it to solve difference equations. The procedure parallels that of solving ordinary differential equations by Laplace transforms. Essentially we reduce the difference equation to an algebraic problem. We then find the solution by inverting Y(z). Example 7.4.1 Let us solve the second-order difference equation 2yn+23yn+1+yn=5 3n, n 0, (7.4.1) where y0=0 and y1=1. Taking the z-transform of both sides of (7.4.1), we obtain (7.4.2) From the shifting theorem and Table 7.1.1, (7.4.3) Substituting y0=0 and y1=1 into (7.4.3) and simplifying yields (7.4.4) or (7.4.5) The Z-Transform To obtain yn from Y(z) we can employ partial fractions or the residue method. Applying partial fractions gives 457 (7.4.6) where (7.4.7) and (7.4.8) Thus, (7.4.9) or (7.4.10) From (7.4.10) and Table 7.1.1, (7.4.11) An alternative to this hand calculation is to use MATLAB's ztrans and iztrans to solve difference equations. In the present case, the MATLAB script would read clear % define symbolic variables syms z Y; syms n positive % take z-transform of left side of difference equation ; LHS = ztrans(2*sym('y(n+2)')-3*sym('y(n+1)')+sym('y(n)'),n,z ) 458 Advanced Engineering Mathematics with MATLAB % take z-transform of right side of difference equation RHS = 5*ztrans(3^n,n,z); % set Y for z-transform of y and introduce initial conditions newLHS = subs (LHS, ztrans (y(n),n , z)',' y (0) ' ' (0)','Y,0,1); ' , y % solve for Y Y = solve (newLHS-RHS,Y); % invert z-transform and find y(n) y = iztrans(Y,z,n) This script produced y = -1/2+1/2*3^n Two checks confirm that we have the correct solution. First, our solution must satisfy the initial values of the sequence. Computing y0 and y1, (7.4.12) and (7.4.13) Thus, our solution gives the correct initial values. Our sequence yn must also satisfy the difference equation. Now (7.4.14) and (7.4.15) Therefore, (7.4.16) The Z-Transform 459 and our solution is correct. Finally, we note that the term 3n/2 is necessary to give the right side of (7.4.1); it is the particular solution. The 1/2 term is necessary so that the sequence satisfies the initial values; it is the complementary solution. Example 7.4.2 Let us find the yn in the difference equation yn+2 2yn+1+yn=1, n 0 (7.4.17) with the initial conditions y0=0 and y1=3/2. From (7.4.17), (7.4.18) The z-transform of the left side of (7.4.18) is obtained from the shifting theorem and Table 7.1.1 yields (1). Thus, (7.4.19) Substituting y0=0 and y1=3/2 in (7.4.19) and simplifying gives (7.4.20) or (7.4.21) We find the inverse z-transform of (7.4.21) by the residue method or (7.4.22) 460 Advanced Engineering Mathematics with MATLAB (7.4.23) Thus, (7.4.24) Note that n2/2 gives the particular solution to (7.4.17), while n is there so that yn satisfies the initial conditions. This problem is particularly interesting because our constant forcing produces a response that grows as n2, just as in the case of resonance in a time-continuous system when a finite forcing such as sin( 0t) results in a response whose amplitude grows as tm. Example 7.4.3 Let us solve the difference equation b2yn+yn+2=0, (7.4.25) where the initial conditions are y0=b2 and y1=0. We begin by taking the z-transform of each term in (7.4.25). This yields (7.4.26) From the shifting theorem, it follows that b2Y(z)+z2Y(z) z2y0 zy1=0. (7.4.27) Substituting y0=b2 and y1=0 into (7.4.27), b2Y(z)+z2Y(z) b2z2=0, (7.4.28) The Z-Transform or 461 (7.4.29) To find yn we employ the residue method or (7.4.30) Thus, (7.4.31) (7.4.32) because cos(x)= (eix+e ix). Consequently, we obtain the desired result that (7.4.33) Example 7.4.4: Compound interest Difference equations arise in finance because the increase or decrease in an account occurs in discrete steps. For example, the amount of money in a compound interest saving account after n+1 conversion periods (the time period between interest payments) is yn+1=yn+ryn, (7.4.34) 462 Advanced Engineering Mathematics with MATLAB Figure 7.4.1: The amount in a saving account as a function of an annual conversion period when interest is compounded at the annual rate of 12% and a $1000 is taken from the account every period starting with period 10. where r is the interest rate per conversion period. The second term on the right side of (7.4.34) is the amount of interest paid at the end of each period. Let us ask a somewhat more difficult question of how much money we will have if we withdraw the amount A at the end of every period starting after the period . Now the difference equation reads yn+1=yn+ryn AHn 1 . (7.4.35) Taking the z-transform of (7.4.35), (7.4.36) after using (7.2.10) or (7.4.37) Taking the inverse of (7.4.37), (7.4.38) The Z-Transform 463 The first term in (7.4.38) represents the growth of money by compound interest while the second term gives the depletion of the account by withdrawals. Figure 7.4.1 gives the values of yn for various starting amounts assuming an annual conversion period with r=0.12, =10 years, and A=$1000. These computations were done two ways using MATLAB as follows: % load in parameters clear; r = 0.12; A = 1; k = 0:30 ; y = zeros(length(k),3); yanswer = zeros(length(k),3); % set initial condition for m=1:3 y (1, m) = m; % compute other y values for n = 1:30 y(n+1,m) = y(n,m)+r*y(n,m); y(n+1,m) = y(n+1 m)-A*stepfun(n,11); , end % now use (7.4.38) for n = 1:31 yanswer(n, m)=y(1,m)*(1+r)^(n-1); yanswer (n, m) = yanswer (n, m) -A* ((1+r) ^ (n-10)-1) *stepfun(n,11)/r; end; end; plot(k,y,'o'); hold; plot(k,yanswer,'s')s; axis([0 30 0 10]) xlabel('number of conversion periods ','Fontsize',20) ylabel('amount left in account(K$)','Fontsize',20) Figure 7.4.1 shows that if an investor places an initial amount of$3000 in an account bearing 12% annually, after 10 years he can withdraw \$1000 annually, essentially forever. This is because the amount that he removes every year is replaced by the interest on the funds that remain in the account. Example 7.4.5 Let us solve the following system of difference equations: xn+1=4xn+2yn, and yn+1=3xn+3yn, (7.4.40) (7.4.39) 464 Advanced Engineering Mathematics with MATLAB with the initial values of x0=0 and y0=5. Taking the z-transform of (7.4.39)(7.4.40), zX(z) x0z=4X(z)+2Y(z), (7.4.41) zY(z) y0z=3X(z)+3Y(z), (7.4.42) or (z 4)X(z) 2Y(z)=0, (7.4.43) 3X(z) (z 3)Y(z)= 5z. (7.4.44) Solving for X(z) and Y(z), (7.4.45) and (7.4.46) Taking the inverse of (7.4.45)(7.4.46) term by term, xn= 2+2 6n, and yn=3+2 6n. (7.4.47) We can also check our work using the MATLAB script clear % define symbolic variables syms X Y z ; syms n positive % take z-transform of left side of differential equations LHS1 = ztrans (sym ( 'x (n+1) ' ) -4*sym ( ' x (n) ' ) -2*sym('y(n)'),n,z); The Z-Transform LHS2 = ztrans (sym ( 'y (n+1) ' ) -3*sym ( ' x (n) ' ) -3*sym('y(n)),n,z ' % set X and Y f or the z-transform of x and y % and introduce initial conditions newLHS1 = subs(LHS1,'ztrans(x(n),n,z)','ztrans(y(n),n,z )',... 'x(0)','y(0)',X,Y,0,5); newLHS2 = subs(LHS2,'ztrans(x(n),n,z)','ztrans(y(n),n,z )',... 'x(0)','y(0)',X,Y,0,5); % solve for X and Y [X, Y] = solve (newLHS1, newLHS2, X, Y) ; % invert z-transform and find x (n) and y (n) x = iztrans (X, z, n) y = iztrans (Y, z, n) 465 This script yields x = 2*6^n -2 y = 2*6^n+3 Problems Solve the following difference equations using z-transforms, where n 0. Check your answer using MATLAB. 1. yn+1 yn=n2, y0=1. 2. yn+22 yn+1+yn=0, y0=y1=1. 3. yn+22yn+1+yn=1, y0=y1=0. 4. yn+1+3yn=n, y0=0. 5. yn+1 5yn=cos(n ), y0=0. 6. yn+24yn=1, y0=1, y1=0. 7. 8. yn+2 5yn+1+6yn=0, y0=y1=1 466 Advanced Engineering Mathematics with MATLAB 9. yn+23yn+1+2yn=1, y0=y1=0. 10. yn+22yn+1+yn=2, y0=0, y1=2. 11. xn+1=3xn 4yn, yn+1=2xn 3yn, x0=3, y0=2. 12. xn+1=2xn 10yn, yn+1= xn yn, x0=3, y0= 2. 13. xn+1=xn 2yn, yn+1= 6yn, x0= 1, y0= 7. 14. xn+1=4xn 5yn, yn+1=xn 2yn, x0=6, y0=2. 7.5 STABILITY OF DISCRETE-TIME SYSTEMS When we discussed the solution of ordinary differential equations by Laplace transforms, we introduced the concept of transfer function and impulse response. In the case of discrete-time systems, similar considerations come into play. Consider the recursive system yn=a1yn 1Hn 1+a2yn 2Hn 2+xn, n 0, (7.5.1) where Hn k is the unit step function. It equals 0 for n<k and 1 for n k. Equation (7.5.1) is called a recursive system because future values of the sequence depend upon all of the previous values. At present, a1 and 2 are free parameters which we shall vary. Using (7.2.10), z2Y(z) 1 zY(z) a2Y(z)=z2X(z), (7.5.2) or (7.5.3) The Z-Transform 467 As in the case of Laplace transforms, the ratio Y(z)/X(z) is the transfer function. The inverse of the transfer function gives the impulse response for our discrete-time system. This particular transfer function has two poles, namely (7.5.4) At this point, we consider three cases. Case 1: z1, 2=re i 0T /4+a2<0. In this case z1 and z2 are complex conjugates. Let us write them as . Then (7.5.5) where r2= a2, and 0 T=cos 1(a1/2r). From the inversion integral, (7.5.6) where gn denotes the impulse response. Now (7.5.7) (7.5.8) (7.5.9) Similarly, (7.5.10) 468 Advanced Engineering Mathematics with MATLAB and (7.5.11) A graph of sin[(n+1) 0 T]/sin( 0 T) with respect to n gives a sinusoidal envelope. More importantly, if |r|<1 these oscillations vanish as n and the system is stable. On the other hand, if |r|>1 the oscillations grow without bound as n and the system is unstable. Recall that |r|>1 corresponds to poles that lie outside the unit circle while |r|<1 is exactly the opposite. Our example suggests that for discretetime systems to be stable, all of the poles of the transfer function must lie within the unit circle while an unstable system has at least one pole that lies outside of this circle. Case 2: /4+a2>0. This case leads to two real roots, z1 and z2. From the inversion integral, the sum of the residues gives the impulse response (7.5.12) Once again, if the poles lie within the unit circle, |z1|<1 and |z2|<1, the system is stable. Case 3: /4+a2=0. This case yields z1=z2, (7.5.13) and (7.5.14) This system is obviously stable if |a1/2|<1 and the pole of the transfer function lies within the unit circle. In summary, finding the transfer function of a discrete-time system is important in determining its stability. Because the location of the poles of G(z) determines the response of the system, a stable system has all of its poles within the unit circle. Conversely, if any of the poles of G(z) lie outside of the unit circle, the system is unstable. Finally, if limn gn=c, the system is marginally stable. For example, if G(z) has simple poles, some of the poles must lie on the unit circle. The Z-Transform Example 7.5.1 469 Numerical methods of integration provide some of the simplest, yet most important, difference equations in the literature. In this example,5 we show how z-transforms can be used to highlight the strengths and weaknesses of such schemes. Consider the trapezoidal integration rule in numerical analysis. The integral yn is updated by adding the latest trapezoidal approximation of the continuous curve. Thus, the integral is computed by (7.5.15) where T is the interval between evaluations of the integrand. We first determine the stability of this rule because it is of little value if it is not stable. Using (7.2.10), the transfer function is (7.5.16) To find the impulse response, we use the inversion integral and find that (7.5.17) At this point, we must consider two cases: n=0 and n>0. For n=0, (7.5.18) For n>0, (7.5.19) Therefore, the impulse response for this numerical scheme is g0= and gn=T for n>0. From Salzer, J.M., 1954: Frequency analysis of digital computers operating in real time. Proc. IRE, 42, 457466. IRE (now IEEE). 5 470 Advanced Engineering Mathematics with MATLAB Note that this is a marginally stable system (the solution neither grows nor decays with n) because the pole associated with the transfer function lies on the unit circle. Having discovered that the system is not unstable, let us continue and explore some of its properties. Recall now that z=esT=ei T if s=i . Then the transfer function becomes (7.5.20) On the other hand, the transfer function of an ideal integrator is 1/s or i/ . Thus, the trapezoidal rule has ideal phase but its shortcoming lies in its amplitude characteristic; it lies below the ideal integrator for 0< T< . We show this behavior, along with that for Simpson's one third rule and Simpson's three eighth rule, in Figure 7.5.1. Figure 7.5.1 confirms the superiority of Simpson's one third rule over his three eighth rule. The figure also shows that certain schemes are better at suppressing noise at higher frequencies, an effect not generally emphasized in numerical calculus but often important in system design. For example, the trapezoidal rule is inferior to all others at low frequencies but only to Simpson's one third rule at higher frequencies. Furthermore, the trapezoidal rule might actually be preferred not only because of its simplicity but also because it attenuates at higher frequencies, thereby counteracting the effect of noise. Figure 7.5.1: Comparison of various quadrature formulas by ratios of their amplitudes to that of an ideal integrator. [From Salzer, J.M., 1954: Frequency analysis of digital computers operating in real time. Proc. IRE, 42, p. 463. IRE (now IEEE).] Example 7.5.2 Given the transfer function The Z-Transform 471 (7.5.21) is this discrete-time system stable or marginally stable? This transfer function has two simple poles. The pole at z=1/2 gives rise to a term that varies as in the impulse response while the z=1 pole gives a constant. Because this constant neither grows nor decays with n, the system is marginally stable. Example 7.5.3 In most cases the transfer function consists of a ratio of two polynomials. In this case we can use the MATLAB function filter to compute the impulse response as follows: Consider the Kronecker delta sequence, x0=1, and xn=0 for n>0. From the definition of thez-transform, X(z)=1. Therefore, if our input into filter is the Kronecker delta sequence, the output yn will be the impulse response since Y(z)=G(z). If the impulse response grows without bound as n increases, the system is unstable. If it goes to zero as n increases, the system is stable. If it remains constant, it is marginally stable. To illustrate this concept, the following MATLAB script finds the impulse response corresponding to the transfer function (7.5.21): % enter the coefficients of the numerator of the transfer function (7.5.21) % Figure 7.5.2: The impulse response for a discrete system with a transform function given by (7.5.21). num = [1 0 0]; % enter the coefficients of the denominator % of the transfer function (7.5.21) den = [1 -1.5 0.5]; % create the Kronecker delta sequence x = [1 zeros(1, 20)]; % find the impulse response 472 Advanced Engineering Mathematics with MATLAB y = filter(num,den,x); % plot impulse response plot(y,'o'),axis([0 20 0.5 2.5]) xlabel('n+1','Fontsize',20) ylabel('impulse response', 'Fontsize',20) Figure 7.5.2 shows the computed impulse response. The asymptotic limit is two, so the system is marginally stable as we found before. We note in closing that the same procedure can be used to find the inverse of any ztransform which consists of a ratio of two polynomials. Here we simply set G(z) equal to the given z-transform and perform the same analysis. Problems For the following time-discrete systems, find the transfer function and determine whether the systems are unstable, marginally stable, or stable. Check your answer by graphing the impulse response using MATLAB. 1. yn=yn 1Hn 1+xn 2. yn=2yn 1Hn 1 yn 2Hn 2+xn 3. yn=3yn 1Hn 1+xn 4. Chapter 8 The Hilbert Transform In addition to the Fourier, Laplace, and z-transforms, there are many other linear transforms which have their own special niche in engineering. Examples include Hankel, Walsh, Radon, and Hartley transforms. In this chapter we consider the Hilbert transform which is a commonly used technique for relating the real and imaginary parts of a spectral response, particularly in communication theory. We begin our study of Hilbert transforms by first defining them and then exploring their properties. Next, we develop the concept of the analytic signal. Finally, we explore a property of Hilbert transforms that is frequently applied to data analysis: the Kramers-Kronig relationship. 8.1 DEFINITION In Chapter 7 we motivated the development of z-transforms by exploring the concept of the ideal sampler. In the case of Hilbert transforms, we introduce another fundamental operation, namely quadrature phase shifting or the ideal Hilbert transformer. This procedure does nothing more than shift the phase of all input frequency components by /2. Hilbert transformers are frequently used in communication systems and signal processing; examples include the generation of single-sideband modulated signals and radar and speech signal processing. Because a /2 phase shift is equivalent to multiplying the Fourier transform of a signal by e i /2= i, and because phase shifting must be an odd function of frequency,1 the transfer function of the phase shifter is G( )= i sgn( ), where sgn( ) is defined by (5.2.11). In other words, if X( ) denotes the input spectrum to the phase shifter, the output spectrum must be i sgn( )X( ). If the process is repeated, the total phase shift is , a complete phase reversal of all frequency components. The output spectrum then equals [ i sgn( )]2X( )= X( ). This agrees with the notion of phase reversal because the output function is x(t). Consider now the impulse response of the quadrature phase shifter, g(t)= F 1[G( )]. From the definition of Fourier transforms, (8.1.1) and (8.1.2) 1 For a real function the phase of its Fourier transform must be an odd function of . 474 Advanced Engineering Mathematics with MATLAB Since G ( )= 2i ( ), the corresponding impulse response is (8.1.3) Consequently, if x(t) is the input to a quadrature phase shifter, the superposition integral gives the output time function as (8.1.4) as the Hilbert transform of x(t), although some authors use the We shall define negative of (8.1.4) corresponding to a+ /2 phase shift. The transform is also called the harmonic conjugate of x(t). In similar fashion, is the Hilbert transform of the Hilbert transform of x(t) and corresponds to the output of two cascaded phase shifters. However, this output is known to be x(t), so = x(t), and we arrive at the inverse Hilbert transform relationship that (8.1.5) The Hilbert Transform 475 Figure 8.1.1: Descended from a Prussian middle-class family, David Hilbert (18621943) would make significant contributions in the fields of algebraic form, algebraic number theory, foundations of geometry, analysis, mathematical physics, and the foundations of mathematics. Hilbert transforms arose during his study of integral equations [Hilbert, D., 1912: Grundzge einer allgemeinen Theorie der linearen Integralgleichungen. Teubner, p. 75]. (Portrait courtesy of Photo AKG, London.) Taken together, x(t) and are called a Hilbert pair. Hilbert pairs enjoy the unique property that x(t)+ is an analytic function.2 Because of the singularity at =t, the integrals in (8.1.4) and (8.1.5) must be taken in the Cauchy principal value sense by approaching the singularity point from both sides, namely (8.1.6) so that the infinities to the right and left of =t, cancel each other. See 1.10. We also note that the Hilbert transform is basically a convolution and 2 For the proof, see Titchmarsh, E.C., 1948: Introduction to the Theory of Fourier Integrals. Oxford University Press, p. 125. 476 Advanced Engineering Mathematics with MATLAB does not produce a change of domain; if x is a function of time, then is also a function of time. This is quite different from what we encountered with Laplace or Fourier transforms. From its origin in phase shifting, Hilbert transforms of sinusoidal functions are trivial. Some examples are (8.1.7) Similarly, (8.1.8) and (8.1.9) Thus, Hilbert transformation does not change the amplitude of sine or cosine but does change their phase by /2. Example 8.1.1 Let us apply the integral definition of the Hilbert transform (8.1.4) to find the Hilbert transform of sin( t), 0. From the definition, (8.1.10) If x=t , then (8.1.11) The Hilbert Transform Example 8.1.2 477 Let us compute the Hilbert transform of x(t)=sin(t)/(t2+1) from the definition of the Hilbert transform, (8.1.4). From the definition, (8.1.12) Because of the singularity on the real axis at =t, we treat the integrals in (8.1.12) in the sense of Cauchy principal value. To evaluate (8.1.12), we convert it into a closed contour integration by introducing a semicircle CR of infinite radius in the upper half-plane. This Table 8.1.1: The Hilbert Transform of Some Common Functions function, x(t) 1. Hilbert transform, 2. 3. 4. 5. sin( t+ ) cos( t+ ) e i t+ i sgn( ) cos( t+ ) sgn( ) sin( t+ ) i sgn( )ei t+ i (t) 6. 7. 8. 9. 10. 11. sin (at)J1(at), 0<a cos(at)J1(at) 478 Advanced Engineering Mathematics with MATLAB 12. 13. 14. 15. sin(at) Jn(bt), 0<b<a cos( t)J1( t), 0<a cos(at)Jn(bt), 0<b< cos(at)Jn(bt) sin(at)J1(at) sin(at)Jn(at) 16. yields a closed contour C which consists of the real line plus this semicircle. Therefore, (8.1.12) can be rewritten (8.1.13) The second integral on the right side of (8.1.13) vanishes by (1.9.7). The evaluation of the closed integral in (8.1.13) follows from the residue theorem. We have that (8.1.14) and (8.1.15) We do not have a contribution from z= Therefore, i because it lies outside of the closed contour. (8.1.16) Only one half of the value of the residue at z=t was included; this reflects the semicircular indentation around the singularity there. Substituting (8.1.16) into (8.1.12), we obtain the final result that The Hilbert Transform 479 (8.1.17) Example 8.1.3 Let us employ the relationship that the Fourier transform of the Fourier transform of x(t) to find the Hilbert transform of Because equals i sgn( ) times . (8.1.18) Therefore, (8.1.19) (8.1.20) (8.1.21) (8.1.22) where s=t+ i. The integral in (8.1.22) is the well known Dawson's integral.3 See Gautschi and Waldvogel4 for an alternative derivation. Example 8.1.4: Numerical computation of the Hilbert transform Recently Andr Weideman5 devised a particularly efficient method for numerically computing the Hilbert transform when x(t) is known exactly for any real t and enjoys the property that 3 4 5 Press, W.H., S.A.Teukolsky, W.T.Vetterling, and B.P.Flannery, 1992: Numerical Recipes in Fortran: The Art of Scientific Computing. Cambridge University Press, 6.10. Gautschi, W., and J.Waldvogel, 2000: Computing the Hilbert transform of the generalized Laguerre and Hermite weight functions. BIT, 41, 490503. Weideman, J.A.C., 1995: Computing the Hilbert transform on the real line. Math. Comput., 64, 745762. 480 Advanced Engineering Mathematics with MATLAB (8.1.23) Given (8.1.23), the function x(t) can be represented by the rational expansion (8.1.24) where n (t) is the set of rational functions (8.1.25) and (8.1.26) or (8.1.27) if we introduce the substitution t=tan( /2). Why is (8.1.24) useful? Taking the Hilbert transform of both sides of (8.1.24), (8.1.28) The Hilbert Transform 481 Using contour integration, we find that (8.1.29) where sgn(t) is the signum function with sgn(0)=1. Therefore, (8.1.30) We must now approximate (8.1.30) so that we can evaluate it numerically. We do this by introducing the following truncated version: (8.1.31) This particular truncation was chosen because coefficient an has become An, which equals n(t) and n 1 (t) are a conjugate pair. The (8.1.32) where j= j/N. The terms corresponding to j=N have been set to zero because it is assumed that x(t) vanishes rapidly with t . Finally, we substitute for t and transform (8.1.31) into (8.1.33) The advantage of (8.1.32) and (8.1.33) is that they can be evaluated using fast Fourier transforms. For example, the following MATLAB script devised by Weideman illustrates his methods for x(t)=1/(1+t4): % initialize parameters used in computation b = 1; N = 8; n = [-N:N-1]'; 482 Advanced Engineering Mathematics with MATLAB Figure 8.1.2: The Hilbert transform for x(t)=1/(1+t4) computed from Weidemans algorithm. % set up collocation points and evaluate function there t = b * tan(pi*(n+1/2)/(2*N));F = 1./(1+t.^4); % evaluate (8.1.32) an = fftshift (fft(F.*(b-i*t))); % compute hilbert transform via (8.1.33) hilbert = ifft (fftshift (i* (sign (n+1/2).*an) ) )./b-i*t); hilbert = -real (hilbert) ; % find points at which we will compute exact answer tt = [-12:0.02:12]; % compute exact answer answer = tt.*(1+tt.^2)./(1+tt.^4)./sqrt (2) ; fzero = zeros (size (tt)); % plot both computed Hilbert transform and exact answer plot(tt,answer,'-',t,hilbert, 'o',tt,fzero,'--') xlabel ('t','Fontsize',20) legend ( 'exact Hilbert transform',' computed Hilbert transform') legend boxoff Figure 8.1.2 illustrates Weideman's algorithm for numerically computing the Hilbert transform of 1/(1+t4). There are two important points concerning Weideman's implementation of his algorithm. First, the collocation points originally given by tj= tan[ j/(2N)], j= N,..., N 1 j= N,..., N 1. This change replaces the have changed to trapezoidal rule discretization for the Fourier coefficients with a midpoint rule. The The Hilbert Transform 483 advantages are twofold: First, it avoids the nuisance of dealing with a collocation point at infinity. Second, it actually yields more accurate results in many cases. The discerning student will also notice that Weideman introduced a free parameter b which we set to one. This rescaling parameter can have a major influence on the accuracy. The interested student is referred to the bottom of page 756 in Weideman's paper for further details. Example 8.1.5: Discrete Hilbert transform Quite often the function is given as discrete data points. How do we find the Hilbert transform in this case? We will now prove6 that the equivalent discrete Hilbert transform is (8.1.34) where fn denotes a set of discrete data values that are sampled at t=nT and both k and n run from to . The corresponding inverse is (8.1.35) We begin our proof by inserting (8.1.34) into (8.1.35). For n even, (8.1.36) (8.1.37) (8.1.38) 6 Kak, S.C., 1970: The discrete Hilbert transform. Proc. IEEE, 58, 585586. 1970 IEEE. For an alternative derivation, see Kress, R., and E.Martensen, 1970: Anwendung der Rechteckregel auf die reelle Hilberttransformation mit unendlichem Intervall. Zeit. Angew. Math. Mech., 50, T61T64. 484 Advanced Engineering Mathematics with MATLAB The term within the curly brackets equals zero as k runs through all of its values. Therefore, (8.1.38) reduces to (8.1.39) However, the term in the brackets of (8.1.39) equals 2/8. Therefore, (8.1.34) (8.1.35) is proved for n even. An identical proof follows for n odd. A popular alternative7 to (8.1.34) involves the (fast) Fourier transform and the relationship that sgn( )X( ), where X( ) and denote the Fourier transform of x(t) and respectively. In this technique, a fast Fourier transform is taken of the data. This transformed dataset is then multiplied by i sgn( ) and then back transformed to give the Hilbert transform. Let x(t) be a real, even function. Then X( ), the Fourier transform of x(t), is also an even function. Consequently, (8.1.40) (8.1.41) (8.1.42) (8.1.43) Note that the Hilbert transform in this case is an odd function. Similarly, if x(t) is a real, odd function, (8.1.44) and the Hilbert transform is an even function. 7 ek, V., 1970: Discrete Hilbert transform. IEEE Trans. Audio Electroacoust., AU-18, 340343. The Hilbert Transform Problems 485 1. Show that the Hilbert transform of a constant function is zero. 2. Use (8.1.4) to compute the Hilbert transform of cos( t), 0. 3. Use (8.1.4) to show that the Hilbert transform of the Dirac delta function (t) is 1/( t). 4. Use (8.1.4) to show that the Hilbert transform of 1/(t2+1) is t/(t2+1). 5. The output y(t) from an ideal lowpass filter can be expressed by the convolution integral where x(t) is the input signal. Show that this expression can also be expressed in terms of Hilbert transforms as y(t)=H[x(t) cos(2 t)] sin(2 t) H[x(t) sin(2 t)] cos(2 t). Use (8.1.26) to find the Hilbert transforms of 6. 7. Using MATLAB, test Weideman's algorithm for the following cases. Why does the algorithm do well or not? 8. 9. sin(t) 10. 11. For Problem 11, you will need 486 Advanced Engineering Mathematics with MATLAB 8.2 SOME USEFUL PROPERTIES In principle we could construct any desired transform from the definition of the Hilbert transform. However, there are several general theorems that are much more effective in finding new transforms. Linearity From the definition of the Hilbert transform, it immediately follows that if z(t)=c1x(t)+c2y(t), where c1 and c2 are arbitrary constants, then The energy in a signal and its Hilbert transform are the same. Consider the energy spectral densities at input and output of a quadrature phase shifter. The output equals (8.2.1) Because the energy spectral density at input and output are the same, so are the total energies. A signal and its Hilbert transform are orthogonal. From Parseval's theorem, (8.2.2) where Then, (8.2.3) because the integrand in the middle expression of (8.2.3) is odd. Thus, (8.2.4) The Hilbert Transform 487 The reason why a function and its Hilbert transform are orthogonal to each other follows from the fact that a Hilbert transformation of a function shifts the phase of each Fourier component of the function forward by /2 for positive frequencies and backward for negative frequencies. Example 8.2.1 Let us verify the orthogonality condition for Hilbert transforms using x(t)=1/(1+t2). Because (8.2.5) since the integrand is an odd function. Shifting Let us find the Hilbert transform of x(t+a) if we know Hilbert transforms, From the definition of (8.2.6) or Time scaling Let a>0. Then, (8.2.7) On the other hand, if a<0, (8.2.8) Thus, we have that 488 Advanced Engineering Mathematics with MATLAB Derivatives Let us find the relationship between the nth derivative of x(t) and its Hilbert transform. Using the derivative rule as it applies to Fourier transforms, (8.2.9) (8.2.10) Taking the inverse Fourier transforms, we have that (8.2.11) Convolution Hilbert transforms enjoy a similar, but not identical, property with Fourier transforms with respect to convolution. If (8.2.12) then (t)= (t)*(t). (8.2.13) Table 8.2.1: Some General Properties of Hilbert Transforms function, x(t) 1. 2. x(t)+y(t) Hilbert transform, x(t) The Hilbert Transform 3. 4. 5. 6. 7. x(at) tx(t) (t+a)x(t) x(t+a), a real 489 Proof: From the convolution theorem as it applies to Fourier transforms, W( )=V( )U( ). Multiplying both sides of the equation by i sgn( ), ( )= i sgn( ) W( )=V( )[ i sgn( )U( )]=V( )( ). (8.2.14) Again, using the convolution theorem as it applies to Fourier transforms, we arrive at the final result. Example 8.2.2 Given the functions u(t)=cos(t) and v(t)=1/(1+t4), let us verify the convolution theorem as it applies to Hilbert transforms. With u(t)=cos(t) and (t)=1/(1+t4), (8.2.15) (8.2.16) (8.2.17) so that (8.2.18) 490 Advanced Engineering Mathematics with MATLAB Because (8.2.19) (8.2.20) (8.2.21) (8.2.22) and the convolution theorem for Hilbert transforms holds true in this case. Product theorem Let f(t) and g(t) denote complex functions with Fourier transforms F( ) and G( ), respectively. If 1) F( ) vanishes for | |>a, and G( ) vanishes for | |<a, where a>0, or 2) f(t) and g(t) are analytic functions (their real and imaginary parts are Hilbert pairs), then the Hilbert transform of the product of f(t) and g(t) is (8.2.23) Proof:8 The product f(t)g(t) can be expressed as (8.2.24) Because 8 Taken from Bedrosian, E., 1963: A product theorem for Hilbert transforms. Proc. IEEE, 51, 868869. 1963 IEEE. This theorem has been extended to functions of n-dimensional real vectors by Stark, H., 1971: An extension of the Hilbert transform product theorem. Proc. IEEE, 59, 13591360. The Hilbert Transform 491 (8.2.25) Figure 8.2.1: Region of integration in the proof of the product theorem. The shaded regions of Figure 8.2.1 are those in which the product F(u)G( ) is nonvanishing for the conditions of the theorem. In Figure 8.2.1(a) the nonoverlapping Fourier transforms yield two semi-infinite strips in which the product is nonvanishing. In Figure 8.2.1(b), for analytic functions, the Fourier transforms vanish for negative arguments9 so that the product is nonvanishing only in the first quadrant. In both cases sgn(u+ )= sgn( ) over the regions of integration in which the integrand is nonvanishing. Thus, (8.2.26) (8.2.27) Example 8.2.3: Hilbert Transforms of Band-Pass Functions In communications, we have the double-sideband, amplitude modulated signal given by a(t) cos( t+ ), where is constant. From the product theorem its Hilbert transform equals a(t) sin( t+ ), >0, provided that the highest frequency component in a(t) is less 9 Titchmarsh, E.C., 1948: Introduction to the Theory of Fourier Integrals. Oxford University Press, p. 128. 492 Advanced Engineering Mathematics with MATLAB than . Paradoxically, the Hilbert transform of more general a(t) cos[ t+ equals a(t) sin[ t+ (t)], has no such restriction. Problems Verify the orthogonality property of Hilbert transforms using 1. x(t)=1/(1+t4) 2. x(t)=sin(t)/(1+t2) (t)], which Verify the convolution theorem for Hilbert transforms using 4. 5. 6. Use the product theorem to show that if n=0, 1, 2, 3,.... Hint: where Tn( ) is a Chebyshev polynomial of the first kind and m=n/2 or (n 1)/2, depending upon which definition gives an integer. 7. Given cosine and sine integrals: and use the product rule to show that The Hilbert Transform 493 Hint: 8. Prove that Hint: 8.3 ANALYTIC SIGNALS The monochromatic signal A cos( 0 t+ ) appears in many physical and engineering applications. It is common to represent this signal by the complex representation Aei( 0t+ ). These two representations are related to each other by (8.3.1) Furthermore, the Fourier transform of A cos( 0 t+ ) is (8.3.2) while the Fourier transform of is (8.3.3) As (8.3.2) and (8.3.3) clearly show, in passing from the real signal to its complex representation, we double the strength of the positive frequencies and remove entirely the negative frequencies. 494 Advanced Engineering Mathematics with MATLAB Let us generalize these concepts to nonmonochromatic signals. For the real signal x(t) with Fourier transform X( ) and the complex signal z(t) with Fourier transform Z( ), the previous paragraph shows that our generalization must have the property: (8.3.4) or (8.3.5) Taking the inverse of (8.3.4), we have the definition of an analytic signal as (8.3.6) where x(t) is a real signal and is its Hilbert transform. Example 8.3.1 In Figure 8.3.1 the amplitude spectrum of the analytic signal is graphed when x(t) is the rectangular pulse (3.1.9). Note that the amplitude spectrum equals zero for <0 and twice the amplitude spectrum for >0. Figure 8.3.1: The spectrum of the analytic signal when x(t) is the rectangular pulse given by (5.1.9). The Hilbert Transform 495 Example 8.3.2 Let us find the energy of an analytic signal. The energy of an analytic signal is (8.3.7) (8.3.8) by Parseval's theorem. Thus, the analytic signal has twice the energy of the corresponding real signal. Consider the function x(t) whose amplitude spectrum |X( )| is shown in Figure 8.3.2(a). If we were to amplitude modulate x(t) with cos( 0t), then the amplitude spectrum of this modulated signal would appear as pictured in Figure 8.3.2(b). Consider now the signal (8.3.9) (8.3.10) where z(t) is the analytic signal of x(t). We have plotted the amplitude spectrum |Z( )| in Figure 8.3.2(c). If we compute the amplitude spectrum of y(t), we would find that (8.3.11) (8.3.12) 496 Advanced Engineering Mathematics with MATLAB Figure 8.3.2: Given a function x(t) with an amplitude spectrum shown in (a), frame (b) shows the amplitude spectrum of the amplitude modulated signal x(t) cos( 0t) while frames (c) and (d) give the amplitude spectrum of the analytic signal z(t) and x(t) cos( 0t) respectively. We have sketched this amplitude spectrum |Y( )| in Figure 8.3.2(d). Each triangular part is called the single sideband signal because it contains the upper frequencies (| |> 0) of the modulated signal x(t)cos( ( 0 0 t). Similarly, if we had used sin ( sin t) would realize a 0 t), we would have only obtained the lower sidebands. Consequently, a communication 0 system using x(t) cos( t) 0 50% savings in its frequency bandwidth over one transmitting x(t) cos( Problems 1. Find the analytic signal corresponding to 2. Show that the polar form of an analytic signal can be written z(t)=|z(t)|ei where (t) t). , 3. Analytic signals are often used with narrow-band waveforms with carrier frequency . If (t)= 0t+ (t), show that the analytic signal can be written z(t)=r(t)ei 0t, where 0 The Hilbert Transform 497 r(t)=|z(t)|ei (t). The function r(t) is called the complex envelope or the phasor amplitude; this is a generalization of the phasor idea beyond pure alternating currents. 8.4 CAUSALITY: THE KRAMERS-KRONIG RELATIONSHIP Causality is the physical principle which states that an event cannot proceed its cause. In this section we explore what effect this principle has on Hilbert transforms. We begin by introducing the concept of causal functions. A causal function is a function which equals zero for all t<0. As with all functions we can write it in terms of an even xe(t) and an odd xo(t) part as x(t)=xe(t)+xo(t). Because x(t) is causal, xo(t)=sgn(t)xe(t) and x(t)=xe(t)+sgn(t)xe(t). (8.4.1) Taking the Fourier transform of (8.4.1), we find that the Fourier transform of all causal functions are of the form (8.4.2) where (8.4.3) and (8.4.4) because (8.4.5) Equations (8.4.3)(8.4.4) first arose in dielectric theory and, taken together, are called the Kramers10 and Kronig11 relation after their discoverers who derived these relationships during their work on the dispersion of light by gaseous atoms or molecules. 10 11 Kramers, H.A., 1929: Die Dispersion und Absorption von Rntgenstrahlen. Phys. Zeit., 30, 522523. Kronig, R.de L., 1926: On the theory of dispersion of x-rays. J. Opt. Soc. Am., 12, 547551. 498 Advanced Engineering Mathematics with MATLAB Example 8.4.1 Let us verify the Kramers-Kronig relation using the causal time function x(t)=H(t). Because (8.4.6) Consequently, by the Kramers-Kronig relation (8.4.7) This agrees with the result given in Example 5.2.2. Example 8.4.2 A simple example of a causal function is the impulse response or Green's function introduced in earlier chapters. From (8.4.2) we have the result that the transfer function G( ), the Fourier transform of the impulse response, must yield the Hilbert transform pair Ge( ) i e( ). For example, Because (8.4.8) we have the Hilbert transform pair of (8.4.9) Example 8.4.3 Let us verify the Kramers-Kronig relation for the Hilbert transform pair The Hilbert Transform 499 (8.4.10) by direct integration. From (8.4.3), we have that (8.4.11) Applying the residue theorem to the right side of (8.4.11), we obtain (8.4.12) We only include one half of the value of the residue at = because the singularity lies on the path of integration and we must treat this integration along the lines of a Cauchy principal value. Evaluating the residues, we find (8.4.13) (8.4.14) and (8.4.15) Substituting (8.4.13)(8.4.15) into the right side of (8.4.12), we obtain the left side. Problems 1. For a causal function x(t), prove that x0(t)=sgn(t)xe(t) and xe(t)= sgn(t)xo(t). 2. Redo our analysis if x(t) is a negative time function, i.e., x(t)=0 if t>0. Verify your result using x(t)=etH( t). 3. Using g(t)=te tH(t), find the corresponding Hilbert transform pairs. 500 Advanced Engineering Mathematics with MATLAB 4. Using g(t)=e t cos( t)H(t), find the corresponding Hilbert transform pairs. 5. Verify the Kramers-Kronig relation for the Hilbert transform pair and by direct integration. Chapter 9 The Sturm-Liouville Problem In the next three chapters we will be solving partial differential equations using the technique of separation of variables. This technique requires that we expand a piece-wise continuous function f(x) as a linear sum of eigenfunctions, much as we used sines and cosines to re-express f(x) in a Fourier series. The purpose of this chapter is to explain and illustrate these eigenfunction expansions. 9.1 EIGENVALUES AND EIGENFUNCTIONS Repeatedly, in the next three chapters on partial differential equations, we will solve the following second-order linear differential equation: (9.1.1) together with the boundary conditions: (9.1.2) 502 Advanced Engineering Mathematics with MATLAB Figure 9.1.1: By the time that Charles-Franois Sturm (18031855) met Joseph Liouville in the early 1830s, he had already gained fame for his work on the compression of fluids and his celebrated theorem on the number of real roots of a polynomial. An eminent teacher, Sturm spent most of his career teaching at various Parisian colleges. (Portrait courtesy of the Archives de l'Acadmie des sciences, Paris.) In (9.1.1), p(x), q(x), and r(x) are real functions of x; is a parameter; and p(x) and r(x) are functions that are continuous and positive on the interval a x b. Taken together, (9.1.1) and (9.1.2) constitute a regular Sturm-Liouville problem, named after the French mathematicians Sturm and Liouville1 who first studied these equations in the 1830s. In the case when p(x) or r(x) vanishes at one of the endpoints of the interval [a, b] or when the interval is of infinite length, the problem becomes a singular Sturm-Liouville problem. Consider now the solutions to the regular Sturm-Liouville problem. Clearly there is the trivial solution y=0 for all . However, nontrivial solutions exist only if takes on specific values; these values are called characteristic values or eigenvalues. The corresponding nontrivial solutions are 1 For the complete history as well as the relevant papers, see Ltzen, J., 1984: Sturm and Liouville's work on ordinary linear differential equations. The emergence of Sturm Liouville theory. Arch. Hist. Exact Sci, 29, 309376. The Sturm-Liouville Problem 503 called the characteristic functions or eigenfunctions. In particular, we have the following theorems. Theorem: For a regular Sturm-Liouville problem with p(x)>0, all of the eigenvalues are real if p(x), q(x), and r(x) are real functions and the eigenfunctions are differentiable and continuous. Proof: Let y(x)=u(x)+i (x) be an eigenfunction corresponding to an eigenvalue = r+i i, where r , i are real numbers and u(x), (x) are real functions of x. Substituting into the Sturm-Liouville equation yields {p(x)[u (x)+i (x)]} +[q(x)+( r+i i)r(x)][u(x)+i (x)]=0. Separating the real and imaginary parts gives [p(x)u (x)] +[q(x)+ r]u(x) and i (9.1.3) r(x) (x)=0, (9.1.4) [p(x) (x)] +[q(x)+ r] (x)+ ir(x)u(x)=0. If we multiply (9.1.4) by and (9.1.5) by u and subtract the results, we find that (x)[p(x)u (x)] + ir(x)[u2(x)+ 2(x)]=0. (9.1.5) u(x)[p(x) (x)] (9.1.6) The derivative terms in (9.1.6) can be rewritten so that (9.1.6) becomes (9.1.7) Integrating from a to b, we find that (9.1.8) 504 Advanced Engineering Mathematics with MATLAB From the boundary conditions (9.1.2), [u(a)+i (a)]+ [u (a)+i (a)]=0, (9.1.9) and [u(b)+i (b)] + [u (b)+i (b)]=0. (9.1.10) Separating the real and imaginary parts yields u(a)+ u (a)=0, and a (a)+ and u(b)+ u (b)=0, and (b)+ (b)=0. (9.1.12) (a)=0, (9.1.11) Figure 9.1.2: Although educated as an engineer, Joseph Liouville (1809 1882) would devote his life to teaching pure and applied mathematics in the leading Parisian institutions of higher education. Today he is most famous for founding and editing for almost 40 years the Journal de Liouville. (Portrait courtesy of the Archives de l'Acadmie des sciences, Paris.) The Sturm-Liouville Problem 505 Both and cannot be zero; otherwise, there would be no boundary condition at x=a. Similar considerations hold for and . Therefore, u( ) (a) u (a) (a)=0, and u(b) (b) u (b) (b)=0, (9.1.13) if we treat , , , and as unknowns in a system of homogeneous equations (9.1.11)(9.1.12) and require that the corresponding determinants equal zero. Applying (9.1.13) to the right side of (9.1.8), we obtain (9.1.14) Because r(x)>0, the integral is positive and i=0. Since i=0, is purely real. This implies that the eigenvalues are real. If there is only one independent eigenfunction for each eigenvalue, that eigenvalue is simple. When more than one eigenfunction belongs to a single eigenvalue, the problem is degenerate. Theorem: The regular Sturm-Liouville problem has infinitely many real and simple eigenvalues n, n=0, 1, 2,..., which can be arranged in a monotonically increasing sequence 0 < 1< 2<...such that limn n n = . Every eigenfunction yn(x) associated with the corresponding eigenvalue has exactly n zeros in the interval (a, b). For each eigenvalue there exists only one eigenfunction (up to a multiplicative constant). The proof is beyond the scope of this book but may be found in more advanced treatises.2 In the following examples we illustrate how to find these real eigenvalues and their corresponding eigenfunctions. Example 9.1.1 Let us find the eigenvalues and eigenfunctions of y + y=0, (9.1.15) 2 See, for example, Birkhoff, G., and G.-C.Rota, 1989: Ordinary Differential Equations. John Wiley &; Sons, Chapters 10 and 11; Sagan, H., 1961: Boundary and Eigenvalue Problems in Mathematical Physics. John Wiley &; Sons, Chapter 5. 506 Advanced Engineering Mathematics with MATLAB subject to the boundary conditions y(0)=0, and y( ) y ( )=0. (9.1.16) Our first task is to check to see whether the problem is indeed a regular Sturm-Liouville problem. A comparison between (9.1.1) and (9.1.15) shows that they are the same if p(x)=1, q(x)=0, and r(x)=1. Similarly, the boundary conditions (9.1.16) are identical to (9.1.2) if = =1, = 1, =0, =0, and b= . Because the form of the solution to (9.1.15) depends on , we consider three cases: negative, positive, or equal to zero. The general solution3 of the differential equation is y(x)=A cosh(mx)+B sinh(mx), if <0, (9.1.17) y(x)=C+Dx, if =0, (9.1.18) and y(x)=E cos(kx)+F sin(kx), if >0, (9.1.19) 3 In many differential equations courses, the solution to y m2y=0, m>0, is written y(x)=c1emx+c2e mx. However, we can rewrite this solution as y(x)= where cosh(mx)=(emx+e mx)/2 and sinh(mx)=(emx e mx)/2. The advantage of using these hyperbolic functions over exponentials is the simplification that occurs when we substitute the hyperbolic functions into the boundary conditions. The Sturm-Liouville Problem 507 Figure 9.1.3: Graphical solution of tan( x)=x. where for convenience = m2<0 in (9.1.17) and =k2>0 in (9.1.19). Both k and m are real and positive by these definitions. Turning to the condition that y(0)=0, we find that A=C=E=0. The other boundary condition y( ) y( )=0 gives B[sinh(m ) m cosh(m )]=0, (9.1.20) D=0, (9.1.21) and F[sin(k ) k cos(k )]=0. (9.1.22) If we graph sinh(m ) m cosh(m ) for all positive m, this quantity is always negative. Consequently, B=0. However, in (9.1.22), a nontrivial solution (i.e., F 0) occurs if F cos(k )[tan(k ) k]=0, or tan(k )=k. (9.1.23) In summary, we found nontrivial solutions only when n = >0, where kn is the nth root of the transcendental equation (9.1.23). We can find the roots either graphically or through the use of a numerical algorithm. Figure 9.1.3 illustrates the graphical solution to the problem. We exclude the root k=0 because must be greater than zero. 508 Advanced Engineering Mathematics with MATLAB Let us now find the corresponding eigenfunctions. Because A=B= C=D=E=0, we are left with y(x)=F sin(kx). Consequently, the eigenfunction, traditionally written without the arbitrary amplitude constant, is yn(x)=sin(knx), because k must equal kn. Figure 9.1.4 shows the first four eigenfunctions. (9.1.24) Figure 9.1.4: The first four eigenfunctions sin(knx) corresponding to the eigenvalue problem tan(k )=k. Example 9.1.2 For our second example let us solve the Sturm-Liouville problem,4 y + y=0, with the boundary conditions y(0) y (0)=0, and y( ) y ( )=0. (9.1.26) (9.1.25) 4 Sosov and Theodosiou [Sosov, Y., and C.E.Theodosiou, 2002: On the complete solution of the Sturm-Liouville problem (d2X/dx2)+ 2X=0 over a closed interval. J. Math. Phys., 43, 28312843] have analyzed this problem with the general boundary conditions (9.1.2). The Sturm-Liouville Problem 509 Once again the three possible solutions to (9.1.25) are y(x)=A cosh(mx)+B sinh(mx), if = m2<0, (9.1.27) y(x)=C+Dx, if =0, (9.1.28) and y(x)=E cos(kx)+F sin(kx), if =k2>0. (9.1.29) Let us first check and see if there are any nontrivial solutions for < 0. Two simultaneous equations result from the substitution of (9.1.27) into (9.1.26): A mB=0, (9.1.30) and [cosh(m ) m sinh(m )]A+[sinh(m ) m cosh(m )]B=0. The elimination of A between the two equations yields sinh(m )(1 m2)B=0. (9.1.32) (9.1.31) If (9.1.27) is a nontrivial solution, then B 0, and sinh(m )=0, (9.1.33) 510 Advanced Engineering Mathematics with MATLAB or m2=1. (9.1.34) Equation (9.1.33) cannot hold because it implies m= =0 which contradicts the assumption used in deriving (9.1.27) that <0. On the other hand, (9.1.34) is quite acceptable. It corresponds to the eigenvalue = 1 and the eigenfunction is y0=cosh(x)+sinh(x)=ex, (9.1.35) because it satisfies the differential equation y0 y0=0, (9.1.36) and the boundary conditions y0(0) y 0(0)=0, and (9.1.37) y0( ) y 0( )=0. (9.1.38) An alternative method of finding m, which is quite popular because of its use in more difficult problems, follows from viewing (9.1.30) and (9.1.31) as a system of homogeneous linear equations, where A and B are the unknowns. It is well known5 that for (9.1.30)(9.1.31) to have a nontrivial solution (i.e., A 0 and/or B 0) the determinant of the coefficients must vanish: (9.1.39) Expanding the determinant, 5 See Chapter 14. The Sturm-Liouville Problem 511 sinh(m )(1 m2)=0, (9.1.40) which leads directly to (9.1.33) and (9.1.34). We consider next the case of =0. Substituting (9.1.28) into (9.1.26), we find that C D=0, and C+D D=0. (9.1.42) (9.1.41) This set of simultaneous equations yields C=D=0 and we have only trivial solutions for =0. Finally, we examine the case when >0. Substituting (9.1.29) into (9.1.26), we obtain E kF=0, (9.1.43) and [cos(k )+k sin(k )]E+[sin(k ) k cos(k )]F=0. (9.1.44) The elimination of E from (9.1.43) and (9.1.44) gives F(1+k2) sin(k )=0. (9.1.45) If (9.1.29) is nontrivial, F 0, and k2= 1, (9.1.46) 512 Advanced Engineering Mathematics with MATLAB or sin(k )=0. (9.1.47) Condition (9.1.46) violates the assumption that k is real, which follows from the fact that =k2>0. On the other hand, we can satisfy (9.1.47) if k=1, 2, 3,...; a negative k yields the same . Consequently we have the additional eigenvalues n=n2. Let us now find the corresponding eigenfunctions. Because E=kF, y(x)=F sin(kx)+Fk cos(kx) from (9.1.29). Thus, the eigenfunctions for >0 are yn(x)=sin(nx)+n cos(nx). Figure 9.1.5 illustrates some of the eigenfunctions given by (9.1.35) and (9.1.48). Example 9.1.3 (9.1.48) Consider now the Sturm-Liouville problem y + y = 0, (9.1.49) with y( )=y( ), and y ( )=y ( ). (9.1.50) The Sturm-Liouville Problem 513 Figure 9.1.5: The first four eigenfunctions for the Sturm-Liouville problem (9.1.25) (9.1.26). This is not a regular Sturm-Liouville problem because the boundary conditions are periodic and do not conform to the canonical boundary condition (9.1.2). The general solution to (9.1.49) is y(x)=A cosh(mx)+B sinh(mx), if = m2<0, (9.1.51) y(x)=C+Dx, if =0, (9.1.52) and y(x)=E cos(kx)+F sin(kx), if =k2>0. (9.1.53) Substituting these solutions into the boundary condition (9.1.50), A cosh(m )+B sinh(m )=A cosh( m )+B sinh( m ), (9.1.54) 514 Advanced Engineering Mathematics with MATLAB C+D =C D , and (9.1.55) E cos(k )+F sin(k )=E cos( k )+F sin( k ), or (9.1.56) B sinh(m )=0, D 0, and F sin(k )=0, (9.1.57) because cosh( m )=cosh(m ), sinh( mr)= sinh(m ), cos( k )= cos(k ), and sin( k )= sin(k ). Because m must be positive, sinh(m ) cannot equal zero and B=0. On the other hand, if sin(k )=0 or k=n, n=1, 2, 3,..., we have a nontrivial solution for positive and n=n2. Note that we still have A, C, E, and F as free constants. From the boundary condition (9.1.50), A sinh(m )=A sinh( m ), (9.1.58) and E sin(k )+F cos(k )= E sin( k )+F cos( k ). (9.1.59) The solution y0(x)=C identically satisfies the boundary condition (9.1.50) for all C. Because m and sinh(m ) must be positive, A=0. From (9.1.57), we once again have sin(k )=0, and k=n. Consequently, the eigenfunction solutions to (9.1.49) (9.1.50) are (9.1.60) 0 =0, y0(x)=1, The Sturm-Liouville Problem 515 and (9.1.61) and we have a degenerate set of eigenfunctions to the Sturm-Liouville problem (9.1.49) with the periodic boundary condition (9.1.50). Problems Find the eigenvalues and eigenfunctions for each of the following: 1. y + y=0, y (0)=0, y(L)=0 2. y + y=0, y (0)=0, y ( )=0 3. y + y=0, y(0)+y (0)=0, y( )+y ( )=0 4. y + y=0, y (0)=0, y( ) y ( )=0 5. y(i )+ y=0, y(0)=y"(0)=0, y(L)=y (L)=0 Find an equation from which you could find each of the following: 6. y + y=0, y(0)+y (0)=0, y(1)=0 7. y + y=0, y(0)=0, y( )+y ( )=0 8. y + y=0, y (0)=0, y(1) y (1)=0 9. y + y=0, y(0)+y (0)=0, y ( )=0 10. y + y=0, y(0)+y (0)=0, y( ) y ( )=0 11. Find the eigenvalues and eigenfunctions of the Sturm-Liouville problem and give the form of the eigenfunction for for each of the following boundary conditions: (a) u(1)=u(e)=0, (b) u(1)=u (e)=0, and (c) u (1)=u (e)=0. Find the eigenvalues and eigenfunctions of the following Sturm-Liouville problems: 12. x2y +2xy + y=0, y(1)=y(e)=0, 1 x e 13. 14. 15. y 4 y=0, y (0)=y (0)=y (1)=y (1)=0, 0<x<1 9.2 ORTHOGONALITY OF EIGENFUNCTIONS In the previous section we saw how nontrivial solutions to the regular Sturm-Liouville problem consist of eigenvalues and eigenfunctions. The most important property of eigenfunctions is orthogonality. 516 Advanced Engineering Mathematics with MATLAB Theorem: Let the functions p(x), q(x), and r(x) of the regular SturmLiou ille problem (9.1.1)(9.1.2) be real and continuous on the interval [a, b]. If yn(x) and ym (x) are continuously differentiable eigenfunctions corresponding to the distinct eigenvalues and m n , respectively, then yn (x) and ym (x) satisfy the orthogonality condition: (9.2.1) if n m . When (9.2.1) is satisfied , the eigenfunctions yn(x) and ym(x) are said to be orthogonal to each other with respect to the weight function r(x). The term orthogonality appears to be borrowed from linear algebra where a similar relationship holds between two perpendicular or orthogonal vectors. Proof: Let yn(x) and ym(x) denote the eigenfunctions associated with two different eigenvalues n and m . Then (9.2.2) (9.2.3) and both solutions satisfy the boundary conditions. Let us multiply the first differential equation by ym; the second by yn. Next, we subtract these two equations and move the terms containing ynym to the right side. The resulting equation is (9.2.4) Integrating (9.2.4) from a to b yields (9.2.5) The Sturm-Liouville Problem 517 We can simplify the left side of (9.2.5) by integrating by parts to give (9.2.6) The second integral equals zero since the integrand vanishes identically. Because yn(x) and ym(x) satisfy the boundary condition at x=a, (9.2.7) and (9.2.8) These two equations are simultaneous equations in the equations must be zero: and . Hence, the determinant of (9.2.9) Similarly, at the other end, (9.2.10) Consequently, the right side of (9.2.6) vanishes and (9.2.5) reduces to (9.2.1). Example 9.2.1 Let us verify the orthogonality condition for the eigenfunctions that we found in Example 9.1.1. Because r(x)=1, a=0, b= , and yn(x) sin(knx), we find that (9.2.11) 518 Advanced Engineering Mathematics with MATLAB (9.2.12) (9.2.13) (9.2.14) (9.2.15) (9.2.16) (9.2.17) We used the relationships kn=tan(kn ), and km=tan(km ) to simplify (9.2.15). Note, however, that if n=m, (9.2.18) (9.2.19) (9.2.20) The Sturm-Liouville Problem 519 because sin(2A)=2sin(A)cos(A), and kn=tan(kn ). That is, any eigenfunction cannot be orthogonal to itself. In closing, we note that had we defined the eigenfunction in our example as (9.2.21) rather than yn(x)=sin(knx), the orthogonality condition would read (9.2.22) This process of normalizing an eigenfunction so that the orthogonality condition becomes (9.2.23) generates orthonormal eigenfunctions. We will see the convenience of doing this in the next section. Problems 1. The Sturm-Liouville problem y + y=0, y(0)=y(L)=0, has the eigenfunction solution yn(x)=sin(n x/L). By direct integration verify the orthogonality condition (9.2.1). 2. The Sturm-Liouville problem y + y=0, y (0)=y (L)=0, has the eigenfunction solutions y0(x)=1 and yn(x)=cos(n x/L). By direct integration verify the orthogonality condition (9.2.1). 3. The Sturm-Liouville problem y + y=0, y(0)=y (L)=0, has the eigenfunction solution yn(x)=sin[(2n 1) x/(2L)]. By direct integration verify the orthogonality condition (9.2.1). 4. The Sturm-Liouville problem y + y=0, y (0)=y(L)=0, has the eigenfunction solution yn(x)=cos[(2n 1) x/(2L)]. By direct integration verify the orthogonality condition (9.2.1) . 9.3 EXPANSION IN SERIES OF EIGENFUNCTIONS In calculus we learned that under certain conditions we could represent a function f(x) by a linear and infinite sum of polynomials (x x0)n. In this section we show that an analogous procedure exists for representing a piece-wise continuous function by a linear sum of eigenfunctions. These eigenfunction expansions will be used in the next three chapters to solve partial differential equations. 520 Advanced Engineering Mathematics with MATLAB Let the function f(x) be defined in the interval a<x<b. We wish to re-express f(x) in terms of the eigenfunctions yn(x) given by a regular SturmLiouville problem. Assuming that the function f(x) can be represented by a uniformly convergent series,6 we write (9.3.1) The orthogonality relation (9.2.1) gives us the method for computing the coefficients cn. First we multiply both sides of (9.3.1) by r(x)ym(x), where m is a fixed integer, and then integrate from a to b. Because this series is uniformly convergent and yn(x) is continuous, we can integrate the series term by term or (9.3.2) The orthogonality relationship states that all of the terms on the right side of (9.3.2) must disappear except the one for which n=m. Thus, we are left with (9.3.3) or (9.3.4) if we replace m by n in (9.3.3). Usually, both integrals in (9.3.4) are evaluated by direct integration. In the case when the evaluation of the denominator is very difficult, Lockshin7 has shown that the denominator of (9.3.4) always equals 6 uk(x), S(x)=limn S n(x), and 0<|Sn(x) S(x)|< for all n>M>0, the series uk(x) is uniformly convergent if M is dependent on alone and not x. Lockshin, J.L, 2001: Explicit closed-form expression for eigenfunction norms. Appl. Math. Lett., 14, 553555. If Sn(x)= 7 The Sturm-Liouville Problem 521 (9.3.5) for a regular Sturm-Liouville problem with eigenfunction solution y where p(x), q(x), and r(x) are continuously differentiable on the interval [a, b]. The series (9.3.1) with the coefficients found by (9.3.4) is a generalized Fourier series of the function f(x) with respect to the eigenfunction yn(x). It is called a generalized Fourier series because we generalized the procedure of re-expressing a function f(x) by sines and cosines into one involving solutions to regular Sturm-Liouville problems. Note that if we had used an orthonormal set of eigenfunctions, then the denominator of (9.3.4) would equal one and we reduce our work by half. The coefficients cn are the Fourier coefficients. One of the most remarkable facts about generalized Fourier series is their applicability even when the function has a finite number of bounded discontinuities in the range [a, b]. We may formally express this fact by the following theorem: Theorem: If both f(x) and f (x) are piece-wise continuous in a x b, then f(x) can be expanded in a uniformly convergent Fourier series (9.3.1), whose coefficients cn are given by (9.3.4). It converges to [f(x+)+f(x )]/2 at any point x in the open interval a<x<b. The proof is beyond the scope of this book but can be found in more advanced treatises.8 If we are willing to include stronger constraints, we can make even stronger statements about convergence. For example,9 if we require that f(x) be a continuous function with a piece-wise continuous first derivative, then the eigenfunction expansion (9.3.1) converges to f(x) uniformly and absolutely in [a, b] if f(x) satisfies the same boundary conditions as does yn(x). In the case when f(x) is discontinuous, we are not merely rewriting f(x) in a new form. We are actually choosing the coefficients cn so that the eigenfunction expansion fits f(x) in the "least squares" sense that (9.3.6) Consequently we should expect peculiar things, such as spurious oscillations, to occur in the neighborhood of the discontinuity. These are Gibbs phenomena,10 the same phenomena discovered with Fourier series. See 4.2. 8 9 10 For example, Titchmarsh, E.C., 1962: Eigenfunction Expansions Associated with Second-Order Differential Equations. Part 1. Oxford University Press, pp. 1216. Tolstov, G.P., 1962: Fourier Series. Dover Publishers, p. 255. Apparently first discussed by Weyl, H., 1910: Die Gibbs'sche Erscheinung in der Theorie der Sturm-Liouvilleschen Reihen. Rend. Circ. Mat. Palermo, 29, 321323. 522 Advanced Engineering Mathematics with MATLAB Example 9.3.1 To illustrate the concept of an eigenfunction expansion, let us find the expansion for f(x)=x over the interval 0<x< using the solution to the regular Sturm-Liouville problem of y + y=0, y(0) y( )=0. (9.3.7) This problem arises when we solve the wave or heat equation by separation of variables in the next two chapters. Because the eigenfunctions are yn(x)=sin(nx), n=1, 2, 3,..., r(x)=1, a=0, and b= , (9.3.4) yields (9.3.8) (9.3.9) Equation (9.3.1) then gives (9.3.10) This particular example is in fact an example of a half-range sine expansion. Finally we must state the values of x for which (9.3.10) is valid. At x= the series converges to zero while f( )= . At x=0 both the series and the function converge to zero. Hence the series expansion (9.3.10) is valid for 0 x< . The Sturm-Liouville Problem 523 Example 9.3.2 For our second example let us find the expansion for f(x)=x over the interval 0<x< using the solution to the regular Sturm-Liouville problem of y + y=0, y(0)=y( ) y ( )=0. (9.3.11) We will encounter this problem when we solve the heat equation with radiative boundary conditions by separation of variables. Because r(x)=1, a=0, b= kn=tan(kn ), (9.3.4) yields (9.3.12) and the eigenfunctions are yn(x)= sin(knx), where (9.3.13) (9.3.14) (9.3.15) where we used the property that sin(kn )=kncos(kn ). Equation (9.3.1) then gives (9.3.16) To illustrate the use of (9.3.5), we note that (9.3.17) 524 Advanced Engineering Mathematics with MATLAB and (9.3.18) Therefore, (9.3.19) (9.3.20) (9.3.21) Note that we set after taking the derivatives with respect to . Problems 1. The Sturm-Liouville problem y + y=0, y(0)=y(L)=0, has the eigenfunction solution yn(x)=sin(n x/L). Find the eigenfunction expansion for f(x)=x using this eigenfunction. 2. The Sturm-Liouville problem y + y=0, y (0)=y (L)=0, has the eigenfunction solutions y0(x)=1, and yn(x)=cos(n x/L). Find the eigenfunction expansion for f(x)=x using these eigenfunctions. 3. The Sturm-Liouville problem y + y=0, y(0)=y (L)=0, has the eigenfunction solution yn(x)=sin[(2n 1) x(2L)]. Find the eigenfunction expansion for f(x)=x using this eigenfunction. 4. The Sturm-Liouville problem y + y=0, y (0)=y(L)=0, has the eigenfunction solution yn(x)=cos[(2n 1) x/(2L)]. Find the eigenfunction expansion for f(x)=x using this eigenfunction. 5. Consider the eigenvalue problem y +( with the boundary conditions y (0)+ay(0)=0 and y (1)+ y(1)=0. Step 1: Show that this is a regular Sturm-Liouville problem. Step 2: Show that the eigenvalues and eigenfunctions are a2)y=0, 0<x<1, The Sturm-Liouville Problem 525 0 n =0, =a2+n2 2, y0(x)=e ax, yn(x)=a sin(n x) n cos(n x), where n=1, 2, 3,.... Step 3: Given a function f(x), show that we can expand it as follows: where and 6. Consider the eigenvalue problem y + y =0, 0<x<1, with the boundary conditions y(0)=y (0)=y(1)=y (1)=0. Prove the following points: Step 1: Show that the eigenfunctions are where kn denotes the nth root of 2 2cos(k) k sin(k)=sin(k/2)[sin(k/2) (k/2) cos(k/2)]=0. Step 2: Show that there are two classes of eigenfunctions: Kn=2n , yn(x)=1 cos(2n x), 526 Advanced Engineering Mathematics with MATLAB and Step 3: Show that the orthogonality condition for this problem is where yn(x) and ym(x) are two distinct eigenfunction solutions of this problem. Hint: Follow the proof in 9.2 and integrate repeatedly by parts to eliminate higher derivative terms. Step 4: Show that we can construct an eigenfunction expansion for an arbitrary function f(x) via provided What are the condition(s) on f(x)? 9.4 A SINGULAR STURM-LIOUVILLE PROBLEM: LEGENDRE'S EQUATION In the previous sections we used solutions to a regular Sturm-Liouville problem in the eigenfunction expansion of the function f(x). The fundamental reason why we could form such an expansion was the orthogonality condition (9.2.1). This crucial property allowed us to solve for the Fourier coefficient cn given by (9.3.4). In the next few chapters, when we solve partial differential equations in cylindrical and spherical coordinates, we will find that f(x) must be expanded in terms of eigenfunctions from singular Sturm-Liouville problems. Is this permissible? How do we compute the Fourier coefficients in this case? The final two sections of this chapter deal with these questions by examining the two most frequently encountered singular Sturm-Liouville problems, those involving Legendre's and Bessel's equations. We begin by determining the orthogonality condition for singular Sturm-Liouville problems. Returning to the beginning portions of 9.2, we combine (9.2.5) and (9.2.6) to obtain The Sturm-Liouville Problem 527 (9.4.1) Figure 9.4.1: Born into an affluent family, Adrien-Marie Legendre's (17521833) modest family fortune was sufficient to allow him to devote his life to research in celestial mechanics, number theory, and the theory of elliptic functions. In July 1784 he read before the Acadmie des sciences his Recherches sur la figure des plantes. It is in this paper that Legendre polynomials first appeared. (Portrait courtesy of the Archives de l'Acadmie des sciences, Paris.) From (9.4.1) the right side vanishes and we preserve orthogonality if yn(x) is finite and p(x)y n(x) tends to zero at both endpoints. This is not the only choice but let us see where it leads. Consider now Legendre's equation: (9.4.2) 528 Advanced Engineering Mathematics with MATLAB or (9.4.3) where we set a= 1, b 1, =n(n+1), p(x)=1 x2, q(x)=0, and r(x)=1. This equation arises in the solution of partial differential equations involving spherical geometry. Because p( 1)=p(1)=0, we are faced with a singular Sturm-Liouville problem. Before we can determine if any of its solutions can be used in an eigenfunction expansion, we must find them. Equation (9.4.2) does not have a simple general solution. [If n=0, then y(x)=1 is a solution.] Consequently we try to solve it with the power series: (9.4.4) (9.4.5) and (9.4.6) Substituting into (9.4.2), (9.4.7) which equals (9.4.8) If we define k=m+2 in the first summation, then (9.4.9) The Sturm-Liouville Problem 529 Because (9.4.9) must be true for any x, each power of x must vanish separately. It then follows that (k+2)(k+1)Ak+2=[k(k+1) n(n+1)]Ak, or (9.4.10) (9.4.11) where k=0, 1, 2,.... Note that we still have the two arbitrary constants A0 and A1 that are necessary for the general solution of (9.4.2). The first few terms of the solution associated with A0 are (9.4.12) while the first few terms associated with the A1 coefficient are (9.4.13) If n is an even positive integer (including n=0), then the series (9.4.12) terminates with the term involving xn: the solution is a polynomial of degree n. Similarly, if n is an odd integer, the series (9.4.13) terminates with the term involving xn. Otherwise, for n noninteger the expressions are infinite series. For reasons that will become apparent, we restrict ourselves to positive integers n. Actually, this includes all possible integers because the negative integer n 1 has the same Legendre's equation and solution as the positive integer n. These polynomials are Legendre polynomials11 and we may compute them by the power series: (9.4.14) 11 Legendre, A.M., 1785: Sur l'attraction des sphrodes homognes. Mm. math. phys. prsents l'Acad. sci. pars divers sa ants, 10, 411434. The best reference on Legendre polynomials is Hobson, E.W., 1965: The Theory of Spherical and Ellipsoidal Harmonics. Chelsea Publishing Co., 500 pp. 530 Advanced Engineering Mathematics with MATLAB where m=n/2, or m=(n 1)/2, depending upon which is an integer. We chose to use (9.4.14) over (9.4.12) or (9.4.13) because (9.4.14) has the advantage that Pn(1)=1. Table 9.4.1 gives the first ten Legendre polynomials. The other solution, the infinite series, is the Legendre function of the second kind, Qn(x). Figure 9.4.2 illustrates the first four Legendre polynomials Pn(x) while Figure 9.4.3 gives the first four Legendre functions of the second kind Qn(x). From this figure we see that Qn(x) becomes infinite at the points x=1. As shown earlier, this is important because we are only interested in solutions to Legendre's equation that are finite over the interval [ 1, 1]. On the other hand, in problems where we exclude the points x=1, Legendre functions of the second kind will appear in the general solution.12 In the case that n is not an integer, we can construct a solution13 that remains finite at x=1 but not at x= 1. Furthermore, we can construct a solution which is finite at x= 1 but not at x=1. Because our solutions Table 9.4.1: The First Ten Legendre Polynomials P0(x)=1 P1(x)=x 12 13 See Smythe, W.R., 1950: Static and Dynamic Electricity. McGraw-Hill, 5.215 for an example. See Carrier, G.F., M.Krook, and C.E.Pearson, 1966: Functions of the Complex Variable: Theory and Technique. McGraw-Hill, pp. 212213. The Sturm-Liouville Problem 531 must be finite at both endpoints so that we can use them in an eigenfunction expansion, we must reject these solutions from further consideration and are left only with Legendre polynomials. From now on, we will only consider the properties and uses of these polynomials. Although we have the series (9.4.14) to compute Pn(x), there are several alternative methods. We obtain the first method, known as Rodrigues' formula,14 by writing (9.4.14) in the form (9.4.15) (9.4.16) The last summation is the binomial expansion of (x2 1)n so that (9.4.17) 14 Rodrigues, O., 1816: Mmoire sur l'attraction des sphrodes. Correspond. l'Ecole Polytech., 3, 361385. 532 Advanced Engineering Mathematics with MATLAB Figure 9.4.2: The first four Legendre functions of the first kind. Another method for computing Pn(x) involves the use of recurrence formulas. The first step in finding these formulas is to establish the fact that (1+h2 2xh) 1/2 =P0(x)+hP1(x)+h2P2(x)+.... (9.4.18) The function (1+h2 2xh) 1/2 is the generating function for Pn(x). We obtain the expansion via the formal binomial expansion (9.4.19) Upon expanding the terms contained in 2x h2 and grouping like powers of h, (9.4.20) A direct comparison between the coefficients of each power of h and the Legendre polynomial Pn(x) completes the demonstration. Note that these results hold only if |x| and |h|<1. Next we define W(x, h)=(1+h2 xh) first-order partial differential equation 1/2 . A quick check shows that W(x, h) satisfies the The Sturm-Liouville Problem 533 (9.4.21) The substitution of (9.4.18) into (9.4.21) yields (9.4.22) Setting the coefficients of hn equal to zero, we find that (n+1)Pn+1(x) 2nxPn(x)+(n 1)Pn 1(x)+Pn 1(x) xPn(x)=0, (9.4.23) Figure 9.4.3: The first four Legendre functions of the second kind. or (9.4.24) with n=1, 2, 3,.... Similarly, the first-order partial differential equation (9.4.25) 534 Advanced Engineering Mathematics with MATLAB leads to (9.4.26) which implies (9.4.27) Differentiating (9.4.24), we first eliminate and then from the resulting equations and (9.4.27). This gives two further recurrence relationships: (9.4.28) and (9.4.29) Adding (9.4.28) and (9.4.29), we obtain the more symmetric formula (9.4.30) Given any two of the polynomials Pn+1(x), Pn(x), and Pn 1(x), (9.4.24) or (9.4.30) yields the third. Having determined several methods for finding the Legendre polynomial Pn(x), we now turn to the actual orthogonality condition.15 Consider the integral (9.4.31) 15 From Symons, B., 1982: Legendre polynomials and their orthogonality. Math. Gaz., 66, 152154 with permission. The Sturm-Liouville Problem 535 (9.4.32) (9.4.33) On the other hand, if a=(1+h2)/2h, and b=(1+t2)/2t, the integral J is (9.4.34) (9.4.35) (9.4.36) But a+1=(1+h2+2h)/2h=(1+h)2/2h, and a 1=(1 h)2/2h. After a little algebra, (9.4.37) (9.4.38) As we noted earlier, the coefficients of hntm in this series is match the powers of h t , the orthogonality condition is nm Pn(x)Pm(x) dx. If we 536 Advanced Engineering Mathematics with MATLAB (9.4.39) With the orthogonality condition (9.4.39) we are ready to show that we can represent a function f(x), which is piece-wise differentiable in the interval ( 1, 1), by the series: (9.4.40) To find Am we multiply both sides of (9.4.40) by Pn(x) and integrate from 1 to 1: (9.4.41) All of the terms on the right side vanish except for n=m because of the orthogonality condition (9.4.39). Consequently, the coefficient An is (9.4.42) or (9.4.43) In the special case when f(x) and its first n derivatives are continuous throughout the interval ( 1, 1), we may use Rodrigues' formula to evaluate (9.4.44) The Sturm-Liouville Problem 537 (9.4.45) by integrating by parts n times. Consequently, (9.4.46) A particularly useful result follows from (9.4.46) if f(x) is a polynomial of degree k. Because all derivatives of f(x) of order n vanish identically when n>k, An=0 if n>k. Consequently, any polynomial of degree k can be expressed as a linear combination of the first k+1 Legendre polynomials [P0(x),..., Pk(x)]. Another way of viewing this result is to recognize that any polynomial of degree k is an expansion in powers of x. When we expand in Legendre polynomials we are merely regrouping these powers of x into new groups that can be identified as P0(x), P1(x), P2(x),..., Pk(x). Example 9.4.1 Let us use Rodrigues' formula to compute P2(x). From (9.4.17) with n=2, (9.4.47) Example 9.4.2 Let us compute P3(x) from a recurrence relation. From (9.4.24) with n=2, 3P3(x) 5xP2(x)+2P1(x)=0. (9.4.48) But P2(x)=(3x2 1)/2, and P1(x)=x, so that (9.4.49) 538 Advanced Engineering Mathematics with MATLAB or P3(x)=(5x33x)/2. (9.4.50) Example 9.4.3 We want to show that (9.4.51) From (9.4.30), (9.4.52) =Pn+1(x) Pn 1(x)|11 =Pn+1(1) Pn 1(1) Pn+1( 1)+Pn 1( 1)=0, because Pn(1)=1 and Pn( 1)=( 1)n. Example 9.4.4 (9.4.53) (9.4.54) Let us express f(x)=x2 in terms of Legendre polynomials. The results from (9.4.46) mean that we need only worry about P0(x), P1(x), and P2(x): x2=A0P0(x)+A1P1(x)+A2P2(x). (9.4.55) Substituting for the Legendre polynomials, (9.4.56) The Sturm-Liouville Problem 539 and (9.4.57) Example 9.4.5 Let us find the expansion in Legendre polynomials of the function: (9.4.58) We could have done this expansion as a Fourier series but in the solution of partial differential equations on a sphere we must make the expansion in Legendre polynomials. In this problem, we find that (9.4.59) Therefore, (9.4.60) (9.4.61) so that (9.4.62) Figure 9.4.4 illustrates the expansion (9.4.62) where we used only the first four terms. It was created using the MATLAB script clear; x = [-1:0.01:1]; % create x points in plot f = zeros(size(x)); % initialize function f(x) for k = 1 : length(x) % construct function f(x) if x(k)<0; f(k)=0; else f(k)=1; end; end % initialize Fourier-Legendre series with zeros 540 Advanced Engineering Mathematics with MATLAB flegendre = zeros (size(x)); % read in Fourier coefficients a(1) = 1/2; a(2) = 3/4; a(3) = 0; a(4)= -7/16; a(5) = 0; a(6) = 11/32; c1f % clear any figures for n = 1:6 % compute Legendre polynomial N = n-1; P = legendre (N,x); % compute Fourier-Legendre series flegendre = flegendre + a(n)*P(1,:); % create plot of truncated Fourier-Legendre series % with n terms if n==1 subplot (2,2,1), plot (x, flegendre, x,f,'--'); legend('one term','f(x)'); legend boxoff; end if n==2 subplot (2,2,2), plot(x,flegendre,x,f,'--'); legend('two terms','f(x)'); legend boxoff; end if n==4 subplot (2,2,3), plot(x,flegendre,x,f,'--'); legend('four terms','f(x)'); legend boxoff ; xlabel('x','Fontsize',20); end if n==6 subplot (2,2,4), plot(x, flegendre,x,f,'--'); legend('six terms','f(x)'); legend boxoff; xlabel('x','Fontsize',20);end axis ([-1 1-0.5 1.5]) end As we add each additional term in the orthogonal expansion, the expansion fits f(x) better in the "least squares" sense of (9.3.5). The spurious oscillations arise from trying to represent a discontinuous function by four continuous, oscillatory functions. Even if we add additional terms, the spurious oscillations persist, although located nearer to the discontinuity. This is another example of Gibbs phenomena.16 See 4.2. 16 Weyl, H., 1910: Die Gibbs'sche Erscheinung in der Theorie der Kugelfunktionen. Rend. Circ. Mat. Palermo, 29, 308321. The Sturm-Liouville Problem 541 Figure 9.4.4: Representation of the function f(x)=1 for 0<x<1 and 0 for 1<x<0 by various partial summations of its Legendre polynomial expansion. The dashed lines denote the exact function. Example 9.4.6: Iterative solution of the radiative transfer equation One of the fundamental equations of astrophysics is the integro-differential equation that describes radiative transfer (the propagation of energy by radiative, rather than conductive or convective, processes) in a gas. Consider a gas that varies in only one spatial direction and that we divide into infinitesimally thin slabs. As radiation enters a slab, it is absorbed and scattered. If we assume that all of the radiation undergoes isotropic scattering, the radiative transfer equation is (9.4.63) where I is the intensity of the radiation, is the optical depth (a measure of the absorbing power of the gas and related to the distance that you travel within the gas), =cos( ), and is the angle at which radiation enters the slab. In this example, we show how the Fourier-Legendre expansion17 (9.4.64) may be used to solve (9.4.63). Here In( ) is the Fourier coefficient in the FourierLegendre expansion involving the Legendre polynomial Pn( ). 17 Chandrasekhar, S., 1944: On the radiative equilibrium of a stellar atmosphere. Astrophys. J., 99, 180190. Published by University of Chicago Press, 1944. 542 Advanced Engineering Mathematics with MATLAB We begin by substituting (9.4.64) into (9.4.63), (9.4.65) where we used (9.4.24) to eliminate Pn( ). Note that only the I0( ) term remains after integrating because of the orthogonality condition: (9.4.66) if n>0. Equating the coefficients of the various Legendre polynomials, (9.4.67) for n=1, 2,...and (9.4.68) Thus, the solution for I1 is I1=constant =3F/4, where F is the net integrated flux and an observable quantity. For n=1, (9.4.69) Therefore, (9.4.70) The Sturm-Liouville Problem 543 The next differential equation arises from n=2 and equals (9.4.71) Because I1 is a constant and we only retain I0, I1, and I2 in the simplest approximation, we neglect dI3/d and I2=0. Thus, the simplest approximate solution is (9.4.72) To complete our approximate solution, we must evaluate A. If we are dealing with a stellar atmosphere where we assume no external radiation incident on the star, I(0, )=0 for 1< <0. Therefore, (9.4.73) Taking the limit 0 and using the boundary condition, (9.4.74) Thus, we must satisfy, in principle, an infinite set of equations. For example, for n=0, 1, and 2, (9.4.75) (9.4.76) and (9.4.77) 544 Advanced Engineering Mathematics with MATLAB Using I1(0)=3F/4, (9.4.78) (9.4.79) and (9.4.80) Of the two possible Equations (9.4.78)(9.4.79), Chandrasekhar chose (9.4.79) from physical considerations. Thus, to first approximation, the solution is (9.4.81) Better approximations can be obtained by including more terms; the interested reader is referred to the original article. In the early 1950s, Wang and Guth18 improved the procedure for finding the successive approximations and formulating the approximate boundary conditions. Problems Find the first three nonvanishing coefficients in the Legendre polynomial expansion for the following functions: 1. 2. 3. f(x)=|x|, |x|<1 4. f(x) x3, |x|<1 5. 6. 18 Wang, M.C., and E.Guth, 1951: On the theory of multiple scattering, particularly of charged particles. Phys. Re ., Ser. 2, 84, 10921111. The Sturm-Liouville Problem 545 Then use MATLAB to illustrate various partial sums of the Fourier-Legendre series. 7. Use Rodrigues' formula to show that 8. Given formula for Pn+1(x) to find P6(x). 9. Show that (a) Pn(1)=1, (b) Pn( 1)=(1)n, (c) P2n+1(0)=0, and (d) P2n(0)= ( 1)n(2n)!/(22nn!n!). 10. Prove that and P4(x) from Problem 7, use the recurrence 11. Given19 show that the following generalized Fourier series hold: if we use the eigenfunction Heaviside's step function, and and H( ) is if we use the eigenfunction and H( ) is Heaviside's step function. 12. The series given in Problem 11 are also expansions in Legendre polynomials. In that light, show that 19 Hobson, E.W., 1965: The Theory of Spherical and Ellipsoidal Harmonics. Chelsea Publishing Co., pp. 2627. 546 Advanced Engineering Mathematics with MATLAB and where 0<t< . 13. (a) Use the generating function (9.4.18) to show that (b) Use the results from part (a) to show that Hint: 14. The generating function (9.4.18) actually holds20 for |h| 1 if |x|<1. Using this relationship, show that and Use these relationships to show that 20 Ibid., p. 28. The Sturm-Liouville Problem 547 if |x|<1. Figure 9.5.1: It was Friedrich William Bessel's (17841846) apprenticeship to the famous mercantile firm of Kulenkamp that ignited his interest in mathematics and astronomy. As the founder of the German school of practical astronomy, Bessel discovered his functions while studying the problem of planetary motion. Bessel functions arose as coefficients in one of the series that described the gravitational interaction between the sun and two other planets in elliptic orbit. (Portrait courtesy of Photo AKG, London.) 9.5 ANOTHER SINGULAR STURM-LIOUVILLE PROBLEM: BESSEL'S EQUATION In the previous section we discussed the solutions to Legendre's equation, especially with regard to their use in orthogonal expansions. In the section we consider another classic equation, Bessel's equation21 x2y +xy +( 2x2 n2)y=0, (9.5.1) 21 Bessel, F.W., 1824: Untersuchung des Teils der planetarischen Strungen, welcher aus der Bewegung der Sonne entsteht. Abh. d. K. Akad. Wiss. Berlin, 152. See Dutka, J., 1995: On the early history of Bessel functions. Arch. Hist. Exact Sci., 49, 105134. The classic reference on Bessel functions is Watson, G.N., 1966: A Treatise on the Theory of Bessel Functions. Cambridge University Press, 804 pp. 548 Advanced Engineering Mathematics with MATLAB or (9.5.2) Once again, our ultimate goal is the use of its solutions in orthogonal expansions. These orthogonal expansions, in turn, are used in the solution of partial differential equations in cylindrical coordinates. A quick check of Bessel's equation shows that it conforms to the canonical form of the Sturm-Liouville problem: p(x)=x, q(x)= n2/x, r(x)=x, and = 2. Restricting our attention to the interval [0, L], the Sturm-Liouville problem involving (9.5.2) is singular because p(0)=0. From (9.4.1) in the previous section, the eigenfunctions to a singular SturmLiouville problem will still be orthogonal over the interval [0, L] if (1) y(x) is finite and xy (x) is zero at x=0, and (2) y(x) satisfies the homogeneous boundary condition (9.1.2) at x=L. Consequently, we only seek solutions that satisfy these conditions. We cannot write down the solution to Bessel's equation in a simple closed form; as in the case with Legendre's equation, we must find the solution by power series. Because we intend to make the expansion about x=0 and this point is a regular singular point, we must use the method of Frobenius, where n is an integer.22 Moreover, because the quantity n2 appears in (9.5.2), we may take n to be nonnegative without any loss of generality. To simplify matters, we first find the solution when =1; the solution for 1 follows by substituting x for x. Consequently, we seek solutions of the form (9.5.3) (9.5.4) and (9.5.5) The Sturm-Liouville Problem 549 where we formally assume that we can interchange the order of differentiation and summation. The substitution of (9.5.3)(9.5.5) into (9.5.1) with =1 yields (9.5.6) or (9.5.7) 22 This case is much simpler than for arbitrary n. See Hildebrand, F.B., 1962: Advanced Calculus for Applications. Prentice-Hall, 4.8. If we explicitly separate the k=0 term from the other terms in the first summation in (9.5.7), (9.5.8) We now change the dummy integer in the first summation of (9.5.8) by letting m=k+1 so that (9.5.9) Because (9.5.9) must be true for all x, each power of x must vanish identically. This yields s=n, and [(2k+s+2)2 n2]Bk+1+Bk=0. (9.5.10) Since the difference of the larger indicial root from the lower root equals the integer 2n, we are only guaranteed a power series solution of the form (9.5.3) for s=n. If we use this indicial root and the recurrence formula (9.5.10), this solution, known as the Bessel function of the first kind of order n and denoted by Jn(x), is 550 Advanced Engineering Mathematics with MATLAB (9.5.11) To find the second general solution to Bessel's equation, the one corresponding to s= n, the most economical method23 is to express it in terms of partial derivatives of Jn(x) with respect to its order n: (9.5.12) Upon substituting the power series representation (9.5.11) into (9.5.12), (9.5.13) Figure 9.5.2: The first four Bessel functions of the first kind over 0 x 8. where (9.5.14) 23 See Watson, G.N., 1966: A Treatise on the Theory of Bessel Functions. Cambridge University Press, 3.5 for the derivation. The Sturm-Liouville Problem 551 (1)= , and is Euler's constant (0.5772157). In the case n=0, the first sum in (9.5.13) disappears. This function Yn(x) is Neumann's Bessel function of the second kind of order n. Consequently, the general solution to (9.5.1) is y(x)=AJn( x)+BYn( x). (9.5.15) Figure 9.5.2 illustrates the functions J0(x), J1(x), J2(x), and J3(x) while Figure 9.5.3 gives Y0(x), Y1(x), Y2(x), and Y3(x). An equation which is very similar to (9.5.1) is (9.5.16) It arises in the solution of partial differential equations in cylindrical coordinates. If we substitute into (9.5.16), it becomes Bessel's equation: (9.5.17) Consequently, we may immediately write the solution to (9.5.16) as y(x)=c1 Jn(ix)+c2Yn(ix), (9.5.18) if n is an integer. Traditionally the solution to (9.5.16) has been written y(x)=c1In(x)+c2Kn(x) (9.5.19) rather than in terms of Jn(ix) and Yn(ix), where (9.5.20) 552 Advanced Engineering Mathematics with MATLAB Figure 9.5.3: The first four Bessel functions of the second kind over 0<x<8. and (9.5.21) The function In(x) is the modified Bessel function of the first kind, of order n, while Kn(x) is the modified Bessel function of the second kind, of order n. Figure 9.5.4 illustrates I0(x), I1(x), I2(x), and I3(x) while in Figure 9.5.5 K0(x), K1(x), K2(x), and K3(x) are graphed. Note that Kn(x) has no real zeros while In(x) equals zero only at x=0 for n 1. As our derivation suggests, modified Bessel functions are related to ordinary Bessel functions via complex variables. In particular, Jn(iz)=inIn(z), and In(iz)=inJn(z) for z complex. Although we found solutions to Bessel's equation (9.5.1), as well as (9.5. 16), can we use any of them in an eigenfunction expansion? From Figures 9.5.29.5.5 we see that Jn(x) and In(x) remain finite at x=0 while Yn(x) and Kn(x) do not. Furthermore, the products and tend to zero at x=0. Thus, both Jn(x) and In(x) satisfy the first requirement of an eigenfunction for a Fourier-Bessel expansion. What about the second condition that the eigenfunction must satisfy the homogeneous boundary condition (9.1.2) at x=L? From Figure 9.5.4 we see that In(x) can never satisfy this condition while from Figure 9.5.2 Jn(x) can. For that reason, we discard In(x) from further consideration and continue our analysis only with Jn(x). Before we can derive the expressions for a Fourier-Bessel expansion, we need to find how Jn(x) is related to Jn+1(x) and Jn 1(x). Assuming that n is a positive integer, we multiply the series (9.5.11) by xn and then differentiate with respect to x. This gives The Sturm-Liouville Problem 553 (9.5.22) Figure 9.5.4: The first four modified Bessel functions of the first kind over 0<x<3. (9.5.23) =xnJn 1(x) (9.5.24) or (9.5.25) for n=1, 2, 3,.... Similarly, multiplying (9.5.11) by x n, we find that (9.5.26) 554 Advanced Engineering Mathematics with MATLAB for n=0, 1, 2, 3,.... If we now carry out the differentiation on (9.5.25) and (9.5.26) and divide by the factors xn, we have that (9.5.27) and (9.5.28) Figure 9.5.5: The first four modified Bessel functions of the second kind over 0x3. Equations (9.3.27)(9.3.28) immediately yield the recurrence relationships (9.5.29) and (9.5.30) The Sturm-Liouville Problem 555 for n=1, 2, 3,.... For n=0, we replace (9.5.30) by Let us now construct a Fourier-Bessel series. The exact form of the expansion depends upon the boundary condition at x=L. There are three possible cases. One of them is y(L)=0 and results in the condition that Jn( kL)=0. Another condition is y (L)=0 and gives Finally, if hy(L)+y (L)=0, then cases, the eigenfunction expansion is the same, namely In all of these (9.5.31) where k is the kth positive solution of either or We now need a mechanism for computing Ak. We begin by multiplying (9.5.31) by xJn( m x) dx and integrate from 0 to L. This yields (9.5.32) From the general orthogonality condition (9.2.1), (9.5.33) if k m. Equation (9.5.32) then simplifies to (9.5.34) or (9.5.35) 556 Advanced Engineering Mathematics with MATLAB where (9.5.36) and k has replaced m in (9.5.34). The factor Ck depends upon the nature of the boundary conditions at x=L. In all cases we start from Bessel's equation (9.5.37) If we multiply both sides of (9.5.37) by ( kx), the resulting equation is (9.5.38) An integration of (9.5.38) from 0 to L, followed by the subsequent use of integration by parts, results in (9.5.39) Because Jn(0)=0 for n>0, J0(0)=1 and lower limits vanishes. Thus, at x=0, the contribution from the (9.5.40) (9.5.41) Because (9.5.42) The Sturm-Liouville Problem 557 from (9.5.28), Ck becomes (9.5.43) if Jn( kL)=0. Otherwise, then (9.5.44) Finally, (9.5.45) if All of the preceding results must be slightly modified when n=0 and the boundary condition is or kJ1( kL)=0. This modification results from the additional eigenvalue 0 =0 being present and we must add the extra term A0 to the expansion. For this case the series reads (9.5.46) where the equation for finding A0 is (9.5.47) and (9.5.35) and (9.5.44) with n=0 give the remaining coefficients. Example 9.5.1 Starting with Bessel's equation, we show that the solution to 558 Advanced Engineering Mathematics with MATLAB (9.5.48) is y(x)=Axa Jn(bxc)+BxaYn(bxc), (9.5.49) provided that bxc>0 so that Yn(bxc) exists. The general solution to (9.5.50) is =AJn( )+BYn( ). (9.5.51) If we now let =y(x)/xa and =bxc, then (9.5.52) (9.5.53) (9.5.54) and (9.5.55) Substituting (9.5.52)(9.5.55) into (9.5.50) and simplifying yields the desired result. The Sturm-Liouville Problem 559 Example 9.5.2 We show that (9.5.56) From (9.5.28), (9.5.57) (9.5.58) and (9.5.59) after using (9.5.27) and (9.5.28). Simplifying, (9.5.60) After multiplying (9.5.60) by x2, we obtain (9.5.56). Example 9.5.3 Show that (9.5.61) 560 Advanced Engineering Mathematics with MATLAB We begin by integrating (9.5.61) by parts. If u=x2, and d =x3 J2(x) dx, then (9.5.62) because d[x3J3(x)]/dx=x2 J2(x) by (9.5.25). Finally, (9.5.63) since x4J3(x)=d[x4 J4(x)]/dx by (9.5.25). Example 9.5.4 Let us expand f(x)=x, 0<x<1, in the series (9.5.64) where k denotes the kth zero of J1( ). From (9.5.35) and (9.5.43), (9.5.65) However, from (9.5.25), (9.5.66) if n=2. Therefore, (9.5.65) becomes (9.5.67) and the resulting expansion is (9.5.68) The Sturm-Liouville Problem 561 Figure 9.5.6 shows the Fourier-Bessel expansion of f(x)=x in truncated form when we only include one, two, three, and four terms. It was created using the MATLAB script clear; x = [0:0.01:1]; % create x points in plot f = x; % construct function f(x) % initialize Fourier-Bessel series fbesse1 = zeros (size (x)); % read in the first four zeros of J_1(mu) = 0 mu(1) = 3.83171; mu(2) = 7.01559; mu(3) = 10.17347; mu(4) = 13.32369; c1f % clear any figures for n = 1:4 % Fourier coefficient factor = 2 / (mu (n) * besselj (2,mu(n))); % compute Fourier-Bessel series fbesse1 = fbesse1 + factor * besse1j (1,mu(n)*x); % create plot of truncated Fourier-Bessel series with n terms subplot(2, 2, n), plot(x,fbessel,x,f,'--') axis([0 1 0.25 1.25]) if n == 1 legend ('1 term','f(x)'); legend boxoff; else Iegend([num2str(n)'terms'],'f(x)');legend boxoff; end if n > 2 xlabel ('x','Fontsize',20); end end Example 9.5.5 Let us expand the function f(x)=x2, 0<x<1, in the series (9.5.69) 562 Advanced Engineering Mathematics with MATLAB Figure 9.5.6: The Fourier-Bessel series representation (9.5.68) for f(x)=x, 0<x<1, when we truncate the series so that it includes only the first, first two, first three, and first four terms. where k denotes the kth positive zero of J0( ). From (9.5.35) and (9.5.43), (9.5.70) If we let t= kx, the integration (9.5.70) becomes (9.5.71) We now let u=t2 and d =tJ0(t) dt so that integration by parts results in (9.5.72) (9.5.73) The Sturm-Liouville Problem 563 because =tJ1(t) from (9.5.25). If we integrate by parts once more, we find that (9.5.74) (9.5.75) However, from (9.5.29) with n=1, (9.5.76) Figure 9.5.7: The Fourier-Bessel series representation (9.5.79) for f(x)=x2, 0<x<1, when we truncate the series so that it includes only the first, first two, first three, and first four terms. or (9.5.77) because J0( k)=0. Therefore, (9.5.78) and 564 Advanced Engineering Mathematics with MATLAB (9.5.79) Figure 9.5.7 shows the representation of x2 by the Fourier-Bessel series (9.5.79) when we truncate it so that it includes only one, two, three, or four terms. As we add each additional term in the orthogonal expansion, the expansion fits f(x) better in the "least squares" sense of (9.3.5). Problems 1. Show from the series solution that From the recurrence formulas, show these following relations: 2. 3. 4. 5. 6. 7. 8. 9. 10. Show that the maximum and minimum values of Jn(x) occur w hen Show that 11. 12. 13. The Sturm-Liouville Problem 565 14. 15. 16. 17. 18. 19. Show that where k is the kth positive root of J0( )=0. Then use MATLAB to illustrate various partial sums of the Fourier-Bessel series. 20. Show that where k is the kth positive root of J0( )=0. Then use MATLAB to illustrate various partial sums of the Fourier-Bessel series. 21. Show that where k is the kth positive root of J1(2 )=0. Then use MATLAB to illustrate various partial sums of the Fourier-Bessel series. 22. Show that where k is the kth positive root of J1( )=0. Then use MATLAB to illustrate various partial sums of the Fourier-Bessel series. 566 Advanced Engineering Mathematics with MATLAB 23. Show that where k is the kth positive root of J 1( )=0. Then use MATLAB to illustrate various partial sums of the Fourier-Bessel series. 24. Show that where k is the kth positive root of J0( )=0. Then use MATLAB to illustrate various partial sums of the Fourier-Bessel series. 25. Show that where k is the kth positive root of J1( )= LJ0( ). Then use MATLAB to illustrate various partial sums of the Fourier-Bessel series. 26. Using the relationship24 show that where k is the kth positive root of J0( a)=0 and b is a constant. 27. Given the definite integral25 24 25 Watson, op. cit., 5.11, Equation 8. Gradshteyn, I.S., and I.M.Ryzhik, 1965: Table of Integrals, Series, and Products. Academic Press, 6.567, Formula 1 with v=0 and = 1/2. The Sturm-Liouville Problem 567 show that where k is the kth positive root of J0( )=0 and H( ) is Heaviside's step function. 28. Using the same definite integral from the previous problem, show26 that where a<b, n is the nth positive root of and H( ) is Heaviside's step function. 29. Given the definite integral27 show that where 0<x<a, k is the kth positive root of J0( )=0, H( ) is Heaviside's step function, and b is a constant. 30. Using the integral definition of the Bessel function28 for J1(z): 26 Reprinted from Int. J. Solids Struct., 37, X.X.Wei and K.T.Chau, Finite solid circular cylinders subjected to arbitrary surface load. Part II-Application to double-punch test, 57335744, 2000, with permission of Elsevier Science. Gradshteyn and Ryzhik, op. cit., 6.677, Formula 6. Gradshteyn and Ryzhik, op. cit., 3.753, Formula 5. 27 28 568 Advanced Engineering Mathematics with MATLAB show that where H( ) is Heaviside's step function. [Hint: Treat this as a Fourier halfrange sine expansion.] 31. Show that where k is the kth positive root of J0( )=0 and ( ) is the Dirac delta function. 32. Show that where k is the kth positive root of J0( )= 0 and ( ) is the Dirac delta function. Chapter 10 The Wave Equation In this chapter we will study problems associated with the equation (10.0.1) where u=u(x, t), x and t are the two independent variables, and c is a constant. This equation, called the wave equation, serves as the prototype for a wider class of hyperbolic equations (10.0.2) where b2>4ac. It arises in the study of many important physical problems involving wave propagation, such as the transverse vibrations of an elastic string and the longitudinal vibrations or torsional oscillations of a rod. 10.1 THE VIBRATING STRING The motion of a string of length L and constant density (mass per unit length) is a simple example of a physical system described by the wave equation. See Figure 10.1.1. Assuming that the equilibrium position of the string and the interval [0, L] along the x-axis coincide, the equation of motion which Figure 10.1.1: The vibrating string. describes the vertical displacement u(x, t) of the string follows by considering a short piece whose ends are at x and x+ x and applying Newton's second law. 570 Advanced Engineering Mathematics with MATLAB If we assume that the string is perfectly flexible and offers no resistance to bending, Figure 10.1.1 shows the forces on an element of the string. Applying Newton's second law in the x-direction, the sum of forces equals T(x) cos( 1)+T(x+ x) cos( 2), (10.1.1) where T(x) denotes the tensile force. If we assume that a point on the string moves only in the vertical direction, the sum of forces in (10.1.1) equals zero and the horizontal component of tension is constant: T(x) cos( 1)+T(x+ x) cos( 2)=0, and T(x) cos( 1)=T(x+ x) cos( 2)=T, a constant. If gravity is the only external force, Newton's law in the vertical direction gives (10.1.2) (10.1.3) (10.1.4) where utt is the acceleration. Because (10.1.5) then (10.1.6) The quantities tan( 1) and tan( 2) equal the slope of the string at x and x+ x, respectively; that is, (10.1.7) The Wave Equation 571 Substituting (10.1.7) into (10.1.6), (10.1.8) After dividing through by x, we have a difference quotient on the left: (10.1.9) In the limit as x0, this difference quotient becomes a partial derivative with respect to x, leaving Newton's second law in the form (10.1.10 or (10.1.11) where c2=T/ . Because utt is generally much larger than g, we can neglect the last term, giving the equation of the vibrating string as (10.1.12) Equation (10.1.12) is the one-dimensional wave equation. As a second example1 we derive the threadline equation which describes how a thread composed of yard vibrates as we draw it between two eyelets spaced a distance L apart. We assume that the tension in the thread is constant, the vibrations are small, the thread is perfectly flexible, the effects of gravity and air drag are negligible, and the mass of the thread per unit length is constant. Unlike the vibrating string between two fixed ends, we draw the threadline through the eyelets at a speed V so that a segment of thread experiences motion in both the x and y directions as it vibrates about its equilibrium position. The eyelets may move in the vertical direction. 1 Reprinted from J. Franklin Inst., 275, R.D.Swope and W.F.Ames, Vibrations of a moving threadline, 3655, 1963, with kind permission from Elsevier Science Ltd, The Boulevard, Langford Lane, Kidlington OX5 1GB, UK. 572 Advanced Engineering Mathematics with MATLAB From Newton's second law, (10.1.13) where m is the mass of the thread. But (10.1.14) Because dx/dt=V, (10.1.15) and (10.1.16) Because both m and V are constant, it follows that (10.1.17) The sum of the forces again equals (10.1.18) so that the threadline equation is (10.1.19) The Wave Equation 573 or (10.1.20 where is the density of the thread. Although (10.1.20) is not the classic wave equation given in (10.1.12), it is an example of a hyperbolic equation. As we shall see, the solutions to hyperbolic equations share the same behavior, namely, wave-like motion. 10.2 INITIAL CONDITIONS: CAUCHY PROBLEM Any mathematical model of a physical process must include not only the governing differential equation but also any conditions that are imposed on the solution. For example, in time-dependent problems the solution must conform to the initial condition of the modeled process. Finding those solutions that satisfy the initial conditions (initial data) is called the Cauchy problem. In the case of partial differential equations with second-order derivatives in time, such as the wave equation, we correctly pose the Cauchy boundary condition if we specify the value of the solution u(x, t0)=f(t) and its time derivative ut(x, t0)=g(t) at some initial time t0, usually taken to be t0=0. The functions f(t) and g(t) are called the Cauchy data. We require two conditions involving time because the differential equation has two time derivatives. In addition to the initial conditions, we must specify boundary conditions in the spatial direction. For example, we may require that the end of the string be fixed. In the next chapter, we discuss boundary conditions in greater depth. However, one boundary condition that is uniquely associated with the wave equation on an open domain is the radiation condition. It requires that the waves radiate off to infinity and remain finite as they propagate there. In summary, Cauchy boundary conditions, along with the appropriate spatial boundary conditions, uniquely determine the solution to the wave equation; any additional information is extraneous. Having developed the differential equation and initial conditions necessary to solve the wave equation, let us now turn to the actual methods used to solve this equation. 10.3 SEPARATION OF VARIABLES Separation of variables is the most popular method for solving the wave equation. Despite its current widespread use, its initial application to the vibrating string problem was controversial because of the use of a half-range Fourier sine series to represent the initial conditions. On one side, Daniel Bernoulli claimed (in 1775) that he could represent any general initial condition with this technique. To d'Alembert and Euler, however, the half-range Fourier sine series, with its period of 2L, could not possibly represent any 574 Advanced Engineering Mathematics with MATLAB arbitrary function.2 However, by 1807 Bernoulli was proven correct by the use of separation of variables in the heat conduction problem and it rapidly grew in acceptance.3 In the following examples we show how to apply this method. Separation of variables consists of four distinct steps which convert a second-order partial differential equation into two ordinary differential equations. First, we assume that the solution equals the product X(x)T(t). Direct substitution into the partial differential equation and boundary conditions yields two ordinary differential equations and the corresponding boundary conditions. Step two involves solving a boundary-value problem of the Sturm-Liouville type. In step three we find the corresponding time dependence. Finally we construct the complete solution as a sum of all product solutions. Upon applying the initial conditions, we have an eigenfunction expansion and must compute the Fourier coefficients. The substitution of these coefficients into the summation yields the complete solution. Example 10.3.1 Let us solve the wave equation for the special case when we clamp the string at x=0 and x=L. Mathematically, we find the solution to the wave equation (10.3.1) which satisfies the initial conditions (10.3.2) and the boundary conditions u(0, t)=u(L, t)=0, 0<t. (10.3.3) 2 3 See Hobson, E.W., 1957: The Theory of Functions of a Real Variable and the Theory of Fourier's Series, Vol 2. Dover Publishers, 312314. Ltzen, J., 1984: Sturm and Liouville's work on ordinary linear differential equations. The emergence of Sturm-Liouville theory. Arch. Hist. Exact Sci., 29, 317. The Wave Equation 575 For the present, we leave the Cauchy data quite arbitrary. We begin by assuming that the solution u(x, t) equals the product X(x)T(t). (Here T no longer denotes tension.) Because (10.3.4) and (10.3.5) the wave equation becomes c2X T=T X, (10.3.6) or (10.3.7) after dividing through by c2X(x)T(t). Because the left side of (10.3.7) depends only on x and the right side depends only on t, both sides must equal a constant. We write this separation constant and separate (10.3.7) into two ordinary differential equations: T +c2 T=0, 0<t, (10.3.8) and X + X=0, 0<x<L. (10.3.9) We now rewrite the boundary conditions in terms of X(x) by noting that the boundary conditions become u(0, t)=X(0)T(t)=0, (10.3.10) 576 Advanced Engineering Mathematics with MATLAB and u(L, t)=X(L)T(t)=0 (10.3.11) for 0<t. If we were to choose T(t)=0, then we would have a trivial solution fo u(x, t). Consequently, X(0)=X(L)=0. (10.3.12) This concludes the first step. In the second step we consider three possible values for : <0, =0, and >0. Turning first to <0, we set = m2 so that square roots of will not appear later on and m is real. The general solution of (10.3.9) is X(x)=A cosh(mx)+B sinh(mx). (10.3.13) Because X(0)=0, A=0. On the other hand, X(L)=Bsinh(mL)=0. The function sinh(mL) does not equal to zero since mL 0 (recall m>0). Thus, B=0 and we have trivial solutions for a positive separation constant. If =0, the general solution now becomes X(x)=C+Dx. (10.3.14) The condition X(0)=0 yields C=0 while X(L)=0 yields DL=0 or D=0. Hence, we have a trivial solution for the =0 separation constant. If =k2>0, the general solution to (10.3.9) is X(x)=E cos(kx)+F sin(kx). (10.3.15) The condition X(0)=0 results in E=0. On the other hand, X(L)= F sin(kL)=0. If we wish to avoid a trivial solution in this case (F 0), sin(kL)=0, or kn=n /L, and that these quantities depend on n. This concludes the second step. n =n2 2/L2. The xto indicate dependence equals Xn(x)=Fnsin(n x/L). We added the n subscript to k and The Wave Equation 577 Turning to (10.3.8) for the third step, the solution to the T(t) equation is Tn(t)=Gn cos(knct)+Hn sin(knct), (10.3.16) where Gn and Hn are arbitrary constants. For each n=1, 2, 3,..., a particular solution that satisfies the wave equation and prescribed boundary conditions is (10.3.17) or (10.3.18) where An=FnGn and Bn=FnHn. This concludes the third step. An equivalent method of finding the product solution is to treat (10.3.9) along with X(0)=X(L)=0 as a Sturm-Liouville problem. In this method we obtain the spatial dependence by solving the Sturm-Liouville problem and finding the corresponding eigenvalues n and eigenfunctions. Next we solve for Tn(t). Finally we form the product solution un(x, t) by multiplying the eigenfunction times the temporal dependence. For any choice of An and Bn, (10.3.18) is a solution of the partial differential equation (10.3.1) also satisfying the boundary conditions (10.3.3). Therefore, any linear combination of un(x, t) also satisfies the partial differential equation and the boundary conditions. In making this linear combination we need no new constants because An and Bn are still arbitrary. We have, then, (10.3.19) Our method of using particular solutions to build up the general solution illustrates the powerful principle of linear superposition, which is applicable to any linear system. This principle states that if u1 and u2 are any solutions of a linear homogeneous partial differential equation in any region, then u=c1u1+c2u2 is also a solution of that equation in that region, where c1 and c2 are any constants. We can generalize this to an infinite sum. It is extremely important because it allows us to construct general solutions to partial differential equations from particular solutions to the same problem. 578 Advanced Engineering Mathematics with MATLAB Our fourth and final task remains to determine An and Bn. At t=0, (10.3.20) and (10.3.21)) Both of these series are Fourier half-range sine expansions over the interval (0, L). Applying the results from 4.3, (10.3.22) and (10.3.23) or (10.3.24)) At this point we might ask ourselves whether the Fourier series solution to the wave equation always converges. For the case g(x)=0, Carslaw4 showed that if the initial position of the string forms a curve so that f(x) or the slope f (x) is continuous between x=0 and x=L, then the series converges uniformly. As an example, let us take the initial conditions (10.3.25) and g(x)=0, 0<x<L. 4 (10.3.26) Carslaw, H.S., 1902: Note on the use of Fourier's series in the problem of the transverse vibrations of strings. Proc. Edinburgh Math. Soc., Ser. 1, 20, 2328. The Wave Equation 579 In this particular example, Bn=0 for all n because g(x)=0. On the other hand, (10.3.27) (10.3.28) (10.3.29) (10.3.30) (10.3.31) . because Therefore, and 1 cos(2A)= 2sin (A) 2 (10.3.32 a Because sin(n /2) vanishes for n even, so does An. If (10.3.32) were evaluated on to computer, considerable time and effort would be wasted. Consequently it is preferable 2, rewrite (10.3.32) so that we eliminate these vanishing terms. The most convenient method introduces the general expression n=2m 1 for any odd integer, where m=1, 3,..., and notes that sin[(2m 1) /2]=( 1)m+1. Therefore, (10.3.32) becomes 580 Advanced Engineering Mathematics with MATLAB (10.3.33) Although we completely solved the problem, it is useful to rewrite (10.3. 33) as (10.3.34) through the application of the trigonometric identity From general physics we find expressions like sin[kn(x ct)] or sin(kx t) arising in studies of simple wave motions. The quantity sin(kx t) is the mathematical description of a propagating wave in the sense that we must move to the right at the speed c if we wish to keep in the same position relative to the nearest crest and trough. The quantities k, , and c are the wavenumber, frequency, and phase speed or wave-velocity, respectively. The relationship =kc holds between the frequency and phase speed. It may seem paradoxical that we are talking about traveling waves in a problem dealing with waves confined on a string of length L. Actually we are dealing with standing waves because at the same time that a wave is propagating to the right its mirror image is running to the left so that there is no resultant progressive wave motion. Figures 10.3.1 and 10.3.2 illustrate our solution. Figure 10.3.1 gives various cross sections. The single large peak at t=0 breaks into two smaller peaks which race towards the two ends. At each end, they reflect and turn upside down as they propagate back towards x=L/2 at ct/L=1. This large, negative peak at x=L/2 again breaks apart, with the two smaller peaks propagating towards the endpoints. They reflect and again become positive peaks as they propagate back to x=L/2 at ct/L=2. After that time, the whole process repeats itself. MATLAB can used to examine the solution in its totality. The script % set parameters for the calculation clear ; M = 50 ; dx = 0.02 ; dt = 0.02 ; % compute Fourier coefficients sign = 32 ; for m = 1 : M temp1 = (2*m 1)*pi ; temp2 = sin (temp1/8) ; a (m) = sign * temp2 * temp2 / (temp1 * temp1) ; sign = sign ; end The Wave Equation 581 Figure 10.3.1: The vibration of a string u(x, t)/h at various positions x/L at the times ct/L=0, 0.2, 0.4, 0.6, 0.8, and 1. For times 1<ct/L<2 the pictures appear in reverse time order. % compute grid and initialize solution X = [0 : dx : 1] ; T = [0 : dt : 2] ; u = zeros (length (T) , length (X) ) ; XX = repmat (X,[length (T) 1] ) ; TT = repmat (T',[1 length (X)] ) ; % compute solution from (10.3.33) for m = 1:M temp1 = (2*m 1)*pi; u = u + a(m) .* sin(templ*XX) .* cos(temp1*TT); end % plot space/time picture of the solution surf (XX, TT, u) xlabel ( ' DISTANCE' , ' Fontsize' , 20) ; ylabel ( 'TIME','Fontsize',20) zlabel('SOLUTION','Fontsize',20) gives a three-dimensional view of (10.3.33). The solution can be viewed in many different prospects using the interactive capacity of MATLAB. An important dimension to the vibrating string problem is the fact that the wavenumber kn is not a free parameter but has been restricted to the values of n /L. This restriction on wavenumber is common in wave problems dealing with limited domains (for example, a building, ship, lake, or planet) and these oscillations are given the special name of normal modes or natural vibrations. In our problem of the vibrating string, all of the components propagate with the same phase speed. That is, all of the waves, regardless of wavenumber 582 Advanced Engineering Mathematics with MATLAB Figure 10.3.2: Two-dimensional plot of the vibration of a string u(x, t)/h at various times ct/L and positions x/L. kn, move the characteristic distance c t or c t after the time interval t elapsed. In the next example we will see that this is not always true. Example 10.3.2: Dispersion In the preceding example, the solution to the vibrating string problem consisted of two simple waves, each propagating with a phase speed c to the right and left. In many problems where the equations of motion are a little more complicated than (10.3.1), all of the harmonics no longer propagate with the same phase speed but at a speed that depends upon the wavenumber. In such systems the phase relation varies between the harmonics and these systems are referred to as dispersive. A modification of the vibrating string problem provides a simple illustration. We now subject each element of the string to an additional applied force which is proportional to its displacement: (10.3.35)) where h>0 is constant. For example, if we embed the string in a thin sheet of rubber, then in addition to the restoring force due to tension, there is a restoring force due to the rubber on each portion of the string. From its use in the quantum mechanics of "scalar" mesons, (10.3.35) is often referred to as the Klein-Gordon equation. We shall again look for particular solutions of the form u(x, t)=X(x)T(t). This time, however, XT c2X T+hXT=0, or (10.3.37) (10.3.36) The Wave Equation 583 which leads to two ordinary differential equations X + X=0, and T +( c2+h)T=0. (10.3.39) (10.3.38) If we attach the string at x=0 and x=L, the X(x) solution is (10.3.40) with kn=n /L, and n =n2 2/L2. On the other hand, the T(t) solution becomes (10.3.41) so that the product solution is (10.3.42) Finally, the general solution becomes (10.3.43) from the principle of linear superposition. Let us consider the case when Bn=0. Then we can write (10.3.43) as (10.3.44) Comparing our results with (10.3.34), the distance that a particular mode kn moves during the time interval t depends not only upon external parameters such as h, the tension and density of the string, but also upon its wavenumber (or equivalently, wavelength). 584 Advanced Engineering Mathematics with MATLAB Furthermore, the frequency of a particular harmonic is larger than that when h=0. This result is not surprising, because the added stiffness of the medium should increase the natural frequencies. Figure 10.3.3: The vibration of a string u(x, t)/h embedded in a thin sheet of rubber at various positions x/L at the times ct/L=0, 0.2, 0.4, 0.6, 0.8, and 1 for hL2/c2=10. The same parameters were used as in Figure 10.3.1. The importance of dispersion lies in the fact that if the solution u(x, t) is a superposition of progressive waves in the same direction, then the phase relationship between the different harmonics changes with time. Because most signals consist of an infinite series of these progressive waves, dispersion causes the signal to become garbled. We show this by comparing the solution (10.3.43) given in Figures 10.3.3 and 10.3.4 for the initial conditions (10.3.25) and (10.3.26) with hL2/c2=10 to the results given in Figures 10.3.1 and 10.3.2. In the case of Figure 10.3.4, the MATLAB script line u = u + a(m) .* sin (temp1*XX) .* cos (temp1*TT); has been replaced with temp2 = temp1 * sqrt (1 + H/(temp1*temp1)); u = u + a (m) .* sin (temp1*XX) .* cos(temp2*TT); where H=10 is defined earlier in the script. Note how garbled the picture becomes at ct/L=2 in Figure 10.3.4 compared to the nondispersive solution at the same time in Figure 10.3.2. Example 10.3.3: Damped wave equation In the previous example a slight modification of the wave equation resulted in a wave solution where each Fourier harmonic propagates with its own particular phase speed. In The Wave Equation 585 this example we introduce a modification of the wave equation that results not only in dispersive waves but also in the exponential decay of the amplitude as the wave propagates. So far we neglected the reaction of the surrounding medium (air or water, for example) on the motion of the string. For small-amplitude motions this Figure 10.3.4: The two-dimensional plot of the vibration of a string u(x, t)/h embedded in a thin sheet of rubber at various times ct/L and positions x/L for hL2/c2=10. reaction opposes the motion of each element of the string and is proportional to the element's velocity. The equation of motion, when we account for the tension and friction in the medium but not its stiffness or internal friction, is (10.3.45) Because (10.3.45) first arose in the mathematical description of the telegraph,5 it is generally known as the equation of telegraphy. The effect of friction is, of course, to damp out the free vibration. Let us assume a solution of the form u(x, t)=X(x)T(t) and separate the variables to obtain the two ordinary differential equations: X + X=0, 5 (10.3.46) The first published solution was by Kirchhoff, G., 1857: ber die Bewegung der Electritt in Drhten. Ann. Phys. Chem., 100, 193217. English translation: Kirchhoff, G., 1857: On the motion of electricity in wires. Philos. Mag., Ser. 4, 13, 393412. 586 Advanced Engineering Mathematics with MATLAB and T +2hT + c2T=0 (10.3.47) with X(0)=X(L)=0. Friction does not affect the shape of the normal modes; they are still (10.3.48) Figure 10.3.5: The vibration of a string u(x, t)/h with frictional dissipation at various positions x/L at the times ct/L=0, 0.2, 0.4, 0.6, 0.8, and 1 for hL/c=1. The same parameters were used as in Figure 10.3.1. with kn=n /L and n =n2 2/L2. The solution for the T(t) equation is (10.3.49) with the condition that k c>h. If we violate this condition, the solutions are two n exponentially decaying functions in time. Because most physical problems usually fulfill this condition, we concentrate on this solution. The Wave Equation 587 From the principle of linear superposition, the general solution is (10.3.50) where c>hL. From (10.3.50) we see two important effects. First, the presence of friction slows all of the harmonics. Furthermore, friction dampens all of the harmonics. Figures 10.3.5 and 10.3.6 illustrate the solution using the initial conditions given by (10.3.25) and (10.3.26) with hL/c=1. In the case of Figure 10.3.6, the script line that produced Figure 10.3.2: u = u + a (m) .* sin (temp1*XX) .* cos (temp1*TT) ; has been replaced with temp2 = temp1 * sqrt (1 - (H*H) / (templ*templ) ) ; u = u + a (m) .* exp ( -H*TT) .* sin (temp1*XX) .* cos (temp2*TT) ; where H=1 is defined earlier in the script. Because this is a rather large coefficient of friction, Figures 10.3.5 and 10.3.6 exhibit rapid damping as well as dispersion. Figure 10.3.6: The vibration of a string u(x, t)/h with frictional dissipation at various times ct/L and positions x/L for hL/c=1. This damping and dispersion of waves also occurs in solutions of the equation of telegraphy where the solutions are progressive waves. Because early telegraph lines were short, time delay effects were negligible. However, when engineers laid the first transoceanic cables in the 1850s, the time delay became seconds and differences in the velocity of propagation of different frequencies, as predicted by (10.3.50), became 588 Advanced Engineering Mathematics with MATLAB noticeable to the operators. Table 10.3.1 gives the transmission rate for various transatlantic submarine telegraph lines. As it shows, increases in the transmission rates during the nineteenth century were due primarily to improvements in terminal technology. When they instituted long-distance telephony just before the turn of the twentieth century, this difference in velocity between frequencies should have limited the circuits to a few tens of miles.6 However, in 1899, Prof. Michael Pupin, at Columbia University, showed that by adding inductors ("loading coils") to the line at regular intervals the velocities at the different frequencies could be equalized.7 Heaviside8 and the French engineer Vaschy9 made Table 10.3.1: Technological Innovation on Transatlantic Telegraph Cables Year 1857 58 1870 1872 1879 1894 1915 20 1923 28 1928 32 1950 1956 Technological Innovation Mirror galvanometer Condensers Siphon recorder Duplex Larger diameter cable Brown drum repeater and Heurtley magnifier Magnetically loaded lines Electronic signal shaping amplifiers and time division multiplexing Repeaters on the continental shelf Repeater telephone cables Performance (words/min) 3 7 12 17 24 72 90 100 300 320 480 100 300 21600 From Coates, V.T., and B.Finn, 1979: A Retrospective Technology Assessment: Submarine Telegraphy. The Transatlantic Cable of 1866. San Francisco Press, Inc., 268 pp. 6 7 Rayleigh, J.W., 1884: On telephoning through a cable. Br. Assoc. Rep., 632633; Jordan, D.W., 1982: The adoption of self-induction by telephony, 18861889. Ann. Sci., 39, 433461. There is considerable controversy concerning who is exactly the inventor. See Brittain, J.E., 1970: The introduction of the loading coil: George A.Campbell and Michael I.Pupin. Tech. Culture, 11, 3657. 8 First published 3 June 1887. Reprinted in Heaviside, O., 1970: Electrical Papers, Vol 2. Chelsea Publishing, pp. 119124. 9 See Devaux-Charbonnel, X.G.F., 1917: La contribution des ingnieurs franais la tlphonie grande distance par cbles souterrains: Vaschy et Barbarat. Re . Gn. lectr., 2, 288295. The Wave Equation 589 similar suggestions in the nineteenth century. Thus, adding resistance and inductance, which would seem to make things worse, actually made possible long-distance telephony. Today you can see these loading coils as you drive along the street; they are the black cylinders, approximately one between each pair of telephone poles, spliced into the telephone cable. The loading of long submarine telegraph cables had to wait for the development of permalloy and mu-metal materials of high magnetic induction. Example 10.3.4: Axisymmetric vibrations of a circular membrane The wave equation (10.3.51) governs axisymmetric vibrations of a circular membrane, where u(r, t) is the vertical displacement of the membrane, r is the radial distance, t is time, c is the square root of the ratio of the tension of the membrane to its density, and a is the radius of the membrane. We will solve (10.3.51) when the membrane is initially at rest, u(r, 0)=0, and struck so that its initial velocity is (10.3.52) If this problem can be solved by separation of variables, then u(r, t)= R(r)T(t). Following the substitution of this u(r, t) into (10.3.51), separation of variables leads to (10.3.53) or (10.3.54) 590 Advanced Engineering Mathematics with MATLAB and (10.3.55) The separation constant k2 must be negative so that we obtain solutions that remain bounded in the region 0<r<a and can satisfy the boundary condition. This boundary condition is u(a, t)=R(a)T(t)=0, or R(a)=0. The solutions of (10.3.54)(10.3.55), subject to the boundary condition, are (10.3.56) and (10.3.57) where n satisfies the equation J0( )=0. Because u(r, 0)=0, and Tn(0)=0, Bn=0. Consequently, the product solution is (10.3.58) To determine An, we use the condition (10.3.59) Equation (10.3.59) is a Fourier-Bessel expansion in the orthogonal function J0 ( nr/ ), where (10.3.60) The Wave Equation 591 from (9.5.35) and (9.5.43) in 9.5. Carrying out the integration, (10.3.61) Figure 10.3.7: The axisymmetric vibrations u (r, t)=capu(r, t)/P of a circular membrane at various positions r/a at the times ct/a=0, 0.2, 0.4, 0.6, 0.8, and 1 for Initially the membrane is struck by a hammer. or (10.3.62) Figures 10.3.7, 10.3.8, and 10.3.9 illustrate the solution (10.3.62) for various times and positions when script and They were generated using the MATLAB % initialize parameters clear; eps_over_a = 0.25; M = 20; dr = 0.02; dt = % load in zeros of J_0 zero( 1) = 2.40483; zero( 2) = 5.52008; zero( 3) = zero( 4) = 11.79153; zero( 5) = 14.93092; zero( 6) = zero( 7) = 21.21164; zero( 8) = 24.35247; zero( 9) = zero( 10) = 30.63461; zero( 11) = 33.77582; zero( 12) = 0.02; 8.65373; 18.07106; 27.49347 ; 36.91710 ; 592 Advanced Engineering Mathematics with MATLAB zero( 13) = 40.05843; zero( 14) = 43.19979; zero( 15) = 46.34119; zero( 16) = 49.48261; zero( 17) = 52.62405; zero( 18) = 55.76551; zero( 19) = 58.90698; zero( 20) = 62.04847; % compute Fourier-Bessel coefficients for m = 1 : M a (m) = 2 * besse1j ( 1 , eps_over_a*zero (m) ) ... / (eps_over_a*pi*zero (m) *zero (m) *besselj (1 ,zero(m))^2); end R = [0:dr:1]; T = [0:dt:4]; u = zeros (length (T), length(R)); RR = repmat (R,[length(T)1]); Figure 10.3.8: The axisymmetric vibrations capu(r, t)/P of a circular membrane resulting from an initial hammer blow with =a/4. The solution is plotted at various times ct/a and positions r/a. TT = repmat (T', [1 length(R)]); % compute solution from series solution for m = 1:M u = u + a (m) .* besse1j(0,zero(m)*RR).* sin(zero(m)*TT); end % plot results surf (RR, TT, u) xlabel ('R','Fontsize' ,20) ; ylabel ( ' TIME' , 'Fontsize',20) zlabel ('SOLUTION',' Fontsize',20) The Wave Equation 593 Figures 10.3.8 and 10.3.9 show that striking the membrane with a hammer generates a pulse that propagates out to the rim, reflects, inverts, and propagates back to the center. This process then repeats forever. Problems Solve the wave equation utt=c2uxx, 0<x<L, 0<t, subject to the boundary conditions that u(0, t)=u(L, t)=0, 0<t, and the following initial conditions for 0<x<L. Use MATLAB to illustrate your solution. 1. u(x, 0)=0, ut(x, 0)=1 2. u(x, 0)=1, ut(x, 0)=0 Figure 10.3.9: Same as Figure 10.3.8 except =a/20. 3. 4. u(x, 0)=[3sin( x/L) sin(3 x/L)]/4, ut(x, 0)=0, 5. 6. 7. 594 Advanced Engineering Mathematics with MATLAB 8. Solve the wave equation subject to the boundary conditions and the initial conditions [Hint: You must include the separation constant of zero.] 9. Solve10 the wave equation subject to the boundary conditions and the initial conditions where <1. Hint: Use the substitution 4x=r2. 10. The differential equation for the longitudinal vibrations of a rod within a viscous fluid is where c is the velocity of sound in the rod and h is the damping coefficient. If the rod is fixed at x=0 so that u(0, t)=0, and allowed to freely oscillate at the other end x=L, so that ux(L, t)=0, find the vibrations for any location x and subsequent time t if the rod has the initial displacement of u(x, 0)=x and the initial velocity ut(x, 0)=0 for 0<x<L. Assume that h<c /(2L). Why? 10 Solved in a slightly different manner by Bailey, H., 2000: Motions of a hanging chain after the free end is given an initial velocity. Am. J. Phys., 68, 764767. The Wave Equation 595 11. A closed pipe of length L contains air whose density is slightly greater than that of the outside air in the ratio of 1+s0 to 1. Everything being at rest, we suddenly draw aside the disk closing one end of the pipe. We want to determine what happens inside the pipe after we remove the disk. As the air rushes outside, it generates sound waves within the pipe. The wave equation governs these waves, where c is the speed of sound and u(x, t) is the velocity potential. Without going into the fluid mechanics of the problem, the boundary conditions are a. No flow through the closed end: ux(0, t)=0. b. No infinite acceleration at the open end: uxx(L, t)=0. c. Air is initially at rest: ux(x, 0)=0. d. Air initially has a density greater than the surrounding air by the amount s0: ut(x, 0)= c2s0. Find the velocity potential at all positions within the pipe and all subsequent times. 12. One of the classic applications of the wave equation has been the explanation of the acoustic properties of string instruments. Usually we excite a string in one of three ways: by plucking (as in the harp, zither, etc.), by striking with a hammer (piano), or by bowing (violin, violoncello, etc.). In all of these cases, the governing partial differential equation is with the boundary conditions u(0, t)=u(L, t)=0, 0<t. For each of the following methods of exciting a string instrument, find the complete solution to the problem: (a) Plucked string For the initial conditions: and 596 Advanced Engineering Mathematics with MATLAB show that We note that the harmonics are absent where sin(n a/L)=0. Thus, if we pluck the string at the center, all of the harmonics of even order are absent. Furthermore, the intensity of the successive harmonics varies as n 2. The higher harmonics (overtones) are therefore relatively feeble compared to the n=1 term (the fundamental). (b) String excited by impact The effect of the impact of a hammer depends upon the manner and duration of the contact, and is more difficult to estimate. However, as a first estimate, let u(x, 0)=0, 0<x<L, and where Show that the solution in this case is As in part (a), the nth mode is absent if the origin is at a node. The intensity of the overtones are now of the same order of magnitude; higher harmonics (overtones) are relatively more in evidence than in part (a). (c) Bowed violin string The theory of the vibration of a string when excited by bowing is poorly understood. The bow drags the string for a time until the string springs back. After awhile the process repeats. It can be shown11 that the proper initial conditions are u(x, 0)=0, 0<x<L, and ut(x, 0)=4 c(L x)/L2, 0<x<L, where is the maximum displacement. Show that the solution is now 11 See Lamb, H., 1960: The Dynamical Theory of Sound. Dover Publishers, 27. The Wave Equation 597 10.4 D'ALEMBERT'S FORMULA In the previous section we sought solutions to the homogeneous wave equation in the form of a product X(x)T(t). For the one-dimensional wave Figure 10.4.1: Although largely self-educated in mathematics, Jean Le Rond d'Alembert (17171783) gained equal fame as a mathematician and philosophe of the continental Enlightenment. By the middle of the eighteenth century, he stood with such leading European mathematicians and mathematical physicists as Clairaut, D.Bernoulli, and Euler. Today we best remember him for his work in fluid dynamics and applying partial differential equations to problems in physics. (Portrait courtesy of the Archives de l'Acadmie des sciences, Paris.) equation there is a more general method for constructing the solution, published by D'Alembert12 in 1747. Let us determine a solution to the homogeneous wave equation (10.4.1) which satisfies the initial conditions 12 D'Alembert, J., 1747: Recherches sur la courbe que forme une corde tendu mise en vibration. Hist. Acad. R. Sci. Belles Lett., Berlin, 214219. 598 Advanced Engineering Mathematics with MATLAB (10.4.2) We begin by introducing two new variables , defined by =x+ct, and =x ct, and set u(x, t)= ( , ). The variables and are called the characteristics of the wave equation. Using the chain rule, (10.4.3) (10.4.4) (10.4.5) (10.4.6) and similarly (10.4.7) so that the wave equation becomes (10.4.8) The Wave Equation 599 The general solution of (10.4.8) is ( , )=F( )+G( ). Thus, the general solution of (10.4.1) is of the form u(x, t)=F(x+ct)+G(x ct), (10.4.10) (10.4.9) where F and G are arbitrary functions of one variable and are assumed to be twice differentiable. Setting t=0 in (10.4.10) and using the initial condition that u(x, 0)=f(x), F(x)+G(x)=f(x). (10.4.11) The partial derivative of (10.4.10) with respect to t yields (10.4.12) Here primes denote differentiation with respect to the argument of the function. If we set t=0 in (10.4.12) and apply the initial condition that ut(x, 0)= g(x), cF (x) cG (x)=g(x). (10.4.13) Integrating (10.4.13) from 0 to any point x gives (10.4.14) where C is the constant of integration. Combining this result with (10.4.11), (10.4.15) 600 Advanced Engineering Mathematics with MATLAB Figure 10.4.2: D'Alembert's solution (10.4.18) to the wave equation. and (10.4.16) If we replace the variable x in the expression for F and G by x+ct and x ct, respectively, and substitute the results into (10.4.10), we finally arrive at the formula (10.4.17) This is known as d'Alembert's formula for the solution of the wave equation (10.4.1) subject to the initial conditions (10.4.2). It gives a representation of the solution in terms of known initial conditions. Example 10.4.1 To illustrate d'Alembert's formula, let us find the solution to the wave equation (10.4.1) satisfying the initial conditions u(x, 0)=H(x+1) H(x 1) and ut(x, 0)=0, <x< . By d'Alembert's formula (10.4.17), (10.4.18) The Wave Equation 601 We illustrate this solution in Figure 10.4.2 generated by the MATLAB script % set mesh size for solution clear ; dx = 0.1 ; dt = 0.1 ; % compute grid X=[ 10:dx:10]; T = [0:dt:10]; for j=1:length (T); t = T(j); for i=1:length(X); x = X (i); % compute characteristics characteristic_1 = x + t; characteristic_2 = x t; % compute solution XX(i, j) = x; TT(i, j) = t; u(i, j) = 0.5 * (stepfun (characteristic_1, 1) ... + stepfun(characteristic_2, 1) ... stepfun(characteristic_1, 1) ... stepfun(characteristic_2, 1) ); end; end surf(XX,TT,u); colormap autumn; xlabel ('DISTANCE' 'Fontsize',20); ylabel('TIME','Fontsize',20) , zlabel ('SOLUTION','Fontsize',20) In this figure, you can clearly see the characteristics as they emanate from the discontinuities at x=1. Example 10.4.2 Let us find the solution to the wave equation (10.4.1) when u(x, 0)=0, and ut(x, 0)=sin(2x), is <x< . By d'Alembert's formula, the solution (10.4.19) In addition to providing a method of solving the wave equation, d'Alembert's solution can also provide physical insight into the vibration of a string. Consider the case when we release a string with zero velocity after giving it an initial displacement of f(x). According to (10.4.17), the displacement at a point x at any time t is (10.4.20) Because the function f(x ct) is the same as the function of f(x) translated to the right by a distance equal to ct, f(x ct) represents a wave of form f(x) traveling to the right with the velocity c, a forward wave. Similarly, we can interpret the function f(x+ct) as representing a wave with the shape f(x) traveling to the left with the velocity c, a backward wave. 602 Advanced Engineering Mathematics with MATLAB Thus, the solution (10.4.17) is a superposition of forward and backward waves traveling with the same velocity c and having the shape of the initial profile f(x) with half of the Figure 10.4.3: The propagation of waves due to an initial displacement according to d'Alembert's formula. amplitude. Clearly the characteristics x+ct and x ct give the propagation paths along which the waveform f(x) propagates. Example 10.4.3 To illustrate our physical interpretation of d'Alembert's solution, suppose that the string has an initial displacement defined by (10.4.21) In Figure 10.4.3(A) the forward and backward waves, indicated by the dashed line, coincide at t=0. As time advances, both waves move in opposite directions. In particular, at t=a/(2c), they moved through a distance a/2, resulting in the displacement of the string shown in Figure 10.4.3(B). Eventually, at t=a/c, the forward and backward waves completely separate. Finally, Figures 10.4.3(D) and 10.4.3(E) show how the waves radiate off to infinity at the speed of c. Note that at each point the string returns to its original position of rest after the passage of each wave. The Wave Equation 603 Consider now the opposite situation when u(x, 0)=0, and ut(x, 0)= g(x). The displacement is (10.4.22) If we introduce the function (10.4.23) then we can write (10.4.22) as u(x, t)= (x+ct) (x ct), (10.4.24) which again shows that the solution is a superposition of a forward wave (x ct) and a backward wave (x+ct) traveling with the same velocity c. The function , which we compute from (10.4.23) and the initial velocity g(x), determines the exact form of these waves. Example 10.4.4: Vibration of a moving threadline The characterization and analysis of the oscillations of a string or yarn have an important application in the textile industry because they describe the way that yarn winds on a bobbin.13 As we showed in 10.4.1, the governing equation, the "threadline equation," is (10.4.25 where =2V, =V2 gT/ , V is the windup velocity, g is the gravitational attraction, T is the tension in the yarn, and is the density of the yarn. We now introduce the characteristics =x+ 1t, and =x+ 2t, where 1 and 2 are yet undetermined. Upon substituting and into (10.4.25), (10.4.26 If we choose 1 and 2 to be roots of the equation 2 +2V +V2 gT/ =0, (10.4.26) reduces to the simple form 13 (10.4.27) Reprinted from J. Franklin Inst., 275, R.D.Swope and W.F.Ames, Vibrations of a moving threadline, 3655, 1963, with kind permission from Elsevier Science Ltd, The Boulevard, Langford Lane, Kidlington OX5 1GB, UK. 604 Advanced Engineering Mathematics with MATLAB u =0, (10.4.28) which has the general solution u(x, t)=F( )+G( )=F(x+ 1t)+G(x+ 2t). (10.4.29) Figure 10.4.4: Displacement of an infinite, moving threadline when c=10, and V=1. Solving (10.4.27) yields 1 =c V, and 2 = c V, (10.4.30) where If the initial conditions are u(x, 0)=f(x), and ut(x, 0)=g(x), (10.4.31) The Wave Equation 605 then (10.4.32) Because 1 does not generally equal to 2 , the two waves that constitute the motion of the string move with different speeds and have different shapes and forms. For example, if (10.4.33) (10.4.34) Figures 10.4.4 and 10.4.5 illustrate this solution for several different parameters. Figure 10.4.5: Displacement of an infinite, moving threadline when c=11, and V=10. Problems Use d'Alembert's formula to solve the wave equation (10.4.1) for the following initial conditions defined for |x|< . Then illustrate your solution using MATLAB. 1. u(x, 0)=2 sin(x) cos(x) 2. u(x, 0)=x sin(x) 3. u(x, 0)=1/(x2+1) 4. u(x, 0)=e x 5. u(x, 0)=cos( x/2) 6. u(x, 0)=sin(3x) 7. Assuming that the functions F and G that ut(x, 0)=cos(x) ut(x, 0)=cos(2x) ut(x, 0)=ex ut(x, 0)=1/(x2+1) ut(x, 0)=sinh(ax) ut(x, 0)=sin(2x) sin(x) are differentiable, show by direct substitution 606 Advanced Engineering Mathematics with MATLAB and are the D'Alembert solutions to the hyperbolic system where c2=E/ and E, k, and are constants. 8. D'Alembert's solution can also be used in problems over the limited domain 0<x<L. To illustrate this, let us solve the wave equation (10.4.1) with the initial conditions u(x, 0)=0, ut(x, 0)=Vmax(1 x/L), 0<x<L, and the boundary conditions u(0, t)=u(L, t) 0, 0<t. Step 1: Show that the solution to this problem is where along with the periodicity conditions V0( )=V0( into the boundary conditions. ), and V0(L+ )= V0(L ) to take care of those cases when the argument of V0( ) is outside of (0, L). Hint: Substitute the solution Step 2: Show that at any point x within the interval (0, L), the solution repeats with a period of 2L/c if ct>2L. Therefore, if we know the behavior of the solution for the time interval 0<ct<2L, we know the behavior for any other time. Step 3: Show that the solution at any point x within the interval (0, L) and time t+L/c, where 0<ct<L, is the mirror image (about u=0) of the solution at the point L x and time t, where 0<ct<L. Step 4: Show that the maximum value of u(x, t) occurs at x=ct, where 0<x<L and when 0<ct<L. At that point, The Wave Equation 607 where umax equals the largest magnitude of u(x, t) for any time t. Plot umax as a function x and show that it a parabola. Hint: Find the maximum value of u(x, t) when 0<x ct and ct x<L with 0<x+ct<L or L<x+ct<2L. 10.5 THE LAPLACE TRANSFORM METHOD The solution of linear partial differential equations by Laplace transforms is the most commonly employed analytic technique after separation of variables. Because the transform consists solely of an integration with respect to time, the transform U(x, s) of the solution of the wave equation u(x, t) is (10.5.1) assuming that the wave equation only varies in a single spatial variable x and time t. Partial derivatives involving time have transforms similar to those that we encountered in the case of functions of a single variable. They include (10.5.2) and (10.5.3) These transforms introduce the initial conditions via u(x, 0) and ut(x, 0). On the other hand, derivatives involving x become (10.5.4) and (10.5.5) Because the transformation eliminates the time variable, only U(x, s) and its derivatives remain in the equation. Consequently, we transform the partial differential equation into a 608 Advanced Engineering Mathematics with MATLAB boundary-value problem involving an ordinary differential equation. Because this equation is often easier to solve than a partial differential equation, the use of Laplace transforms considerably simplifies the original problem. Of course, the Laplace transforms must exist for this technique to work. The following schematic summarizes the Laplace transform method: In the following examples, we illustrate transform methods by solving the classic equation of telegraphy as it applies to a uniform transmission line. The line has a resistance R, an inductance L, a capacitance C, and a leakage conductance G per unit length. We denote the current in the direction of positive x by I; V is the voltage drop across the transmission line at the point x. The dependent variables I and V are functions of both distance x along the line and time t. To derive the differential equations that govern the current and voltage in the line, consider the points A at x and B at x+ x in Figure 10.5.1. The current and voltage at A are I(x, t) and V(x, t); at B, to B is and the and Therefore, the voltage drop from A Figure 10.5.1: Schematic of an uniform transmission line. The Wave Equation 609 current in the line is Neglecting terms that are proportional to ( x)2, (10.5.6) The voltage drop over the parallel portion HK of the line is V while the current in this portion of the line is Thus, (10.5.7) Therefore, the differential equations for I and V are (10.5.8) and (10.5.9) Turning to the initial conditions, we solve these simultaneous partial differential equations with the initial conditions I(x, 0)=I0(x), (10.5.10) and V(x, 0)=0(x) (10.5.11) for 0<t. There are also boundary conditions at the ends of the line; we will introduce them for each specific problem. For example, if the line is shortcircuited at x=a, V=0 at x=a; if there is an open circuit at x=a, I=0 at x=a. To solve (10.5.8)(10.5.9) by Laplace transforms, we take the Laplace transform of both sides of these equations, which yields 610 Advanced Engineering Mathematics with MATLAB (10.5.12) and (10.5.13) Eliminating gives an ordinary differential equation in (10.5.14) where q2=(Ls+R)(Cs+G). After finding we may compute from (10.5.15) At this point we treat several classic cases. Example 10.5.1: The semi-infinite transmission line We consider the problem of a semi-infinite line 0<x with no initial current and charge. The end x=0 has a constant voltage E for 0<t. In this case, (10.5.16) The boundary conditions at the ends of the line are V(0, t)=E, 0<t, (10.5.17) and V(x, t) is finite as x . The transform of these boundary conditions is (10.5.18) The Wave Equation 611 The general solution of (10.5.16) is (10.5.19) The requirement that remains finite as x at x=0 gives A=E/s. Thus, forces B=0. The boundary condition (10.5.20) We discuss the general case later. However, for the so-called "lossless" line, where R=G=0, (10.5.21) where Consequently, (10.5.22) where H(t) is Heaviside's step function. The physical interpretation of this solution is as follows: V(x, t) is zero up to the time x/c at which time a wave traveling with speed c from x=0 would arrive at the point x. V(x, t) has the constant value E afterwards. For the so-called "distortionless" line,14 R/L=G/C= , (10.5.23) In this case, the disturbance not only propagates with velocity c but also attenuates as we move along the line. Suppose now, that instead of applying a constant voltage E at x=0, we apply a time-dependent voltage, f(t). The only modification is that in place of (10.5.20), (10.5.24) 14 Prechtl and Schrhuber [Prechtl, A., and R.Schrhuber, 2000: Nonuniform distortionless transmission lines. Electr. Engng, 82, 127134] have generalized this problem to nonuniform transmission lines. 612 Advanced Engineering Mathematics with MATLAB In the case of the distortionless line, q=(s+ )/c, this becomes (10.5.25) and (10.5.26) Thus, our solution shows that the voltage at x is zero up to the time x/c. Afterwards V(x, t) follows the voltage at x=0 with a time lag of x/c and decreases in magnitude by e px/c. Example 10.5.2: The finite transmission line We now discuss the problem of a finite transmission line 0<x<l with zero initial current and charge. We ground the end x=0 and maintain the end x=l at constant voltage E for 0<t. The transformed partial differential equation becomes (10.5.27) Figure 10.5.2: The voltage within a lossless, finite transmission line of length l as a function of time t. The boundary conditions are V(0, t)=0, and V(l, t)=E, 0<t. (10.5.28) The Wave Equation 613 The Laplace transform of these boundary conditions is (10.5.29) The solution of (10.5.27) which satisfies the boundary conditions is (10.5.30) Let us rewrite (10.5.30) in a form involving negative exponentials and expand the denominator by the binomial theorem, (10.5.31) (10.5.32) (10.5.33) In the special case of the lossless line where q=s/c, (10.5.34 or (10.5.35 We illustrate (10.5.35) in Figure 10.5.2. The voltage at x is zero up to the time (t x)/c, at which time a wave traveling directly from the end x=l would reach the point x. The voltage then has the constant value E up to the time (l+x)/c, at which time a wave traveling from the end x=l and reflected back from the end x=0 would arrive. From this time up to the time of arrival of a twice-reflected wave, it has the value zero, and so on. 614 Advanced Engineering Mathematics with MATLAB Figure 10.5.3: The voltage within a submarine cable as a function of distance for various values of t. Example 10.5.3: The semi-infinite transmission line reconsidered In the first example, we showed that the transform of the solution for the semi-infinite line is (10.5.36) where q2=(Ls+R)(Cs+G). In the case of a lossless line (R=G=0), we found traveling wave solutions. In this example, we shall examine the case of a submarine cable,15 where L=G=0. In this special case, (10.5.37) where =1/(RC). From a table of Laplace transforms,16 we can immediately invert (10.5.37) and find that (10.5.38) where erfc is the complementary error function. Unlike the traveling wave solution, the voltage diffuses into the cable as time increases. We illustrate (10.5.38) in Figure 10.5.3. 15 16 First solved by Thomson, W., 1855: On the theory of the electric telegraph. Proc. R. Soc. London, Ser. A, 7, 382399. See Churchill, R. 1972: Operational Mathematics. McGraw-Hill Book, 27. The Wave Equation 615 Example 10.5.4: A short-circuited, finite transmission line Let us find the voltage of a lossless transmission line of length l that initially has the constant voltage E. At t=0, we ground the line at x=0 while we leave the end x=l insulated. The transformed partial differential equation now becomes (10.5.39) where The boundary conditions are (10.5.40) and (10.5.41) from (10.5.15). The solution to this boundary-value problem is (10.5.42) The first term on the right side of (10.5.42) is easy to invert and the inversion equals E. The second term is much more difficult to handle. We will use Bromwich's integral. In 6.10 we showed that (10.5.43) 616 Advanced Engineering Mathematics with MATLAB To evaluate this integral we must first locate and then classify the singularities. Using the product formula for the hyperbolic cosine, (10.5.44) This shows that we have an infinite number of simple poles located at z=0, and zn=(2n 1) ci/(2l), where n=1, 2, 3,.... Therefore, Bromwich's contour can lie along, and just to the right of, the imaginary axis. By Jordan's lemma we close the contour with a semicircle of infinite radius in the left half of the complex plane. Computing the residues, (10.5.45) and (10.5.46) (10.5.47) (10.5.48) Summing the residues and using the relationship that cos(t)=(eti+e ti)/2, (10.5.49) (10.5.50) The Wave Equation 617 An alternative to contour integration is to rewrite (10.5.42) as (10.5.51) (10.5.52) so that (10.5.53) Example 10.5.5: The general solution of the equation of telegraphy In this example we solve the equation of telegraphy without any restrictions on R, C, G, or L. We begin by eliminating the dependent variable I(x, t) from the set of equations (10.5.8)(10.5.9). This yields (10.5.54) We next take the Laplace transform of (10.5.54) assuming that V(x, 0)=f(x), and Vt(x, 0)=g(x). The transformed version of (10.5.54) is (10.5.55) or (10.5.56) where c2=1/LC, =c2(RC+GL)/2, and =c2(RC GL)/2. We solve (10.5.56) by Fourier transforms (see 5.6) with the requirement that the solution dies away as |x| . The most convenient way of expressing this solution is the convolution product (see 5.5) 618 Advanced Engineering Mathematics with MATLAB (10.5.57) From a table of Laplace transforms, (10.5.58) where b>0 and I0( ) is the zeroth order modified Bessel function of the first kind. Therefore, by the first shifting theorem, (10.5.59) Using (10.5.59) to invert (10.5.57), we have that (10.5.60) The last term in (10.5.60) arises from noting that explicitly write out the convolution, the final form of the solution is If we (10.5.61) The Wave Equation 619 Figure 10.5.4: The evolution of the voltage with time given by the general equation of telegraphy for initial conditions and parameters stated in the text. The physical interpretation of the first line of (10.5.61) is straightforward. It represents damped progressive waves; one is propagating to the right and the other to the left. In addition to these progressive waves, there is a contribution from the integrals, even after the waves pass. These integrals include all of the points where f(x) and g(x) are nonzero within a distance ct from the point in question. This effect persists through all time, although dying away, and constitutes a residue or tail. Figure 10.5.4 illustrates this for =0.1, =0.2, and c=1. This figure was obtained using the MATLAB script: % initialize parameters in calculation clear; dx = 0.1; dt = 0.5; rho_over_c = 0.1; sigma_over_c = 0.2; % X=[-10:dx:10]; T = [0:dt:10]; % compute locations of x and t % for j=1:length (T); t = T(j); for i=1:length (X); x = X(i); XX(i, j ) = x; TT(i, j) = t; deta_i = 0.05 % set up grid % % compute characteristics x+ct and x-ct % characteristic_1 = x - t; characteristic_2 = x + t; % % compute first term in (10.5.61) 620 Advanced Engineering Mathematics with MATLAB % F = inline('stepfun(x,-1.0001)-stepfun(x, 1.0001)'); u(i, j ) = F(characteristic_1) + F(characteristic_2); % % find the upper and lower limits of the integration % upper = characteristic_2; lower = characteristic_1; % if t > 0 & upper > -1 & lower < 1 if upper > 1 upper = 1; end if lower < -1 lower = -1; end % % set up parameters needed for integration % interval = upper-lower ; NN = interval / deta_i; if mod(NN,2) > 0 NN = NN + 1; end; deta = interval / NN; % % compute integrals in (10.5.61) by Simpson's rule % sum1 deals with the first integral while sum2 is the second % sum1 = 0; sum2 = 0; eta = lower; for k = 0:2:NN-2 arg = sigma_over_c * sqrt(t*t-(x-eta)*(x-eta)); sum1 = sum1 + besseli(0, arg); if (arg = = 0) sum2 = sum2 + 0.5 * sigma_over_c * t; else sum2 = sum2 + t * besse1i(1, arg) / arg; end eta = eta + deta; arg = sigma_over_c * sqrt(t*t-(x-eta)*(x-eta)); sum1 = sum1 + 4*besseli(0, arg); if (arg == 0) sum2 = sum2 + 4 * 0.5 * sigma_over_c * t; else sum2 = sum2 + 4 * t * besseli(1, arg) / arg; end eta = eta + deta; arg = sigma_over_c * sqrt(t*t-(x-eta)*(x-eta)); sum1 = sum1 + besseli(0, arg); if (arg == 0) sum2 = sum2 + 0.5 * sigma_over_c * t; else sum2 = sum2 + t * besse1i(1, arg) / arg; end end u(i, j) = u(i, j) + 2 * rho_over_c * deta * sum1 / 3 ... + sigma_over_c * deta * sum2 / 3; end % % multiply final answer by damping coefficient % u(i, j) = 0.5 * exp(-rho_over_c * t) * u (i, j); % end;end; % % plot results The Wave Equation 621 % mesh(XX,TT,real (u)); colormap spring; xlabel('DISTANCE',' Fontsize',20); ylabel('TIME','Fontsize',20) zlabel('SOLUTION','Fontsize',20) We evaluated the integrals by Simpson's rule for the initial conditions f(x)= H(x+1) H(x 1), and g(x)=0. If there was no loss, then two pulses would propagate to the left and right. However, with resistance and leakage the waves leave a residue after their leading edge has passed. Example 10.5.6: Cutoff frequency A powerful method for solving certain partial differential equations is the joint application of Laplace and Fourier transforms. To illustrate this joint transform method, let us find the Green's function for the Klein-Gordon equation (10.5.62) subject to the boundary condition limax u(x, 0)=ut(x, 0) 0, <x< . |u(x,t)|< , 0<t, and the initial conditions We begin by taking the Laplace transform of (10.5.62) and find that (10.5.63) with the boundary condition limx |U(x, s)|< . Assuming that the Fourier transform of U(x, s), (k, s), exists, we take the Fouier transform of (10.5.63) and obtain (10.5.64) or (10.5.65) where Inverting the Laplace transform first, we have that 622 Advanced Engineering Mathematics with MATLAB (10.5.66) Consequently, (10.5.67) (10.5.68) (10.5.69) where J0( ) is the zeroth order Bessel function of the first kind. Thus, forcing the KleinGorden equation by an impulse forcing yields waves that propagate to the right and left from x=0 with the wave front located at x=ct. At a given point, after the passage of the wave front, the solution vibrates with an ever decreasing amplitude and at a frequency that approaches a--the so-called cutoff frequency--at t . Why is a called a cutoff frequency? From (10.5.67), we see that, although the spectral representation includes all of the wavenumbers k running from ) to , the frequency is restrictred to the range a. Thus, a is the lowest possible frequency that a wave solution to the KleinGorden equation may have for a real value of k. Problems 1. Use transform methods to solve the wave equation with the boundary conditions u(0, t)=u(1, t)=0, 0<t, and the initial conditions u(x, 0)=0, ut(0, t)=1, 0<x<1. 2. Use transform methods to solve the wave equation with the boundary conditions u(0, t)=ux(1, t)=0, 0<t, and the initial conditions u(x, 0)=0, ut(0, t)=x, 0<x<1. The Wave Equation 623 3. Use transform methods to solve the wave equation with the boundary conditions u(0, t)=u(1, t)=0, 0<t, and the initial conditions u(x, 0)=sin( x), ut(x, 0)= sin( x), 0<x<1. 4. Use transform methods to solve the wave equation with the boundary conditions u(0, t)=sin( t), u(a, t)=0, 0<t, and the initial conditions u(x, 0)=ut(x, 0)=0, 0<x<a. Assume that a/c is not an integer multiple of . Why? 5. Use transform methods to solve the wave equation with the boundary conditions ux(0, t)= f(t), ux(L, t)=0, 0<t, and the initial conditions u(x, 0)=ut(x, 0)=0, 0<x<L. Hint: Invert the Laplace transform following the procedure used in Example 10.5.2. 6. Use transform methods to solve the wave equation with the boundary conditions u(a, t)=0, ux(b, t)=0, 0<t, and the initial conditions u(x, 0)=0, ut(x, 0)= q(0), a<x<b. Hint: To find U(x, s), express both U(x, s) and the right side of the ordinary differential equation governing U(x, s) in an eigenfunction expansion using sin{(2n+1) (x a)/[2(b a)]}. These eigenfunctions satisfy the boundary conditions. 7. Use transform methods to solve the wave equation with the boundary conditions and the initial conditions u(x, 0)=0, ut(x, 0)=x, 0<x< . 624 Advanced Engineering Mathematics with MATLAB 8. Use transform methods to solve the wave equation with the boundary conditions and the initial conditions u(x,0)=1, ut(x, 0)=0, 0<x< . 9. Use transform methods to solve the wave equation with the boundary conditions and the initial conditions u(x, 0)=ut(x, 0)=0, 0<x<L, where k, m, and g are constants. 10. Use transform methods17 to solve the wave equation with the boundary conditions and the initial conditions u(x, 0)=ut(x, 0)=0, 0<x<1. Assume that 2 J0( n)=0. [Hint: The ordinary differential equation c n, where has the solution 17 Suggested by a problem solved by Brown, J., 1975: Stresses in towed cables during re-entry. J. Spacecr. Rockets, 12, 524527. The Wave Equation 625 where I0(x) and k0(x) are modified Bessel functions of the first and second kind, respectively. Note that Jn(iz)=inIn(z) and In(iz)=injn(z) for complex z.] 11. A lossless transmission line of length has a constant voltage E applied to the end x=0 while we insulate the other end [Vx (, t)=0]. Find the voltage at any point on the line if the initial current and charge are zero. 12. Solve the equation of telegraphy without leakage subject to the boundary conditions u(0, t)=0, u(, t)=E, 0<t, and the initial conditions u(x, 0)=ut(x, 0)=0, 0<x<. Assume that 4 2L/CR22>1. Why? 13. The pressure and velocity oscillations from water hammer in a pipe without friction18 are given by the equations where p(x, t) denotes the pressure perturbation, u(x, t) is the velocity perturbation, c is the speed of sound in water, and is the density of water. These two first-order partial differential equations can be combined to yield Find the solution to this partial differential equation if p(0, t)=p0, and u(L, t)=0, and the initial conditions are p(x, 0)=p0, Pt(x, 0)=0, and u(x, 0)=u0. 14. Use Laplace transforms to solve the wave equation19 subject to the boundary conditions that 18 19 See Rich, G.R., 1945: Water-hammer analysis by the Laplace-Mellin transformation. Trans. ASME, 67, 361376. Reprinted from Soil Dynam. Earthq. Engng., 5, J.P.Wolf and G.R.Darbre, Timedomain boundary element method in visco-elasticity with application to a spherical cavity, 138 148, 1986, with permission from Elsevier Science. 626 Advanced Engineering Mathematics with MATLAB and the initial conditions that u(r, 0)=ut(r, 0)=0, a<r< . Hint: The homogeneous solution to the ordinary differential equation is 15. Use Laplace transforms to solve the wave equation 20 subject to the boundary conditions that where >0, and the initial conditions that u(r, 0)=ut(r, 0)=0, a<r< . 16. Consider a vertical rod or column of length L that is supported at both ends. The elastic waves that arise when the support at the bottom is suddenly removed are governed by the wave equation21 where g denotes the gravitational acceleration, c2=E/ , E is Young's modulus, and is the mass density. Find the wave solution if the boundary conditions are ux(0, t)=ux(L, t)=0, 0<t, and the initial conditions are 20 21 Originally solved using Fourier transforms by Sharpe, J.A., 1942: The production of elastic waves by explosion pressures. I. Theory and empirical field observations. Geophysics, 7, 144154. Abstracted with permission from Hall, L.H., 1953: Longitudinal vibrations of a vertical column by the method of Laplace transform. Am. J. Phys., 21, 287292. 1953 American Association of Physics Teachers. The Wave Equation 627 17. Use Laplace transforms to solve the hyperbolic equation subject to the boundary conditions that ux(0, t) 0, ux(1, t)=1, 0<t, and the initial conditions that u(x, 0)=ut(x, 0)=0, 0<x<1. 18. Solve the telegraph-like equation22 subject to the boundary conditions and the initial conditions u(x, 0)=u0, ut(x, 0)=0, 0<x< , with c>k. Step 1: Take the Laplace transform of the partial differential equation and boundary conditions and show that with U (0, s)= u0, and limx |U(x, s)|< . Step 2: Show that the solution to the previous step is 22 From Abbott, M.R., 1959: The downstream effect of closing a barrier across an estuary with particular reference to the Thames. Proc. R. Soc. London, Ser. A, 251, 426439 with permission. 628 Advanced Engineering Mathematics with MATLAB where 4a2=a2c2 k2>0. Step 3: Using the first and second shifting theorems and the property that show that u(x, t)=u0+u0ce kt 2 / H(t x/c) 19. As an electric locomotive travels down a track at the speed V, the pantograph (the metallic framework that connects the overhead power lines to the locomotive) pushes up the line with a force P. Let us find the behavior23 of the overhead wire as a pantograph passes between two supports of the electrical cable that are located a distance L apart. We model this system as a vibrating string with a point load: Let us assume that the wire is initially at rest [u(x, 0)=ut(x, 0)=0 for 0<x<L] and fixed at both ends [u(0, t)=u(L, t)=0 for 0<t]. Step 1: Take the Laplace transform of the partial differential equation and show that 23 From Oda, O., and Y.Ooura, 1976: Vibrations of catenary overhead wire. Q. Rep., (Tokyo) Railway Tech. Res. Inst., 17, 134135 with permission. The Wave Equation 629 Step 2: Solve the ordinary differential equation in Step 1 as a Fourier halfrange sine series where an=n c/L and n =n V/L. This solution satisfies the boundary conditions. Step 3: By inverting the solution in Step 2, show that or The first term in both summations represents the static uplift on the line; this term disappears after the pantograph passes. The second term in both summations represents the vibrations excited by the traveling force. Even after the pantograph passes, they continue to exist. 20. Solve the wave equation 630 Advanced Engineering Mathematics with MATLAB where 0< <a, subject to the boundary conditions and the initial conditions u(r, 0)=ut(r, 0)=0, 0 r<a. Step 1: Take the Laplace transform of the partial differential equation and show that with Step 2: Show that the Dirac delta function can be reexpressed as the FourierBessel series where n is the nth root of and J0( ) ,J1( ) are the zeroth and first-order Bessel functions of the first kind, respectively. Step 3: Show that solution to the ordinary differential equation in Step 1 is Note that this solution satisfies the boundary conditions. Step 4: Taking the inverse of the Laplace transform in Step 3, show that the solution to the partial differential equation is 21. Solve the hyperbolic equation The Wave Equation 631 subject to the boundary conditions u(0, t)=e t, limx |u(x, t)|< , 0<t, and u(x, 0)=1, limt |u(x, t)|<Mekt, 0<k, M, x, t. Step 1: Take the Laplace transform of the partial differential equation and show that Step 2: Show that Step 3: Using tables and the convolution theorem, show that the solution is where J0( ) is the Bessel function of the first kind and order zero. 22. Solve the hyperbolic equation subject to the boundary conditions u(0, t)=ect, limx |u(x, t)|< , 0<t, and u(x, 0)=1, limt |u(x, t)|<Mekt, 0<k, M, t, x. Step 1: Take the Laplace transform of the partial differential equation and show that Step 2: Show that Step 3: Using tables, the first shifting theorem, and the convolution theorem, show that the solution is where I0( ) is the modified Bessel function of the first kind and order zero. 632 Advanced Engineering Mathematics with MATLAB 10.6 NUMERICAL SOLUTION OF THE WAVE EQUATION Despite the powerful techniques shown in the previous sections for solving the wave equation, often these analytic techniques fail and we must resort to numerical techniques. In contrast to the continuous solutions, finite difference methods, a type of numerical solution technique, give discrete numerical values at a specific location (xm, tn), called a grid point. These numerical values represent a numerical approximation of the continuous solution over the region (xm x/2, xm+ x/2) and (tn t/2, tn+ t/2), where x and t are the distance and time intervals between grid points, respectively. Clearly, in the limit of x, t0, we recover the continuous solution. However, practical considerations such as computer memory or execution time often require that x and t, although small, are not negligibly small. The first task in the numerical solution of a partial differential equation is the replacement of its continuous derivatives with finite differences. The most popular approach employs Taylor expansions. If we focus on the x-derivative, then the value of the solution at u[(m+1) x, n t] in terms of the solution at (m x, n t) is (10.6.1) (10.6.2) where O[( x)2] gives a measure of the magnitude of neglected terms.24 From (10.6.2), one possible approximation for ux is (10.6.3) where we use the standard notation that This is an example of a one-sided finite difference approximation of the partial derivative ux. The error in using this approximation grows as x. 24 The symbol O is a mathematical notation indicating relative magnitude of terms, namely that For example, as provided lim and The Wave Equation 633 Another possible approximation for the derivative arises from using u(m x, n t) and u[(m 1) x, n t]. From the Taylor expansion: (10.6.4) we can also obtain the one-sided difference formula (10.6.5) A third possibility arises from subtracting (10.6.4) from (10.6.1): (10.6.6) or (10.6.7) Thus, the choice of the finite differencing scheme can produce profound differences in the accuracy of the results. In the present case, centered finite differences can yield results that are markedly better than using one-sided differences. To solve the wave equation, we need to approximate uxx. If we add (10.6.1) and (10.6.4), (10.6.8) 634 Advanced Engineering Mathematics with MATLAB or (10.6.9) Similar considerations hold for the time derivative. Thus, by neglecting errors of O[( x)2] and O[( t)2], we may approximate the wave equation by (10.6.10 Because the wave equation represents evolutionary change of some quantity, (10.6.10) is generally used as a predictive equation where we forecast by (10.6.11) Figure 10.6.1: Schematic of the numerical solution of the wave equation with fixed end points. Figure 10.6.1 illustrates this numerical scheme. The greatest challenge in using (10.6.11) occurs with the very first prediction. When and n=0, clearly 0)=f(xm). But what about are specified from the initial condition u(m x, Recall that we still have ut(x, 0)=g(x). If we use the backward difference formula (10.6.5), The Wave Equation 635 (10.6.12) Solving for (10.6.13) One disadvantage of using the backward finite-difference formula is the larger error associated with this term compared to those associated with the finite-differenced form of the wave equation. In the case of the barotropic vorticity equation, a partial differential equation with wave-like solutions, this inconsistency eventually leads to a separation of solution between adjacent time levels.25 This difficulty is avoided by stopping after a certain number of time steps, averaging the solution, and starting again. A better solution for computing that first time step employs the centered difference form (10.6.14) along with the wave equation (10.6.15) so that (10.6.16) Although it appears that we are ready to start calculating, we need to check whether our numerical scheme possesses three properties: convergence, stability, and consistency. By consistency we mean that the difference equations approach the differential equation as x, t0. To prove consistency, we first write and u(x, t) and its derivatives evaluated at (xm, tn). From Taylor expansions, in terms of 25 Gates, W.L., 1959: On the truncation error, stability, and convergence of difference solutions of the barotropic vorticity equation. J. Meteorol, 16, 556568. See 4. 636 Advanced Engineering Mathematics with MATLAB (10.6.17) (10.6.18) (10.6.19) and (10.6.20) Substituting (10.6.17)(10.6.20) into (10.6.10), we obtain (10.6.21) The first term on the right side of (10.6.21) vanishes because u(x, t) satisfies the wave equation. As x0, t0, the remaining terms on the right side of (10.6.21) tend to zero and (10.6.10) is a consistent finite difference approximation of the wave equation. Stability is another question. Under certain conditions the small errors inherent in fixed precision arithmetic (round off) can grow for certain choices of x and t. During the 1920s the mathematicians Courant, Friedrichs, and Lewy26 found that if c t/ x>1, then our scheme is unstable. This CFL criterion has its origin in the fact that if c t> x, then we are asking signals in the numerical scheme to travel faster than their real-world counterparts and this unrealistic expectation leads to instability! One method of determining stability, commonly called the von Neumann method,27 involves examining solutions to (10.6.11) that have the form (10.6.22) 26 Courant, R., K.O.Friedrichs, and H.Lewy, 1928: ber die partiellen Differenzengleichungen der mathematischen Physik. Math. Annalen, 100, 3274. Translated into English in IBM J. Res. De ., 11, 215234. After its inventor, J.von Neumann. See O'Brien, G.G., M.A.Hyman, and S.Kaplan, 1950: A study of the numerical solution of partial differential equations. J. Math. Phys. (Cambridge, MA), 29, 223251. 27 The Wave Equation 637 where is an arbitrary real number and is a yet undetermined complex number. Our choice of (10.6.22) is motivated by the fact that the initial condition can be represented by a Fourier series where a typical term behaves as eim . If we substitute (10.6.22) into (10.6.10) and divide out the common factor eim ein we have that (10.6.23) or (10.6.24) The behavior of is determined by the values of given by (10.6.24). If c t/ x<1, then is real and is bounded for all as n . If c t/ x>1, then it is possible to find a value of such that the right side of (10.6.24) exceeds unity and the corresponding values of occur as complex conjugate pairs. The with the negative imaginary part produces a solution with exponential growth because n=tn/ t as t0 for a fixed tn and c t/ x. Thus, the value of becomes infinitely large, even though the initial data may be arbitrarily small. Finally, we must check for convergence. A numerical scheme is convergent if the numerical solution approaches the continuous solution as x, t0. The general procedure for proving convergence involves the evolution of the error term which gives the difference between the true solution u(xm, tn) and the finite difference solution From (10.6.21), (10.6.25) 638 Advanced Engineering Mathematics with MATLAB Figure 10.6.2: The growth of error ||en|| as a function of ct for various resolutions. For the top line, x=0.1; for the middle line, x=0.01; and for the bottom line, x=0.001. Let us apply (10.6.25) to work backwards from the point (xm, tn) by changing n to n 1. The nonvanishing terms in reduce to a sum of n+1 values on the line terms of the form A( x)4. If we define the max norm then (10.6.26) Because n x<ctn, (10.6.26) simplifies to (10.6.27) Thus, the error tends to zero as x0, verifying convergence. We illustrate (10.6.27) by using the finite difference equation (10.6.11) to compute during a numerical experiment that used c t/ x=0.5, f(x)=sin( x), and is plotted in Figure 10.6.2. Note how each increase of resolution by 10 results in a drop in the error by 100. In the following examples we apply our scheme to solve a few simple initial and boundary conditions: The Wave Equation 639 Example 10.6.1 For our first example, we resolve (10.3.1)(10.3.3) and (10.3.25)(10.3.26) numerically using MATLAB. The MATLAB code is clear coeff = 0.5; coeffsq = coeff * coeff % coeff = c t/ x dx = 0.04; dt = coeff * dx; N = 100; x = 0:dx:1; M = 1/dx + 1; % M = number of spatial grid points % introduce the initial conditions via F and G F = zeros (M, 1) ; G = zeros(M, 1); for m = 1:M if x(m) >= 0.25 & x(m) <= 0.5 F(m) = 4 * x(m) 1; end if x(m) >= 0.5 & x(m) <= 0.75 F(m) = 34 * x(m); end; end % at t = 0, the solution is: tplot(1) = 0; u = zeros (M,N+1) ; u(1:M, 1) = F(1:M); % at t = t, the solution is given by (10.6.16) tplot (2) = dt; for m = 2:M 1 u (m, 2) = 0.5 * coeffsq * (F(m+1) + F(m 1)) ... + (1 coeffsq) * F(m) + dt * G(m) ; end % in general, the solution is given by (10.6.11) for n = 2:N tplot(n+1) = dt * n; for m = 2:M 1 u(m,n+1) = 2 * u(m,n) u(m,n 1) ... + coeffsq * (u(m+1,n) 2 * u(m,n) + u(m 1,n) ); end; end X = x' * ones (1,length (tplot)) ; T = ones M, 1) * tplot; surf (X,T,u) xlabel('DISTANCE','Fontsize',20) ylabel ('TIME','Fontsize',20 ) ; zlabel('SOLUTION','Fontsize',20) Overall, the numerical solution shown in Figure 10.6.3 approximates the exact or analytic solution well. However, we note small-scale noise in the numerical solution at later times. Why does this occur? Recall that the exact solution could be written as an infinite sum of sines in the x dimension. Each successive harmonic adds a contribution from waves of shorter and shorter wavelength. In the case of the numerical solution, the longerwavelength harmonics are well represented by the numerical scheme because there are many grid points available to resolve a given wavelength. As the wavelengths become shorter, the higher harmonics are poorly resolved by the numerical scheme, move at incorrect phase speeds, and their misplacement (dispersion) creates the smallscale noise that you observe rather than giving the sharp angular features of the exact solution. The only method for avoiding this problem is to devise schemes that minimize dispersion. 640 Advanced Engineering Mathematics with MATLAB Example 10.6.2 Let us redo Example 10.6.1 except that we introduce the boundary condition that ux(L, t)=0. This corresponds to a string where we fix the left end and allow the right end to freely move up and down. This requires a Figure 10.6.3: The numerical solution u(x, t)/h of the wave equation with using (10.6.11) at various positions x =x/L and times t =ct/L. The exact solution is plotted in Figure 10.3.2. new difference condition along the right boundary. If we employ centered differencing, (10.6.28) and (10.6.29) Eliminating between between (10.6.28)(10.6.29), (10.6.30) The Wave Equation 641 For the special case of n=1, (10.6.30) becomes (10.6.31) The MATLAB code used to numerically solve the wave equation with a Neumann boundary condition is very similar to the one used in the previous example that we must add the line u (M, 2) = coeffsq * F (M-1) + (1-coeffsq) * F (M) + dt*G (M); after Figure 10.6.4: The numerical solution u(x, t)/h of the wave equation when the right end moves freely with using (10.6.11) and (10.6.30) at various positions x =x/L and times t =ct/L. for m = 2:M-1 u(m, 2) = 0.5 * coeffsq * (F(m+1) + F(m-1)) ... + (1 - coeffsq) * F(m) + dt * G(m); end and u(M,n+1) = 2 * u(M, n) -u(M,n-1) ... + 2 * coeffsq * (u(M-1,n)-u(M,n)); after for m = 2:M-1 u(m,n+1) = 2 * u(m,n) - u(m,n-1) ... + coeffsq * (u(m+1,n) - 2 * u(m,n) + u(m-1,n)); end Figure 10.6.4 shows the results. The numerical solution agrees well with the exact solution 642 Advanced Engineering Mathematics with MATLAB (10.6.32 The results are also consistent with those presented in Example 10.6.1, especially with regard to small-scale noise due to dispersion. Figure 10.6.5: The numerical solution u(x, t) of the first-order hyperbolic partial differential equation ut+ux=0 using the Lax-Wendroff formula as observed at t=0, 1, 2,..., 20. The initial conditions are given by (10.3.25) with h=1, and x=0.02. Project: Numerical Solution of First-Order Hyperbolic Equations The equation ut+ux=0 is the simplest possible hyperbolic partial differential equation. Indeed the classic wave equation consists of a system of these equations: ut+c x=0, and partial differential equation using MATLAB. Step 1: One of the simplest numerical schemes is the forward-in-time, center ed-in-space of t +cux=0. In this project you will examine several numerical schemes for solving such a Use von Neumann's stability analysis to show that this scheme is always unstable. Step 2: The most widely used method for numerically integrating first-order hyperbolic equations is the Lax- Wendroff method:28 28 Lax, P.D., and B.Wendroff, 1960: Systems of conservative laws. Comm. Pure Appl. Math., 13, 217237. The Wave Equation 643 Figure 10.6.6: Same as Figure 10.6.5 except that the centered-in-time, centeredin-space scheme was used. This method introduces errors of O[( t)2] and O[( x)2]. Show that this scheme is stable if it satisfies the CFL criteria of t/ x 1. Using the initial condition given by (10.3.25), write a MATLAB code that uses this scheme to numerically integrate ut+ux=0. Plot the results for various t/ x over the interval 0 x 1 given the periodic boundary conditions of u(0, t)=u(1, t) for the temporal interval 0 t 20. Discuss the strengths and weaknesses of the scheme with respect to dissipation or damping of the numerical solution and preserving the phase of the solution. Most numerical methods books discuss this.29 Step 3: Another simple scheme is the centered-in-time, centered-in-space of This method introduces errors of O[( t)2] and O[( x)2]. Repeat the analysis from Step 1 for this scheme. One of the difficulties is taking the first time step. Use the scheme in Step 1 to take this first time step. 29 For example, Lapidus, L., and G.F.Pinder, 1982: Numerical Solution of Partial Differential Equations in Science and Engineering. John Wiley &; Sons, 677 pp. Chapter 11 The Heat Equation In this chapter we deal with the linear parabolic differential equation (11.0.1) in the two independent variables x and t. This equation, known as the onedimensional heat equation, serves as the prototype for a wider class of parabolic equations (11.0.2) where b2=4ac. It arises in the study of heat conduction in solids as well as in a variety of diffusive phenomena. The heat equation is similar to the wave equation in that it is also an equation of evolution. However, the heat equation is not "conservative" because if we reverse the sign of t, we obtain a different solution. This reflects the presence of entropy which must always increase during heat conduction. Figure 11.1.1: Heat conduction in a thin bar. 11.1 DERIVATION OF THE HEAT EQUATION To derive the heat equation, consider a heat-conducting homogeneous rod, extending from x=0 to x=L along the x-axis (see Figure 11.1.1). The rod has uniform cross section A and constant density , is insulated laterally so that heat flows only in the x-direction, and is sufficiently thin so that the temperature at all points on a cross section is constant. Let u(x, t) denote the temperature of the cross section at the point x at any instant of time t, and let c denote the specific heat of the rod (the amount of heat required to raise the temperature of a unit mass of the rod by a degree). In the segment of the rod between the cross section at x and the cross section at x+ x, the amount of heat is 646 Advanced Engineering Mathematics with MATLAB (11.1.1) On the other hand, the rate at which heat flows into the segment across the cross section at x is proportional to the cross section and the gradient of the temperature at the cross section (Fourier's law of heat conduction): (11.1.2) where denotes the thermal conductivity of the rod. The sign in (11.1.2) indicates that heat flows in the direction of decreasing temperature. Similarly, the rate at which heat flows out of the segment through the cross section at x+ x equals (11.1.3) The difference between the amount of heat that flows in through the cross section at x and the amount of heat that flows out through the cross section at x+ x must equal the change in the heat content of the segment x s x+ x. Hence, by subtracting (11.1.3) from (11.1.2) and equating the result to the time derivative of (11.1.1), (11.1.4) Assuming that the integrand in (11.1.4) is a continuous function of s, then by the mean value theorem for integrals, (11.1.5) so that (11.1.4) becomes (11.1.6) The Heat Equation 647 Dividing both sides of (11.1.6) by c x and taking the limit as x0, (11.2.7) with a2= /(cp). Equation (11.1.7) is called the one-dimensional heat equation. The constant a2 is called the diffusivity within the solid. If an external source supplies heat to the rod at a rate f(x, t) per unit volume per unit time, we must add the term in the limit x0, f (s, t) ds to the time derivative term of (11.1.4). Thus, (11.1.8) where F(x, t)=f(x, t)/(c ) is the source density. This equation is called the nonhomogeneous heat equation. 11.2 INITIAL AND BOUNDARY CONDITIONS In the case of heat conduction in a thin rod, the temperature function u(x, t) must satisfy not only the heat equation (11.1.7) but also how the two ends of the rod exchange heat energy with the surrounding medium. If (1) there is no heat source, (2) the function f(x), 0<x<L, describes the temperature in the rod at t=0, and (3) we maintain both ends at zero temperature for all time, then the partial differential equation (11.2.1) describes the temperature distribution u(x, t) in the rod at any later time 0<t subject to the conditions u(x, 0)=f(x), 0<x<L, (11.2.2) and u(0, t)=u(L, t)=0, 0<t. (11.2.3) Equations (11.2.1)(11.2.3) describe the initial-boundary-value problem for this particular heat conduction problem; (11.2.3) is the boundary condition while (11.2.2) 648 Advanced Engineering Mathematics with MATLAB gives the initial condition. Note that in the case of the heat equation, the problem only demands the initial value of u(x, t) and not ut(x, 0), as with the wave equation. Historically most linear boundary conditions have been classified in one of three ways. The condition (11.2.3) is an example of a Dirichlet problem1 or condition of the first kind. This type of boundary condition gives the value of the solution (which is not necessarily equal to zero) along a boundary. The next simplest condition involves derivatives. If we insulate both ends of the rod so that no heat flows from the ends, then according to (11.1.2) the boundary condition assumes the form (11.2.4) This is an example of a Neumann problem2 or condition of the second kind. This type of boundary condition specifies the value of the normal derivative (which may not be equal to zero) of the solution along the boundary. Finally, if there is radiation of heat from the ends of the rod into the surrounding medium, we shall show that the boundary condition is of the form (11.2.5) and (11.2.6) for 0<t, where h is a positive constant. This is an example of a condition of the third kind or Robin problem3 and is a linear combination of Dirichlet and Neumann conditions. 11.3 SEPARATION OF VARIABLES As with the wave equation, the most popular and widely used technique for solving the heat equation is separation of variables. Its success depends on our ability to express the solution u(x, t) as the product X(x)T(t). If we cannot achieve this separation, then the technique must be abandoned for others. In the following examples we show how to apply this technique. 1 Dirichlet, P.G.L., 1850: ber einen neuen Ausdruck zur Bestimmung der Dichtigkeit einer unendlich dnnen Kugelschale, wenn der Werth des Potentials derselben in jedem Punkte ihrer Oberflche gegeben ist. Abh. Kniglich. Preuss. Akad. Wiss., 99116. Neumann, C.G., 1877: Untersuchungen ber das Logarithmische und Newton'sche Potential. Robin, G., 1886: Sur la distribution de l'lectricit la surface des conducteurs ferms et des conducteurs ouverts. Ann. Sci. l'Ecole Norm. Sup., Ser. 3, 3, S1S58. 2 3 The Heat Equation 649 Example 11.3.1 Let us find the solution to the homogeneous heat equation (11.3.1) which satisfies the initial condition u(x, 0)=f(x), 0<x<L, (11.3.2) and the boundary conditions u(0, t)=u(L, t)=0, 0<t. (11.3.3) This system of equations models heat conduction in a thin metallic bar where both ends are held at the constant temperature of zero and the bar initially has the temperature f(x). We shall solve this problem by the method of separation of variables. Accordingly, we seek particular solutions of (11.3.1) of the form u(x, t)=X(x)T(t), (11.3.4) which satisfy the boundary conditions (11.3.3). Because (11.3.5) 650 Advanced Engineering Mathematics with MATLAB and (11.3.6) (11.3.1) becomes T (t)X(x)=a2X (x)T(t). (11.3.7) Dividing both sides of (11.3.7) by a2X(x)T(t) gives (10.3.8) where is the separation constant. Equation (11.3.8) immediately yields two ordinary differential equations: X + X=0, (11.3.9) and T+ 2 T=0 (11.3.10) for the functions X(x) and T(t), respectively. We now rewrite the boundary conditions in terms of X(x) by noting that the boundary conditions are u(0, t)=X(0)T(t)=0, and u(L, t)= X(L)T(t)=0 for 0<t. If we were to choose T(t)=0, then we would have a trivial solution for u(x, t). Consequently, X(0)=X(L)=0. We now solve (11.3.9). There are three possible cases: = m2, =0, and =k2. If = m2<0, then we must solve the boundary-value problem X m2X=0, x(0)=X(L)=0. (11.3.11) The general solution to (11.3.11) is X(x)=A cosh(mx)+B sinh(mx). (11.3.12) The Heat Equation 651 Because x(0)=0, it follows that A=0. The condition X(L)=0 yields B sinh(mL)=0. Since sinh(mL) 0, B=0, and we have a trivial solution for <0. If =0, the corresponding boundary-value problem is X (x)=0, X(0)=X(L)=0. (11.3.13) The general solution is X(x)=C+Dx. (11.3.14) From X(0)=0, we have that C=0. From X(L)=0, DL=0, or D=0. Again, we obtain a trivial solution. Finally, we assume that =k2>0. The corresponding boundary-value problem is X +k2X=0, X(0)=X(L)=0. (11.3.15) The general solution to (11.3.15) is X(x)=E cos(kx)+F sin(kx). (11.3.16) Because X(0)=0, it follows that E=0; from X(L)=0, we obtain F sin(kL)=0. For a nontrivial solution, F 0 and sin(kL)=0. This implies that knL=n , where n=1, 2, 3,.... In summary, the x-dependence of the solution is (11.3.17) where n =n2 2/L2. n Turning to the time dependence, we use =n2 2/L2 in (11.3.10) (11.3.18) 652 Advanced Engineering Mathematics with MATLAB The corresponding general solution is (11.3.19) Thus, the functions (11.3.20) where Bn=FnGn, are particular solutions of (11.3.1) and satisfy the homogeneous boundary conditions (11.3.3). As we noted in the case of the wave equation, we can solve the xdependence equation as a regular Sturm-Liouville problem. After finding the eigenvalue n and eigenfunction, we solve for Tn(t). The product solution un(x, t) equals the product of the eigenfunction and Tn(t). Having found particular solutions to our problem, the most general solution equals a linear sum of these particular solutions: (11.3.21) The coefficient Bn is chosen so that (11.3.21) yields the initial condition (11.3.2) if t=0. Thus, setting t=0 in (11.3.21), we see from (11.3.2) that the coefficients Bn must satisfy the relationship (11.3.22) This is precisely a Fourier half-range sine series for f(x) on the interval (0, L). Therefore, the formula (11.3.23) gives the coefficients Bn. For example, if L= and u(x, 0)=x( x), then (11.3.24) The Heat Equation 653 (11.3.25) (11.3.26) Hence, (11.3.27) Figure 11.3.1: The temperature u(x, t) within a thin bar as a function of position x and time a2t when we maintain both ends at zero and the initial temperature equals x( x). Figure 11.3.1 illustrates (11.3.27) for various times. It was created using the MATLAB script clear M = 20; dx = pi/25; dt = 0.05; % compute grid and initialize solution X = [0:dx:pi]; T = [0:dt:2]; u = zeros (length(T), length(X)); XX = repmat(X, [length (T) 1] ) ; TT = repmat (T' , [1 length (X)]); % compute solution from (11.3.27) 654 Advanced Engineering Mathematics with MATLAB for m = 1:M temp1 = 2*m-1; coeff = 8 / (pi * temp1 * temp1 * temp1) ; u = u + coeff * sin (temp1*XX) .* exp (-temp1 * temp1 * TT); end surf (XX,TT,u) xlabel ('DISTANCE','Fontsize',20); ylabel ('TIME','Fontsize',20) zlabel ('U(X, T)','Fontsize',20) Note that both ends of the bar satisfy the boundary conditions, namely that the temperature equals zero. As time increases, heat flows out from the center of the bar to both ends where it is removed. This process is reflected in the collapse of the original parabolic shape of the temperature profile toward zero as time increases. Example 11.3.2 As a second example, let us solve the heat equation (11.3.28) which satisfies the initial condition u(x, 0)=x, 0<x<L, (11.3.29) and the boundary conditions (11.3.30) The condition ux(0, t)=0 expresses mathematically the constraint that no heat flows through the left boundary (insulated end condition). Once again, we employ separation of variables; as in the previous example, the positive and zero separation constants yield trivial solutions. For a negative separation constant, however, X +k2X=0, (11.3.31) The Heat Equation 655 with X (0)=X(L)=0, (11.3.32) because ux(0, t)=X (0)T(t)=0, and u(L, t)=X(L)T(t)=0. This regular Sturm-Liouville problem has the solution (11.3.33) The temporal solution then becomes (11.3.34) Consequently, a linear superposition of the particular solutions gives the total solution which equals (11.3.35) Our final task remains to find the coefficients Bn. Evaluating (11.3.35) at t=0, (11.3.36) Equation (11.3.36) is not a half-range cosine expansion; it is an expansion in the orthogonal functions cos[(2n 1) x/(2L)] corresponding to the regular Sturm-Liouville problem (11.3.31)(11.3.32). Consequently, Bn is given by (9.3.4) with r(x)=1 as (11.3.37) (11.3.38) 656 Advanced Engineering Mathematics with MATLAB (11.3.39) (11.3.40) as cos[(2n 1) /2]=0, and sin[(2n 1) /2]=( 1)n+1. Consequently, the complete solution is (11.3.41) Figure 11.3.2 illustrates the evolution of the temperature field with time. It was generated using the MATLAB script clear M = 200; dx = 0.02; dt = 0.05; % compute fourier coefficients sign = -1; for m = 1:M temp1 = 2*m-1; a (m) = 2/(pi*temp1*temp1) + sign/temp1; sign = - sign; end % compute grid and initialize solution X = [0:dx:1]; T = [0:dt:1]; u = zeros (length(T), length(X)); XX = repmat(X,[length(T)1]); TT = repmat(T',[1 length(X)]); % compute solution from (11.3.41) for m = 1:M The Heat Equation 657 Figure 11.3.2: The temperature u(x, t)/L within a thin bar as a function of position x/L and time a2t/L2 when we insulate the left end and hold the right end at the temperature of zero. The initial temperature equals x. temp1 = (2*m-1)*pi/2; u = u + a(m) * cos(temp1*XX) .* exp(-temp1 * temp1 * TT); end u = - (4/pi) * u ; surf(XX,TT,u) ; axis([0 1 0 1 0 1] ); xlabel('DISTANCE','Fontsize',20); ylabel('TIME','Fontsize',20) zlabel ( ' SOLUTION' , 'Fontsize' , 20) Initially, heat near the center of the bar flows toward the cooler, insulated end, resulting in an increase of temperature there. On the right side, heat flows out of the bar because the temperature is maintained at zero at x=L. Eventually the heat that has accumulated at the left end flows rightward because of the continual heat loss on the right end. In the limit of t , all of the heat has left the bar. Example 11.3.3 A slight variation on Example 11.3.1 is (11.3.42) 658 Advanced Engineering Mathematics with MATLAB where u(x, 0)=u(0, t)=0, and u(L, t)= . (11.3.43) We begin by blindly employing the technique of separation of variables. Once again, we obtain the ordinary differential equation (11.3.9) and (11.3.10). The initial and boundary conditions become, however, X(0)=T(0)=0, (11.3.44) and X(L)T(t)= . (11.3.45) Although (11.3.44) is acceptable, (11.3.45) gives us an impossible condition because T(t) cannot be constant. If it were, it would have to equal to zero by (11.3.44). To find a way around this difficulty, suppose that we want the solution to our problem at a time long after t=0. From experience we know that heat conduction with time-independent boundary conditions eventually results in an evolution from the initial condition to some time-independent (steadystate) equilibrium. If we denote this steady-state solution by (x), it must satisfy the heat equation a2 (x)=0, (11.3.46) and the boundary conditions w(0)=0, and w(L)= . (11.3.47) We can integrate (11.3.46) immediately to give (x)=A+Bx, (11.3.48) The Heat Equation 659 and the boundary condition (11.3.47) results in (11.3.49) Clearly (11.3.49) cannot hope to satisfy the initial conditions; that was never expected of it. However, if we add a time-varying (transient) solution (x, t) to (x) so that u(x, t)= (x)+ (x, t), (11.3.50) we could satisfy the initial condition if (x, 0)=u(x, 0) and (x, t) tends to zero as t (x), (11.3.51) . Furthermore, because (x)= (0)=0, and (L)= , (11.3.52) with the boundary conditions (0, t)= (L, t)=0, 0<t. (11.3.53) We can solve (11.3.51), (11.3.52), and (11.3.53) by separation of variables; we did it in Example 11.3.1. However, in place of f(x) we now have u(x, 0) (x), or (x) because u(x, 0)=0. Therefore, the solution (x, t) is (11.3.54) with (11.3.55) (11.3.56) 660 Advanced Engineering Mathematics with MATLAB (11.3.57) (11.3.58) Thus, the entire solution is (11.3.59) The quantity a2t/L2 is the Fourier number. Figure 11.3.3 illustrates our solution and was created with the MATLAB script clear M = 1000; dx = 0.01; dt = 0.01; % compute grid and initialize solution X = [0:dx:1]; T = [0:dt:0.2]; XX = repmat(X,[length(T)1]); TT = repmat(T',[1 length(X)]); u = XX; % compute solution from (11.3.59) sign = -2/pi; for m = 1 :M coeff = sign/m; u = u + coeff * sin((m*pi)*XX).* exp(-(m*m*pi*pi) * TT); sign = -sign; end surf (XX,TT,u); axis ( [0 1 0 0.2 0 1] ); The Heat Equation 661 Figure 11.3.3: The temperature u(x, t)/ within a thin bar as a function of position x/L and time a2t/L2 with the left end held at a temperature of zero and right end held at a temperature while the initial temperature of the bar is zero. xlabel('DISTANCE','Fontsize',20); ylabel('TIME','Fontsize',20) zlabel('SOLUTION','Fontsize',20) Clearly it satisfies the boundary conditions. Initially, heat flows rapidly from right to left. As time increases, the rate of heat transfer decreases until the final equilibrium (steadystate) is established and no more heat flows. Example 11.3.4 Let us find the solution to the heat equation (11.3.60) subject to the Neumann boundary conditions (11.3.61) 662 Advanced Engineering Mathematics with MATLAB and the initial condition that u(x, 0)=x, 0<x<L. We have now insulated both ends of the bar. Assuming that u(x, t)=X(x)T(t), (11.3.62) (11.3.63) where we have presently assumed that the separation constant is negative. The Neumann conditions give ux(0, t)=X (0)T(t)=0, and ux(L, t)= X (L)T(t)=0 so that X (0)=X (L)=0. The Sturm-Liouville problem X +k2X=0, and X (0)=X (L)=0 (11.3.64) (11.3.65) gives the x-dependence. The eigenfunction solution is (11.3.66) where kn=n /L and n=1, 2, 3,.... The corresponding temporal part equals the solution of (11.3.67) which is (11.3.68) The Heat Equation 663 Thus, the product solution given by a negative separation constant is (11.3.69) Unlike our previous problems, there is a nontrivial solution for a separation constant that equals zero. In this instance, the x-dependence equals X(x)= x+B. (11.3.70) The boundary conditions X (0)=X (L)=0 force A to be zero but B is completely free. Consequently, the eigenfunction in this particular case is x0(x)=1. (11.3.71) Because in this case, the temporal part equals a constant which we shall take to be A0/2. Therefore, the product solution corresponding to the zero separation constant is u0(x, t)=X0(x)T0(t)=A0/2. (11.3.72) The most general solution to our problem equals the sum of all of the possible solutions: (11.3.73) Upon substituting t=0 into (11.3.73), we can determine An because (11.3.74) is merely a half-range Fourier cosine expansion of the function x over the interval (0, L). From (2.1.23)(2.1.24), (11.3.75) 664 Advanced Engineering Mathematics with MATLAB and (11.3.76) (11.3.77) (11.3.78) The complete solution is (11.3.79) because all of the even harmonics vanish and we may rewrite the odd harmonics using n=2m 1, where m=1, 2, 3, 4,.... Figure 11.3.4 illustrates (11.3.79) for various positions and times. It was generated using the MATLAB script clear M = 100; dx = 0.01; dt = 0.01; % compute grid and initialize solution X = [0:dx:1]; T = [0:dt:0.3]; u = zeros(length(T), length(X)); u = 0.5; XX = repmat(X,[length(T)1]); TT = repmat(T',[1 length(X)]); % compute solution from (11.3.79) for m = 1:M temp1 = (2*m-1) * pi ; The Heat Equation 665 Figure 11.3.4: The temperature u(x, t)/L within a thin bar as a function of position x/L and time a2t/L2 when we insulate both ends. The initial temperature of the bar is x. coeff = 4 / (temp1*temp1); u = u - coeff*cos(temp1*XX).* exp(-temp1 * temp1 * TT); end surf(XX,TT,u); axis ( [0 1 0 0.3 0 1] ); xlabel ('DISTANCE','Fontsize',20); ylabel('TIME','Fontsize',20) zlabel('SOLUTION','Fontsize',20) The physical interpretation is quite simple. Since heat cannot flow in or out of the rod because of the insulation, it can only redistribute itself. Thus, heat flows from the warm right end to the cooler left end. Eventually the temperature achieves steady-state when the temperature is uniform throughout the bar. Example 11.3.5 So far we have dealt with problems where the temperature or flux of heat has been specified at the ends of the rod. In many physical applications, one or both of the ends may radiate to free space at temperature u0. According to Stefan's law, the amount of heat radiated from a given area dA in a given time interval dt is (11.3.80) 666 Advanced Engineering Mathematics with MATLAB where is called the Stefan-Boltzmann constant. On the other hand, the amount of heat that reaches the surface from the interior of the body, assuming that we are at the right end of the bar, equals (11.3.81) where is the thermal conductivity. Because these quantities must be equal, (11.3.82) If u and u0 are nearly equal, we may approximate the second bracketed term on the right side of (11.3.82) as We write this approximate form of (11.3.82) as (11.3.83) where h, the surface conductance or the coefficient of surface heat transfer, equals Equation (11.3.83) is a "radiation" boundary condition. Sometimes someone will refer to it as "Newton's law" because (11.3.83) is mathematically identical to Newton's law of cooling of a body by forced convection. Let us now solve the problem of a rod that we initially heat to the uniform temperature of 100. We then allow it to cool by maintaining the temperature at zero at x=0 and radiatively cooling to the surrounding air at the temperature of zero4 at x=L. We may restate the problem as (11.3.84) with u(x, 0)=100, 0<x<L, (11.3.85) u(0, t)=0, 0<t, 4 (11.3.86) Although this would appear to make h=0, we have merely chosen a temperature scale so that the air temperature is zero and the absolute temperature used in Stefan's law is nonzero. The Heat Equation 667 and (11.3.87) Once again, we assume a product solution u(x, t)=X(x)T(t) with a negative separation constant so that (11.3.88 ) We obtain for the x-dependence that X +k2X=0, (11.3.89) Table 11.3.1: The First Ten Roots of (11.3.93) and Cn for hL=1 n 1 2 3 4 5 6 7 8 9 10 n Approximate n Cn 118.9221 31.3414 27.7549 16.2891 14.9916 10.8362 10.2232 8.0999 7.7479 6.4626 2.0288 4.9132 7.9787 11.0855 14.2074 17.3364 20.4692 23.6043 26.7409 29.8786 2.2074 4.9246 7.9813 11.0865 14.2079 17.3366 20.4693 23.6044 26.7410 29.8786 but the boundary conditions are now 668 Advanced Engineering Mathematics with MATLAB X(0)=0, and X (L)+hX(L)=0. The most general solution of (11.3.89) is X(x)=A cos(kx)+B sin(kx). (11.3.91) (11.3.90) However, A=0, because X(0)=0. On the other hand, k cos(kL)+h sin(kL)=kL cos(kL)+hL sin(kL)=0, (11.3.92) if B 0. The nondimensional number hL is the Biot number and depends completely upon the physical characteristics of the rod. In Chapter 9 we saw how to find the roots of the transcendental equation a+hL tan( )=0, (11.3.93) where =kL. Consequently, if n is the nth root of (11.3.93), then the eigenfunction is Xn(x)=sin( nx/L). (11.3.94) In Table 11.3.1, we list the first ten roots of (11.3.93) for hL=1. In general, we must solve (11.3.93) either numerically or graphically. If is large, however, we can find approximate values5 by noting that cot( )= hL/ or n 0, (11.3.95) =(2n 1) /2, (11.3.96) where 5 Using the same technique, Stevens and Luck [Stevens, J.W., and R.Luck, 1999: Explicit approximations for all eigenvalues of the 1-D transient heat conduction equations. Heat Transfer Engng., 20(2), 3541] have found approximate solutions to n tan( n)=Bi. They showed that The Heat Equation 669 where n=1, 2, 3,.... We can obtain a better approximation by setting (11.3.97) where Substituting into (11.3.95), (11.3.98) We can simplify (11.3.98) to (11.3.99) because cot[(2n 1) /2 ]=tan( ), and tan( ) 0 for 1. Solving for , (11.3.100) and (11.3.101) In Table 11.3.1 we compare the approximate roots given by (11.3.101) with the actual roots. The temporal part equals (11.3.102) 670 Advanced Engineering Mathematics with MATLAB Consequently, the general solution is (11.3.103) where n is the nth root of (11.3.93). To determine Cn, we use the initial condition (11.3.85) and find that (11.3.104) Equation (11.3.104) is an eigenfunction expansion of 100 employing the eigenfunctions from the Sturm-Liouville problem X +k2X=0, (11.3.105) and X(0)=X (L)+hX(L)=0. (11.3.106) Thus, the coefficient Cn is given by (9.3.4) or (11.3.107) The Heat Equation 671 as r(x)=1. Performing the integrations, (11.3.108) because sin(2 n)=2cos( n)sin( n), and n = hL tan( n). The complete solution is (11.3.109) Figure 11.3.5 illustrates this solution for hL=1 at various times and positions. It was generated using the MATLAB script clear hL = 1; M = 200; dx = 0.02; dt = 0.02; % create initial guess at alpha_n zero = zeros(M ,1); for n = 1:M temp = (2*n-1)*pi; zero (n) = 0.5*temp + 2*hL/temp ; end; % use Newton-Raphson method to improve values of alpha_n Figure 11.3.5: The temperature u(x, t) within a thin bar as a function of position x/L and time a2t/L2 when we allow the bar to radiatively cool at x=L while the temperature is zero at x=0. Initially the temperature was 100. for n = 1:M; for k = 1:10 f=zero(n)+ hL*tan(zero(n)); fp =1 + hL * sec(zero(n))^2; 672 Advanced Engineering Mathematics with MATLAB zero(n) = zero(n) - f 1 fp; end ; end ; % compute Fourier coefficients for m = 3:M a (m) = 422* (3-cos (zero (m) ) ) 1 (zero (m) * (3,cos(zero(m))]41hL)); end % compute grid and initialize solution U = X2:dx:3[; S = X2:dt:207[; u = zeros (length(S). length(U)); UU = repmat (U . Xlength(S)3[); SS = repmat (S' . X3 length (U) [ ) ; % compute solution from (33050329) for m = 3 : M u = u , a (m) * sin (zero (m) *UU) 0* exp (/zero (m) *zero (m) *SS) ; end surf (UU . SS . u) xlabel ( ' DIOSANCE' . 'Fontsize' . 42) ; ylabel ( ' SIME' . 'Fontsize' . 42) zlabel ( ' T(U. S) ' . 'Fontsize' . 42) It is similar to Example 11.3.1 in that the heat lost to the environment occurs either because the temperature at an end is zero or because it radiates heat to space which has the temperature of zero. Example 11.3.6: Refrigeration of apples Some decades ago, shiploads of apples, going from Australia to England, deteriorated from a disease called "brown heart," which occurred under insufficient cooling conditions. Apples, when placed on shipboard, are usually warm and must be cooled to be carried in cold storage. They also generate heat by their respiration. It was suspected that this heat generation effectively counteracted the refrigeration of the apples, resulting in the "brown heart." This was the problem which induced Awberry6 to study the heat distribution within a sphere in which heat is being generated. Awberry first assumed that the apples are initially at a uniform temperature. We can take this temperature to be zero by the appropriate choice of temperature scale. At time t=0, the skins of the apples assume the temperature immediately when we introduce them into the hold. Because of the spherical geometry, the nonhomogeneous heat equation becomes (11.3.110) where a2 is the thermal diffusivity, b is the radius of the apple, conductivity, and G is the heating rate (per unit time per unit volume). 6 is the thermal Awberry, J.H., 1927: The flow of heat in a body generating heat. Philos. Mag., Ser. 7, 4, 629638. The Heat Equation 673 If we try to use separation of variables on (11.3.110), we find that it does not work because of the G/ term. To circumvent this difficulty, we ask the simpler question of what happens after a very long time. We anticipate that a balance will eventually be established where conduction transports the heat produced within the apple to the surface of the apple where the surroundings absorb it. Consequently, just as we introduced a steady-state solution in Example 11.3.3, we again anticipate a steady-state solution (r) where the heat conduction removes the heat generated within the apples. The ordinary differential equation (11.3.111) gives the steady-state. Furthermore, just as we introduced a transient solution which allowed our solution to satisfy the initial condition, we must also have one here and the governing equation is (11.3.112) Solving (11.3.111) first, (11.3.113 The constant D equals zero because the solution must be finite at r=0. Since the steady-state solution must satisfy the boundary condition (b)=0, (11.3.114) Turning to the transient problem, we introduce a new dependent variable y(r, t)=r (r, t). This new dependent variable allows us to replace (11.3.112) with (11.3.115) 674 Advanced Engineering Mathematics with MATLAB which we can solve. If we assume that y(r, t)=R(r)T(t) and we only have a negative separation constant, the R(r) equation becomes (11.3.116) which has the solution R(r)=A cos(kr)+B sin(kr). (11.3.117) The constant A equals zero because the solution (11.3.117) must vanish at r=0 so that (0, t) remains finite. However, because = (b)+ (b, t) for all time and (b, t)=R(b)T(t)/b=0, then R(b)=0. Consequently, kn=n /b, and (11.3.118) Superposition gives the total solution which equals (11.3.119) Finally, we determine the coefficients Bn by the initial condition that u(r, 0)=0. Therefore, (11.3.120) (11.3.121) The complete solution is (11.3.3.122) The Heat Equation 675 The first line of (11.3.122) gives the temperature distribution due to the imposition of the temperature on the surface of the apple while the second line gives the rise in the temperature due to the interior heating. Returning to our original problem of whether the interior heating is strong enough to counteract the cooling by refrigeration, we merely use the second line of (11.3.122) to find how much the temperature deviates from what we normally expect. Because the highest temperature exists at the center of each apple, its value there is the only one of interest in this problem. Assuming b=4cm as the radius of the apple, a2G/k=1.33 10 5C/s, and a2= 1.55 10 3cm2/s, the temperature effect of the heat generation is very small, only 0.0232C when, after about 2 hours, the temperatures within the apples reach equilibrium. Thus, we must conclude that heat generation within the apples is not the cause of brown heart. We now know that brown heart results from an excessive concentration of carbon dioxide and an insufficient amount of oxygen in the storage hold.7 Presumably this atmosphere affects the metabolic activities that are occurring in the apple8 and leads to low-temperature breakdown. Example 11.3.7 In this example we illustrate how separation of variables can be employed in solving the axisymmetric heat equation in an infinitely long cylinder. In circular coordinates the heat equation is (11.3.123) where r denotes the radial distance and a2 denotes the thermal diffusivity. Let us assume that we heated this cylinder of radius b to the uniform temperature T0 and then allowed it to cool by having its surface held at the temperature of zero starting from the time t=0. 7 8 Thornton, N.C., 1931: The effect of carbon dioxide on fruits and vegetables in storage. Contrib. Boyce Thompson Inst., 3, 219244. Fidler, J.C., and C. J.North, 1968: The effect of conditions of storage on the respiration of apples. IV. Changes in concentration of possible substrates of respiration, as related to production of carbon dioxide and uptake of oxygen by apples at low temperatures. J. Hortic. Sci., 43, 429439. 676 Advanced Engineering Mathematics with MATLAB We begin by assuming that the solution is of the form u(r, t)=R(r)T(t) so that (11.3.124) The only values of the separation constant that yield nontrivial solutions are negative. The nontrivial solutions are R(r)=J0(kr/b), where J0 is the Bessel function of the first kind and zeroth order. A separation constant of zero gives R(r)=ln(r) which becomes infinite at the origin. Positive separation constants yield the modified Bessel function I0(kr/b). Although this function is finite at the origin, it cannot satisfy the boundary condition that u(b, t)=R(b)T(t)=0, or R(b)=0. The boundary condition that R(b)=0 requires that J0(k)=0. This transcendental equation yields an infinite number of constants kn. For each kn, the temporal part of the solution satisfies the differential equation (11.3.125) which has the solution (11.3.126) Consequently, the product solutions are (11.3.127) The total solution is a linear superposition of all of the particular solutions or (11.3.128) Our final task remains to determine An. From the initial condition that u(r, 0)=T0, (11.3.129) The Heat Equation 677 From (9.5.35) and (9.5.43), (11.3.130) (11.3.131) Figure 11.3.6: The temperature u(r, t)/T0 within an infinitely long cylinder at various positions r/b and times a2t/b2 that we initially heated to the uniform temperature T0 and then allowed to cool by forcing its surface to equal zero. from (9.5.25). Thus, the complete solution is (11.3.132) Figure 11.3.6 illustrates the solution (11.3.132) for various Fourier numbers a2t/b2. It was generated using the MATLAB script clear M = 20; dr = 0.02; dt = 0.02; % load in zeros of J_0 zero( 1) = 2.40482; zero( 2) = 5.52007; zero( 3) = 8.65372; 678 Advanced Engineering Mathematics with MATLAB zero( 4) = 11.79153; zero( 5) = 14.93091; zero( 6) = 18.07106; zero( 7) = 21.21164; zero( 8) = 24.35247; zero( 9) = 27.49347; zero( 10) = 30.63461; zero( 11) = 33.77582; zero( 12) = 36.91710; zero( 13) = 40.05843; zero( 14) = 43.19979; zero( 15) = 46.34119; zero( 16) = 49.48261; zero( 17) = 52.62405; zero( 18) = 55.76551; zero( 19) = 58.90698; zero ( 20) = 62.04847; % compute Fourier coefficients for m = 1:M a(m) = 2 / (zero(m)*besselj(1,zero(m))); end % compute grid and initialize solution R = [0:dr:1]; T = [0:dt:0.5]; u = zeros(length(T), length(R)); RR = repmat (R,[length (T) 1]); TT = repmat (T',[1 length (R)]); % compute solution from (11.3.132) for m = 1:M u = u + a(m)*besselj(0,zero(m)*RR).*exp(-zero(m)*zero(m)*TT); end surf(RR,TT,u) xlabel('R','Fontsize',20);ylabel('TIME','Fontsize',20) zlabel('SOLUTION','Fontsize',20) It is similar to Example 11.3.1 except that we are in cylindrical coordinates. Heat flows from the interior and is removed at the cylinder's surface where the temperature equals zero. The initial oscillations of the solution result from Gibbs phenomena because we have a jump in the temperature field at r=b. Example 11.3.8 In this example9 we find the evolution of the temperature field within a cylinder of radius b as it radiatively cools from an initial uniform temperature T0. The heat equation is (11.3.133) which we will solve by separation of variables u(r, t)=R(r)T(t). Therefore, (11.3.134) 9 For another example of solving the heat equation with Robin boundary conditions, see 3.2 in Balakotaiah, V., N.Gupta, and D.H.West, 2000: A simplified model for analyzing catalytic reactions in short monoliths. Chem. Engng. Sci., 55, 53675383. The Heat Equation 679 because only a negative separation constant yields a R(r) which is finite at the origin and satisfies the boundary condition. This solution is R(r)=J0(kr/b), where J0 is the Bessel function of the first kind and zeroth order. The radiative boundary condition can be expressed as (11.3.135) Because T(t) 0, (11.3.136) where the product hb is the Biot number. The solution of the transcendental equation (11.3.136) yields an infinite number of distinct constants kn. For each kn, the temporal part equals the solution of (11.3.137) or (11.3.138) The product solution is, therefore, (11.3.139) and the most general solution is a sum of these product solutions (11.3.140) 680 Advanced Engineering Mathematics with MATLAB Finally, we must determine An. From the initial condition that u(r, 0)= T0, (11.3.141) where (11.3.142) (11.3.143) (11.3.144) (11.3.145) which follows from (9.5.25), (9.5.35), (9.5.45), and (11.3.136). Consequently, the complete solution is (11.3.146) The Heat Equation 681 Figure 11.3.7: The temperature u(r, t)/T0 within an infinitely long cylinder at various positions r/b and times a2t/b2 that we initially heated to the temperature T0 and then allowed to radiatively cool with hb=1. Figure 11.3.7 illustrates the solution (11.3.146) for various Fourier numbers a2t/b2 with hb=1. It was created using the MATLAB script clear hb = 1; m=0; M = 100; dr = 0.02; dt = 0.02; % find k_n which satisfies hb J_0(k) = k J_1(k) for n = 1:10000 k1 = 0.05*n; k2 = 0.05*(n+1); y1 = hb * besselj(0, k1) - k1 * besse1j(1, k1); y2 = hb * besselj(0, k2) - k2 * besselj(1, k2); if y1*y2 <= 0 ; m = m+1 ; zero (m) = k1; end; end; % % use Newton-Raphson method to improve values of k_n % for n = 1:M; for k = 1:5 term0 = besselj(0, zero(n)); term1 = besse1j(1, zero(n)); term2 = besselj(2, zero(n)); f = hb * term0 - zero(n) * term1; fp = 0.5*zero(n)*(term2-term0) - (1+hb) *term1; zero(n) = zero(n) - f / fp; end; end; % compute Fourier coefficients for m = 1:M denom = zero(m)*(besselj(0,zero(m))^2+besselj(1,zero(m))^2); 682 Advanced Engineering Mathematics with MATLAB a(m) = 2 * besse1j(1,zero(m)) / denom; end % compute grid and initialize solution R = [0:dr:1]; T = [0:dt:0.5]; u = zeros (length(T),length(R)); RR = repmat (R,[length(T) 1]); TT = repmat (T',[1 length(R)]); % compute solution from (11.3.146) for m = 1:M u = u + a(m)*besselj(0,zero(m)*RR).*exp(-zero(m)*zero(m)*TT); end surf(RR,TT,u) xlabel('R','Fontsize',20);ylabel('TIME','Fontsize',20) zlabel('SOLUTION','Fontsize',20) These results are similar to Example 11.3.5 except that we are in cylindrical coordinates. Heat flows from the interior and is removed at the cylinder's surface where it radiates to space at the temperature zero. Note that we do not suffer from Gibbs phenomena in this case because there is no initial jump in the temperature distribution. Example 11.3.9: Temperature within an electrical cable In the design of cable installations we need the temperature reached within an electrical cable as a function of current and other parameters. To this end,10 let us solve the nonhomogeneous heat equation in cylindrical coordinates with a radiation boundary condition. The derivation of the heat equation follows from the conservation of energy: heat generated=heat dissipated+heat stored, or (11.3.147) where I is the current through each wire, R is the resistance of each conductor, N is the number of conductors in the shell between radii r and r+ r=2 mr r/( b2), b is the radius of the cable, m is the total number of conductors in the cable, is the thermal conductivity, is the density, c is 10 Iskenderian, H.P., and W.J.Horvath, 1946: Determination of the temperature rise and the maximum safe current through multiconductor electric cables. J. Appl. Phys., 17, 255262. The Heat Equation 683 the average specific heat, and u is the temperature. In the limit of r0, (11.3.147) becomes (11.3.148) where A=I2Rm/( b2cp), and a2= /( c). Equation (11.3.148) is the nonhomogeneous heat equation for an infinitely long, axisymmetric cylinder. From Example 11.3.3, we know that we must write the temperature as the sum of a steady-state and transient solution: u(r, t)= (r)+ (r, t). The steady-state solution (r) satisfies (11.3.149) or (11.3.149) where Tc is the (yet unknown) temperature in the center of the cable. The transient solution (r, t) is governed by (11.3.151) with the initial condition that u(r, 0)=Tc Ar2/(4a2)+v(0, t)=0. At the surface r=b, heat radiates to free space so that the boundary condition is ur= hu, where h is the surface conductance. Because the temperature equals the steady-state solution when all transient effects die away, (r) must satisfy this radiation boundary condition regardless of the transient solution. This requires that (11.3.152) 684 Advanced Engineering Mathematics with MATLAB Therefore, (r, t) must satisfy r (b, t)= h (b, t) at r=b. (r, t) by separation of variables (r, t)= R(r)T(t). We find the transient solution Substituting into (11.3.151), (11.3.153) or (11.3.154) and (11.3.155) with R (b)= hR(b). The only solution of (11.3.154) which remains finite at r=0 and satisfies the boundary condition is R(r)=J0(kr), where J0 is the zero-order Bessel function of the first kind. Substituting J0(kr) into the boundary condition, the transcendental equation is kbJ1(kb) hbJ0(kb)=0. (11.3.156) For a given value of h and b, (11.3.156) yields an infinite number of unique zeros kn. The corresponding temporal solution to the problem is (11.3.157) so that the sum of the product solutions is (11.3.158) The Heat Equation 685 Our final task remains to compute An. By evaluating (11.3.158) at t=0, (11.3.159) which is a Fourier-Bessel series in J0(knr). In 9.5 we showed that the coefficient of a Fourier-Bessel series with the orthogonal function J0(knr) and the boundary condition (11.3.156) equals (11.3.160) from (9.5.35) and (9.5.45). Carrying out the indicated integrations, (11.3.161) We obtained (11.3.161) by using (9.5.25) and integrating by parts as shown in Example 9.5.5. To illustrate this solution, let us compute it for the typical parameters b=4cm, hb=1, a2=1.14cm2/s, A=2.2747C/s, and Tc=23.94C. The value of A corresponds to 37 wires of #6 AWG copper wire within a cable carrying a current of 22amp. Figure 11.3.8 illustrates the solution as a function of radius at various times. It was created using the MATLAB script clear asq = 1.14; A = 2.2747; b = 4; dr = 0.02; dt = 0.02; 686 Advanced Engineering Mathematics with MATLAB Figure 11.3.8: The temperature field (in degrees Celsius) within an electric copper cable containing 37 wires and a current of 22 amperes at various positions r/b and times a2t/b2. Initially the temperature was zero and then we allow the cable to cool radiatively as it is heated. The parameters are hb=1 and the radius of the cable b=4cm. id < 0: n</: F < 0/: _be < 12-53: epotu0 < = ) d ) d . &3 )ctr(: epotu1 < = ) d ) d . ctr: epotu2 < = ) d ) d . &1 ) ctr(: % hjof lbod xijei tcujthjgt id >b/&ld( < ld >b0 &ld( hps o < 060//// l0 < /-/4)o : l1 < /-/4)&o*0(: y0 < id ) dgttgmk&/+l0( - l0 ) dgttg0k&0+l0(: y1 < id ) dgttgmk&/+l1( - l1 ) dgttgmk&0+l1(: jh ym)y1 ;< /: n < n*0: 'gsp &n( < l0: gof: gof : % % vtg Ngxupo,Scqitpo nguipf up jnqspwg wcmvgt ph lbo % hps o < 06F: hps l < 064 ugsn/ < dgttgmk&/+ 'gsp&o((: ugsn0 < dgttg0k&0+ 'gsp&o((: ugsn1 < dgttgmk&1+ 'gsp&o((: h < id ) ugsn/ - 'gsp&o( ) ugsn0: hq < /-4)'gsp &o()&ugsn1-ugsn/( - &0*id()ugsn0: 'gsp&o( < 'gsp&o( - h . hq: gof: gof: hps n < 06F fgopn < &'gsp&n()'gsp&n(*id)id()dgttgmk&/+'gsp&n((a1: c &n( < &&epotu0,_be( )'gsp&n(... The Heat Equation 687 - anmrs41ycpn(l))*]crrcih(3.ycpn(l))' , anmrs5 * ]crrcih(2.ycpn(l)): [(l) ; 4 * [(l) 1 bcmnl: cmb % anlotsc epgb [mb gmgsg[igyc rnitsgnm L ; O29bp93T: M ; O29bs94T: t ; MXa * nmcr(icmesf(M). icmesf(L)): LL ; pcol[s(L. Oicmesf(M) 3T): MM ; pcol[s(Mz.O3 icmesf(L)T): % anlotsc rnitsgnm dpnl (33050354) t ; t - anmrs3 * LL 0* LL: dnp l ; 39F t ; t , [(l)*]crrcih(2.ycpn(l)*LL)0*cuo(/ycpn(l)*ycpn(l)*MM): cmb rtpd(LL.MM.t): [ugr(O2 3 2 4 2 47T): ui[]ci (zLz.zDnmsrgycz.42):xi[]ci(zMEFCz.zDnmsrgycz.42) yi[]ci(zMCFICL=MNLC.USagpa Az.zDnmsrgycz.42) From an initial temperature of zero, the temperature rises due to the constant electrical heating. After a short period of time, it reaches its steady-state distribution given by (11.3.150). The cable is coolest at the surface where heat is radiating away. Heat flows from the interior to replace the heat lost by radiation. Problems For Problems 15, solve the heat equation ut=a2uxx, 0<x< , 0<t, subject to the boundary conditions that u(0, t)=u( , t)=0, 0<t, and the following initial conditions for 0<x< . Then plot your results using MATLAB. 1. 2. 3. 4. 5. For Problems 610, solve the heat equation ut=a2uxx, 0<x< , 0<t, subject to the boundary conditions that ux(0, t)=ux( , t)=0, 0<t, and the following initial conditions for 0<x< . Then plot your results using MATLAB. 6. u(x, 0)=1 7. u(x, 0)=x 8. u(x, 0)=cos2(x)=[1+cos(2x)]/2 9. u(x, 0)= x 10. u(x, 0)=A, a constant u(x, 0)=sin3(x)=[3sin(x) sin(3x)]/4 u(x, 0)=x u(x, 0)= x 688 Advanced Engineering Mathematics with MATLAB For Problems 1117, solve the heat equation ut=a2uxx, 0<x< , 0<t, subject to the following boundary conditions and initial condition. Then plot your results using MATLAB. 11. ux(0, t)=u( , t)=0, 0<t; u(x, 0)=x2 2, 0<x< 12. u(0, t)=u( , t)=T0, 0<t; u(x, 0)=T1 T0, 0<x< 13. u(0, t)=0, ux( , t)=0, 0<t; u(x, 0)=1, 0<x< 14. u(0, t)=0, ux( , t)=0, 0<t; u(x, 0)=x, 0<x< 15. u(0, t)=0, ux( , t)=0, 0<t; u(x, 0)= x, 0<x< 16. u(0, t)=T0, ux( , t)=0, 0<t; u(x, 0)=T1 T0, 0<x< 17. u(0, t)=0, u( , t)=T0, 0<t; u(x, 0)=T0, 0<x< 18. It is well known that a room with masonry walls is often very difficult to heat. Consider a wall of thickness L, conductivity , and diffusivity a2 which we heat by a surface heat flux at a constant rate H. The temperature of the outside (out-of-doors) face of the wall remains constant at T0 and the entire wall initially has the uniform temperature T0. Let us find the temperature of the inside face as a function of time.11 We begin by solving the heat conduction problem subject to the boundary conditions that and the initial condition that u(x, 0)=T0. Show that the temperature field equals Therefore, the rise of temperature at the interior wall x=0 is 11 Reproduced with acknowledgment to Taylor and Francis, Publishers, from Dufton, A. F., 1927: The warming of walls. Philos. Mag., Ser. 7, 4, 888889. The Heat Equation 689 or For a2t/L2<1, this last expression can be approximated12 by 2Hat1/2/ 1/2 . We thus see that the temperature will initially rise as the square root of time and diffusivity and inversely with conductivity. For an average rock =0.0042g/cm-s, and a2=0.0118cm2/s, while for wood (Spruce) =0.0003g/cm-s, and a2=0.0024cm2/s. The same set of equations applies to heat transfer within a transistor operating at low frequencies.13 At the junction (x=0) heat is produced at the rate of H and flows to the transistor's supports (x=L) where it is removed. The supports are maintained at the temperature T0 which is also the initial temperature of the transistor. 12 Let us define the function: Then Consider now the integral If we approximate this integral by using the trapezoidal rule with x=2, then and f (t) a 3/2/(4Lt1/2). Integrating and using f(0)=0, we finally have f(t) a 3/2t1/2(2L). The smaller a2t/L2 is, the smaller the error will be. For example, if t=L2/a2, then the error is 2.4% . 13 Mortenson, K.E., 1957: Transistor junction temperature as a function of time. Proc. IRE, 45, 504513. Equation 2a should read Tx= F/k. 690 Advanced Engineering Mathematics with MATLAB 19. The linearized Boussinesq equation14 governs the height of the water table u(x, t) above some reference point, where a2 is the product of the storage coefficient times the hydraulic coefficient divided by the aquifer thickness. A typical value of a2 is 10m2/min. Consider the problem of a strip of land of width L that separates two reservoirs of depth h1. Initially the height of the water table would be h1. Suddenly we lower the reservoir on the right x=L to a depth h2 [u(0, t)=h1, u(L, t)=h2, and u(x, 0)=h1]. Find the height of the water table at any position x within the aquifer and any time t>0. 20. The equation (see Problem 19) governs the height of the water table u(x, t). Consider the problem15 of a piece of land that suddenly has two drains placed at the points x=0 and x=L so that u(0, t)=u(L, t)=0. If the water table initially has the profile u(x, 0)=8H(L3x 3L2x2+4Lx32x4)/L4, find the height of the water table at any point within the aquifer and any time t>0. 21. We want to find the rise of the water table of an aquifer which we sandwich between a canal and impervious rocks if we suddenly raise the water level in the canal h0 units above its initial elevation and then maintain the canal at this level. The linearized Boussinesq equation (see Problem 19) 14 15 See, for example, Van Schilfgaarde, J., 1970: Theory of flow to drains. Advances in Hydroscience, No. 6, Academic Press, 8185. For a similar problem, see Dumm, L.D., 1954: New formula for determining depth and spacing of subsurface drains in irrigated lands. Agric. Eng., 35, 726730. The Heat Equation 691 governs the level of the water table with the boundary conditions u(0, t)=h0, and ux(L, t)=0, and the initial condition u(x, 0)=0. Find the height of the water table at any point in the aquifer and any time t>0. 22. Solve the nonhomogeneous heat equation subject to the boundary conditions u(0, t)=ux( , t)=0, 0<t, and the initial condition u(x, 0)=f(x), 0<x< . 23. Solve the nonhomogeneous heat equation subject to the boundary conditions ux(0, t)=ux(1, t)=0, 0<t, and the initial condition 0<x<1. [Hint: Note that any function of time satisfies the boundary conditions.] 24. Solve the nonhomogeneous heat equation subject to the boundary conditions ux(0, t)=ux( , t)=0, 0<t, and the initial condition u(x, 0)=f(x), 0<x< . [Hint: Note that any function of time satisfies the boundary conditions.] 25. Solve the nonhomogeneous heat equation subject to the boundary conditions u(0, t)=u( , t)=0, 0<t, and the initial condition u(x, 0)=0, 0<x< . [Hint: Represent the forcing function as a half-range Fourier sine expansion over the interval (0, ).] 26. A uniform, conducting rod of length L and thermometric diffusivity a2 is initially at temperature zero. We supply heat uniformly throughout the rod so that the heat conduction equation is where P is the rate at which the temperature would rise if there was no conduction. If we maintain the ends of the rod at the temperature of zero, find the temperature at any position and subsequent time. How would the solution change if the boundary conditions became n(0, t)=u(L, t)=A 0, 0<t, and the initial conditions read u(x, 0)=A, 0<x<L? 692 Advanced Engineering Mathematics with MATLAB 27. Solve the nonhomogeneous heat equation where a2= /cp, with the boundary conditions that and the initial condition that u(x, 0)=0, 0<x<L. 28. Find the solution of with the boundary conditions u(0, t)=1, and u(L, t)=0, 0<t, and the initial condition u(x, 0)=0, 0<x<L. 29. Solve16 with the boundary conditions and the initial condition u(x, 0)=u0, 0<x<L. 30. Solve with the boundary conditions and the initial condition u(x, 0)=1, 0<x<1. Hint: Let u(x, t)= (x, t) exp[(2x t)/(4a2)] so that the problem becomes 16 Motivated by problems solved in Gomer, R., 1951: Wall reactions and diffusion in static and flow systems. J. Chem. Phys., 19, 284289. The Heat Equation 693 with the boundary conditions and the initial condition (x, 0)=exp[ x/(2a2)], 0<x<1. 31. Solve the heat equation in spherical coordinates subject to the boundary conditions limr0 |u(r, t)|< , and u(1, t)=0, 0<t, and the initial condition u(r, 0)=1, 0 r<1. 32. Solve the heat equation in spherical coordinates subject to the boundary conditions u( , t)=ur( , t)=0, 0<t, and the initial condition u(r, 0)=u0, <r< . 33. Solve17 the heat equation in spherical coordinates subject to the boundary conditions and the initial condition u(r, 0)=u0, 0 r<b. 17 Reprinted from Chem. Engng. Sci. , 57, H.Zhou, S.Abanades, G.Flamant, D. Gauthier, and J.Lu, Simulation of heavy metal vaporization dynamics of a fluidized bed, 26032614, 2002, with permission from Elsevier Science. See also Mantell, C., M.Rodriguez, and E.Martinez de la Ossa, 2002: Semi-batch extraction of anthocyanins from red grape pomace in packed beds: Experimental results and process modelling. Chem. Engng. Sci., 57, 38313838. 694 Advanced Engineering Mathematics with MATLAB 34. Solve18 the heat equation in cylindrical coordinates subject to the boundary conditions limr0 |u(r, t)|< , and u(b, t)=u0, 0<t, and the initial condition u(r, 0)=0, 0<r<b. 35. Solve the heat equation in cylindrical coordinates subject to the boundary conditions linir0 |u(r, t)|< , and u(b, t)= , 0<t, and the initial condition u(r, 0)=1, 0 r<b. 36. Solve the heat equation in cylindrical coordinates subject to the boundary conditions limr0 |u(r, t)|< , and u(1, t)=0, 0<t, and the initial condition 37. The equation19 governs the velocity u(r, t) of an incompressible fluid of density and kinematic viscosity v flowing in a long circular pipe of radius b with an imposed, constant pressure 18 Taken from Destriau, G., 1946: Propagation des charges lectriques sur les pellicules faiblement conductrices "problm plan." J. Phys. Radium, 7, 4348. 19 Reprinted from J. Math. Pures Appl., Ser. 9, 11, P.Szymanski, Quelques solutions exactes des quations de l'hydrodynamique du fluide visqueux dans le cas d'un tube cylindrique, 67107, 1932, with permission from Elsevier Science. The Heat Equation 695 gradient G. If the fluid is initially at rest u(r, 0)=0, 0<r<b, and there is no slip at the wall u(b, t)=0, 0<t, find the velocity at any subsequent time and position. 38. Solve the heat equation in cylindrical coordinates subject to the boundary conditions limr0 |u(r, t)|< , and ur(b, t)= h u(b, t), 0<t, and the initial condition u(r, 0)=b2 r2, 0 r<b. 39. Solve20 the heat equation in cylindrical coordinates subject to the boundary conditions limr0 |u(r, t)|< , and ur(L, t)= hu(L, t), 0<t, and the initial condition where b<L, and 0<h, . 40. In their study of heat conduction within a thermocouple through which a steady current flows, Reich and Madigan21 solved the following nonhomogeneous heat conduction problem: where J represents the Joule heating generated by the steady current and the P term represents the heat loss from Peltier cooling.22 Find u(x, t) if both ends are kept at zero [u(0, t)=u(L, t)=0] and initially the temperature is zero [u(x, 0)=0]. The interesting aspect of this problem is the presence of the delta function. Step 1: Assuming that u(x, t) equals the sum of a steady-state solution transient solution (x, t), show that the steady-state solution is governed by (x) and a 20 21 22 Mack, W., M.Plchl, and U.Gamer, 2000: EfFects of a temperature cycle on an elastic-plastic shrink fit with solid inclusion. Chinese J. Mech., 16, 2330. Reich, A.D., and J.R.Madigan, 1961: Transient response of a thermocouple circuit under steady currents. J. Appl. Phys., 32, 294301. In 1834 Jean Charles Athanase Peltier (17851845) discovered that there is a heating or cooling effect, quite apart from ordinary resistance heating, whenever an electric current flows through the junction between two different metals. 696 Advanced Engineering Mathematics with MATLAB Step 2: Show that the steady-state solution is Step 3: The temperature must be continuous at x=b; otherwise, we would have infinite heat conduction there. Use this condition to show that Ab= B(L b). Step 4: To find a second relationship between A and B, integrate the steadystate differential equation across the interface at x=b and show that Step 5: Using the result from Step 4, show that A+B= P/a2, and Step 6: Re-express (x) as a half-range Fourier sine expansion and show that Step 7: Use separation of variables to find the transient solution by solving The Heat Equation 697 subject to the boundary conditions (0, t)= (L, t)=0, 0<t, and the initial condition (x, 0)= w(x), 0<x<L. Step 8: Add the steady-state and transient solutions together and show that 41. Use separation of variables to solve23 the partial differential equation subject to the boundary conditions that ux(0, t)+2au(0, t)=0, ux(1, t)+ 2au(1, t)=0, 0<t, and the initial condition that u(x, 0)=1, 0<x<1. Step 1: Introducing u(x, t)=e ax (x, t), show that the problem becomes subject to the boundary conditions that x (0, t)+a (0, t)=0, x (1, t)+ a (1, t)=0, 0<t, and the initial condition that u(x, 0)=e x, 0<x<1. Step 2: Assuming that (x, t)=X(x)T(t), show that the problem reduces to the ordinary differential equations X +( a2)X=0, X (0)+aX(0)=0, X (1)+aX(1)=0, and T + T=0, where is the separation constant. Step 3: Solve the eigenvalue problem and show that n 0 =0, X0(x)=e (a2+n2 2)t ax , T0(t)=A0, and =a2+n2 2, Xn(x)=asin(n x) n cos(n x), and Tn(t)=Ane , where n=1, 2, 3,..., so that 23 Reprinted from Physica, 9, S.R.DeGroot, Thorie phnomnologique de l'effet Soret, 699707, 1942, with permission from Elsevier Science. 698 Advanced Engineering Mathematics with MATLAB Step 4: Evaluate A0 and An and show that 42. Use separation of variables to solve24 the partial differential equation subject to the boundary conditions that u(0, t)=ux(0, t)=u(1, t)=ux(1, t) =0, 0<t, and the initial condition that 0<x<1. Step 1: Assuming that u(x, t)=X(x)T(t), show that the problem reduces to the ordinary differential equations X +k2X =0, X(0)=X (0)=X(1)= X (1)=0, and T +k2T=0, where k2 is the separation constant. Step 2: Solving the eigenvalue problem first, show that where kn denotes the nth root of 22cos(k) ksin (k)=sin(k/2)[sin(k/2) (k/2) cos(k/2)]=0. Step 3: Using the results from Step 2, show that there are two classes of eigenfunctions: n=2n , Xn(x)=1 cos(2n x), and Step 4: Consider the eigenvalue problem X + X =0, 0<x<1, with the boundary conditions X(0)=X (0)=X (1)=X (1)=0. Show that the orthogonality condition for this problem is 24 Taken from Hamza, E.A., 1999: Impulsive squeezing with suction and injection. J. Appl Mech., 66, 945951. The Heat Equation 699 where Xn(x) and Xm(x) are two distinct eigenfunctions of this problem. Then show that we can construct an eigenfunction expansion for an arbitrary function f(x) via and f (x) exists over the interval (0, 1). Hint: Follow the proof in 9.2 and integrate repeatedly by parts to eliminate the higher derivative terms. Step 5: Show that if Xn(x)=1 cos(2n x), and if Xn(x)=1 cos( nx)+2[sin( nx) n x]/ n. Hint: sin( n)= n[1+ cos( n)]/2. Step 6: Use the above results to show that where An is the Fourier coefficient corresponding to the eigenfunction 1 cos(2n x) while Bn is the Fourier coefficient corresponding to the eigenfunction 1 cos( nx) 2[sin( nx) nx]/ n. Step 7: Show that An=0 and so that Hint: sin( n)= n[1+cos( n)]/2, sin( n)=2[1 cos( n)]/ n, and cos( n)= 700 Advanced Engineering Mathematics with MATLAB 11.4 THE LAPLACE TRANSFORM METHOD In the previous chapter we showed that we can solve the wave equation by the method of Laplace transforms. This is also true for the heat equation. Once again, we take the Laplace transform with respect to time. From the definition of Laplace transforms, (11.4.1) (11.4.2) and (11.4.3) We next solve the resulting ordinary differential equation, known as the auxiliary equation, along with the corresponding Laplace transformed boundary conditions. The initial condition gives us the value of u(x, 0). The final step is the inversion of the Laplace transform U(x, s). We typically use the inversion integral. Example 11.4.1 To illustrate these concepts, we solve a heat conduction problem25 in a plane slab of thickness 2L. Initially the slab has a constant temperature of unity. For 0<t, we allow both faces of the slab to radiatively cool in a medium which has a temperature of zero. If u(x, t) denotes the temperature, a2 is the thermal diffusivity, h is the relative emissivity, t is the time, and x is the distance perpendicular to the face of the slab and measured from the middle of the slab, then the governing equation is (11.4.4) with the initial condition u(x, 0)=1, L<x<L, 25 (11.4.5) Goldstein, S., 1932: The application of Heaviside's operational method to the solution of a problem in heat conduction. Zeit. Angew. Math. Mech., 12, 234243. The Heat Equation 701 and boundary conditions (11.4.6) Taking the Laplace transform of (11.4.4) and substituting the initial condition, (11.4.7) If we write s=a2q2, (11.4.7) becomes (11.4.8) From the boundary conditions U(x, s) is an even function in x and we may conveniently write the solution as (11.4.9) From (11.4.6), (11.4.10) and (11.4.11) The inverse of U(x, s) consists of two terms. The first term is simply unity. We will invert the second term by contour integration. We begin by examining the nature and location of the singularities in the second term. Using the product formulas for the hyperbolic cosine and sine functions, the second term equals 702 Advanced Engineering Mathematics with MATLAB (11.4.12) Because q2=s/a2, (11.4.12) shows that we do not have any in the transform and we need not concern ourselves with branch points and cuts. Furthermore, we have only simple poles: one located at s=0 and the others where qsinh(qL)+h cosh(gL)=0. (11.4.13) If we set q=i , (11.4.13) becomes h cos( L) sin( L)=0, (11.4.14) or Ltan( L)=hL. (11.4.15) From Bromwich's integral, (11.4.16) where q=z1/2/a and the closed contour C consists of Bromwich's contour plus a semicircle of infinite radius in the left half of the z-plane. The residue at z=0 is 1 while at (11.4.17) The Heat Equation 703 (11.2.18) (11419 ) (11.4.20) Therefore, the inversion of U(x, s) is (11.4.21) or (11.4.22) We can further simplify (11.4.22) by using h/ n=tan( nL), and hL= Substituting these relationships into (11.4.22) and simplifying, n L tan( nL). (11.4.23) Figure 11.4.1 illustrates (11.4.23). It was created using the MATLAB script clear hL = 1 ; m = 0 ; M = 100 ; dx = 0.05 ; dt = 0.05 ; % 704 Advanced Engineering Mathematics with MATLAB Figure 11.4.1: The temperature within the portion of a slab 0<x/L<1 at various times a2t/L2 if the faces of the slab radiate to free space at temperature zero and the slab initially has the temperature 1. The parameter hL=1. % create initial guess at zero_n % zero = zeros(length(M)); for n = 1:10000 k1 = 0.1*n; k2 = 0.1*(n+1); prod = k1 * tan(k1);y1 = hL - prod;y2 = hL - k2 * tan(k2); if (y1*y2<= 0 & prod <2 & m < M)m = m+1; zero(m) = k1;end; end ; % % use Newton-Raphson method to improve values of zero_n % for n = 1:M; for k = 1:10 f = hL - zero (n) * tan(zero(n)); fp = -tan (zero(n)) - zero(n)*sec(zero(n))^2; zero(n) = zero(n) - f / fp; end; end; % compute Fourier coefficients for m = 1:M a(m) = 2*sin(zero(m))/(zero(m)+sin(zero(m))*cos(zero(m)); end % compute grid and initialize solution X = [0:dx:1]; T = [0:dt:2]; u = zeros(length(T),length(X)); XX=repmat(X,[length(T)1]); TT=repmat(T',[1 length (X)]); The Heat Equation 705 % compute solution from (11.4.23) for m = 1:M u = u + a(m) * cos(zero(m)*XX).*exp(-zero(m) *zero (m)*TT); end surf(XX,TT,u) xlabel('distance','Fontsize',20);ylabel('time','Fontsize',20) zlabel('U(X,T)','Fontsize',20) Example 11.4.2: Heat dissipation in disc brakes Disc brakes consist of two blocks of frictional material known as pads which press against each side of a rotating annulus, usually made of a ferrous material. In this problem we determine the transient temperatures reached in a disc brake during a single brake application.26 If we ignore the errors introduced by replacing the cylindrical portion of the drum by a rectangular plate, we can model our disc brakes as a one-dimensional solid which friction heats at both ends. Assuming symmetry about x=0, the boundary condition there is ux(0, t)=0. To model the heat flux from the pads, we assume a uniform disc deceleration that generates heat from the frictional surfaces at the rate N(1 Mt), where M and N are experimentally determined constants. If u(x, t), , and a2 denote the temperature, thermal conductivity, and diffusivity of the rotating annulus, respectively, then the heat equation is (11.4.24) with the boundary conditions (11.4.25) The boundary condition at x=L gives the frictional heating of the disc pads. Introducing the Laplace transform of u(x, t), defined as (11.4.26) the equation to be solved becomes (11.4.27) 26 From Newcomb, T.P., 1958: The flow of heat in a parallel-faced infinite solid. Brit. J. Appl Phys., 9, 370372. See also Newcomb, T.P., 1958/59: Transient temperatures in brake drums and linings. Proc. Inst. Mech. Eng., Auto. Di ., 227237; Newcomb, T.P., 1959: Transient temperatures attained in disk brakes. Brit. J. Appl. Phys., 10, 339340. 706 Advanced Engineering Mathematics with MATLAB subject to the boundary conditions that (11.4.28) The solution of (11.4.27) is U(x, s)=A cosh(qx)+B sinh(qx), (11.4.29) where q=s1/2/a. Using the boundary conditions, the solution becomes (11.4.30) It now remains to invert the transform (11.4.30). We will invert cosh(qx)/ [sq sinh(qL)]; the inversion of the second term follows by analog. Our first concern is the presence of s1/2 because this is a multivalued function. However, when we replace the hyperbolic cosine and sine functions with their Taylor expansions, cosh(qx)/[sq sinh(qL)] contains only powers of s and is, in fact, a singlevalued function. From Bromwich's integral, (11.4.31) where q=z1/2/a. Just as in the previous example, we replace the hyperbolic cosine and sine with their product expansion to determine the nature of the singularities. The point z=0 is a second-order pole. The remaining poles are located where or 2 2 2 2 1/2 zn= n a /L , where n=1, 2, 3,.... We have chosen the positive sign because z must be single-valued; if we had chosen the negative sign the answer would have been the same. Our expansion also shows that the poles are simple. Having classified the poles, we now close Bromwich's contour, which lies slightly to the right of the imaginary axis, with an infinite semicircle in the left half-plane, and use the residue theorem. The values of the residues are The Heat Equation 707 (11.4.32) (11.4.33) (11.4.34) (11.4.35) (11.4.36) and (11.4.57) (11.4.38) (11.4.39) (11.4.40) When we sum all of the residues from both inversions, the solution is 708 Advanced Engineering Mathematics with MATLAB (11.4.41) Figure 11.4.2 shows the temperature in the brake lining at various places within the lining [x =x/L] if a2=3.3 10 3cm2/sec, =1.8 10 3 cal/(cm secC), L=0.48cm, and N=1.96cal/(cm2 sec). Initially the frictional heating results in an increase in the disc brake's temperature. As time increases, the heating rate decreases and radiative cooling becomes sufficiently large that the temperature begins to fall. Example 11.4.3 In the previous example we showed that Laplace transforms are particularly useful when the boundary conditions are time dependent. Consider now the case when one of the boundaries is moving. We wish to solve the heat equation (11.4.42) subject to the boundary conditions (11.4.43) and the initial condition u(x, 0)=0, 0<x< . (11.4.44) The Heat Equation 709 Figure 11.4.2: Typical curves of transient temperature at different locations in a brake lining. Circles denote computed values while squares are experimental measurements. (From Newcomb, T.P., 1958: The flow of heat in a parallel-faced infinite solid. Brit. J. Appl. Phys., 9, 372 with permission.) This type of problems arises in combustion problems where the boundary moves due to the burning of the fuel. We begin by introducing the coordinate =x t. Then the problem can be reformulated as (11.4.45) subject to the boundary conditions (11.4.46) and the initial condition u( , 0)=0, 0< < . (11.4.47) 710 Advanced Engineering Mathematics with MATLAB Taking the Laplace transform of (11.4.45), we have that (11.4.48) with (11.4.49) The solution to (11.4.48)(11.4.49) is (11.4.50) Because (11.4.51) where (11.4.52) and (11.4.53) we have by the convolution theorem that (11.4.54) or (11.4.55) The Heat Equation 711 Problems 1. Solve subject to the boundary conditions ux(0, t)=ux(1, t)=0, 0<t, and the initial condition u(x, 0)=0, 0<x<1. 2. Solve subject to the boundary conditions ux(0, t)=0, u(1, t)=t, 0<t, and the initial condition u(x, 0)=0, 0<x<1. 3. Solve subject to the boundary conditions u(0, t)=0, u(1, t)=1, 0<t, and the initial condition u(x, 0)=0, 0<x<1. 4. Solve subject to the boundary conditions initial condition 5. Solve and the subject to the boundary conditions u(0, t)=u(1, t)=0, 0<t, and the initial condition u(x, 0)=0, 0<x<1. 6. Solve27 subject to the boundary conditions 27 If u(x, t) denotes the Eulerian velocity of a viscous fluid in the half space x>0 and parallel to the wall located at x=0, then this problem was first solved by Stokes, G.G., 1850: On the effect of the internal friction of fluids on the motions of pendulums. Proc. Cambridge Philos. Soc., 9, Part II, [8][106]. 712 Advanced Engineering Mathematics with MATLAB and the initial condition u(x, 0)=0, 0<x< . [Hint: Use tables to invert the Laplace transform.] 7. Solve subject to the boundary conditions and the initial condition u(x, 0)=0, 0<x< . [Hint: Use tables to invert the Laplace transform.] 8. Solve subject to the boundary conditions and the initial condition u(x, 0)=e x, 0<x< . [Hint: Use tables to invert the Laplace transform.] 9. Solve where is a constant, subject to the boundary conditions and the initial condition u(x, 0)=0, 0<x< . Note that The Heat Equation 713 where erfc is the complementary error function. 10. During their modeling of a chemical reaction with a back reaction, Agmon et al.28 solved subject to the boundary conditions and the initial condition u(x, 0)=0, 0<x< , where d and r denote the intrinsic dissociation and recombination rate coefficients, respectively. What should they have found? 11. Solve29 subject to the boundary conditions and the initial condition u(x, 0)=0, 0<x< , where , , and are constants and . 28 Reprinted with permission from Agmon, N., E.Pines, and D.Huppert, 1988: Geminate recombination in proton-transfer reactions. II. Comparison of diffusional and kinetic schemes. J. Chem. Phys., 88, 56315638. 1988, American Institute of Physics. 29 Reprinted from Bull Math. Biol, 49, G.M.Saidel, E.D.Morris, and G.M.Chisolm, Transport of macromolecules in arterial wall in ivo: A mathematical model and analytic solutions, 153 169. 1987, with permission from Elsevier Science. 714 Advanced Engineering Mathematics with MATLAB 12. Solve subject to the boundary conditions and the initial condition u(x, 0)=u0, 0<x< . 13. Solve subject to the boundary conditions u(0, t)=t, u(L, t)=0, 0<t, and the initial condition u(x, 0)=0, 0<x<L. 14. Solve subject to the boundary conditions u(0, t)=u(L, t)=T0, 0<t, and the initial condition u(x, 0)=T0, 0<x<L. 15. An electric fuse protects electrical devices by using resistance heating to melt an enclosed wire when excessive current passes through it. A knowledge of the distribution of temperature along the wire is important in the design of the fuse. If the temperature rises to the melting point only over a small interval of the element, the melt will produce a small gap, resulting in an unnecessary prolongation of the fault and a considerable release of energy. Therefore, the desirable temperature distribution should melt most of the wire. For this reason, Guile and Carne30 solved the heat conduction equation to understand the temperature structure within the fuse just before meltdown. The second term on the right side of the heat conduction equation gives the resistance heating which 30 From Guile, A.E., and E.B.Carne, 1954: An analysis of an analogue solution applied to the heat conduction problem in a cartridge fuse. AIEE Trans., Part 1, 72, 861868. AIEE (now IEEE). The Heat Equation 715 is assumed to vary linearly with temperature. If the terminals at x=L remain at a constant temperature, which we can take to be zero, the boundary conditions are u(L, t)=u(L, t)=0, 0<t. The initial condition is u(x, 0)=0, L<x<L. Find the temperature field as a function of the parameters a, q, and . 16. Solve31 subject to the boundary conditions and the initial condition u(r, 0)=0, 0<r<1. [Hint: Use the new dependent variable v(r, t)=ru(r, t).] 17. Solve32 subject to the boundary conditions and the initial condition u(r, 0)=u0, b<r< . 18. Consider33 a viscous fluid located between two fixed walls x=L. At x=0 we introduce a thin, infinitely long rigid barrier of mass m per unit area and let it fall under the force of gravity which points in the direction of positive x. We wish to find the velocity of the fluid u( x, t) . The fluid is governed by the partial differential equation 31 32 33 From Reismann, H., 1962: Temperature distribution in a spinning sphere during atmospheric entry. J. Aerosp. Sci., 29, 151159 with permission. Reprinted with permission from Frisch, H.L, and F.C.Collins, 1952: Diffusional processes in the growth of aerosol particles. J. Chem. Phys., 20, 17971803. 1952, American Institute of Physics. Reproduced with acknowledgment to Taylor and Francis, Publishers, from Havelock, T.H., 1921: The solution of an integral equation occurring in certain problems of viscous fluid motion. Philos. Mag., Ser. 6, 42, 620628. 716 Advanced Engineering Mathematics with MATLAB subject to the boundary conditions and the initial condition u(x, 0)=0, 0<x<L. 19. Consider34 a viscous fluid located between two fixed walls x=L. At x=0 we introduce a thin, infinitely long rigid barrier of mass m per unit area. The barrier is acted upon by an elastic force in such a manner that it would vibrate with a frequency if the liquid were absent. We wish to find the barrier's deviation from equilibrium, y(t). The fluid is governed by the partial differential equation The boundary conditions are and the initial conditions are u(x, 0)=0, 0<x<L, and y(0)=A, y (0)=0. 20. Solve35 subject to the boundary conditions ux(0, t)=0, a2ux(L, t)+ u(L, t)=F, 0<t, and the initial condition u(x, 0)=0, 0<x<L. 34 Reproduced with acknowledgment to Taylor and Francis, Publishers, from Havelock, T.H., 1921: On the decay of oscillation of a solid body in a viscous fluid. Philos. Mag., Ser. 6, 42, 628634. Taken from McCarthy, T.A., and H.J.Goldsmid, 1970: Electro-deposited copper in bismuth telluride. J. Phys. D, 3, 697706. Reprinted with the permission of IOP Publishing Limited. 35 The Heat Equation 717 21. Solve subject to the boundary conditions and the initial condition u(x, 0)=0, 0 x<1. 22. Solve36 the partial differential equation where V is a constant, subject to the boundary conditions u(0, t)=1, ux(1, t)=0, 0<t, and the initial condition u(x, 0)=0, 0<x<1. 23. Solve subject to the boundary conditions and the initial condition u(r, 0)=0, 0 r<a, where (t) is the Dirac delta function. Note that Jn(iz)=inIn(z) and In(iz)=inJn(z) for all complex z. 24. Solve 36 Reprinted from Solar Energy, 56, H.Yoo and E.-T.Pak, Analytical solutions to a one-dimensional finite-domain model for stratified thermal storage tanks, 315322, 1996, with kind permission from Elsevier Science Ltd, The Boulevard, Langford Lane, Kidlington OX5 1GB, UK. 718 Advanced Engineering Mathematics with MATLAB subject to the boundary conditions l and the initial condition u(r, 0)=0, 0 r<a. Note that Jn(iz)=inIn(z) and In(iz)=inJn(z) for al complex z. 25. Solve subject to the boundary conditions and the initial condition u(r, 0)=1, 0 r< . Note that Jn(iz)=inIn(z) and In(iz)=inJn(z) for all complex z. 26. Solve subject to the boundary conditions and the initial condition u(r, 0)=0, 0 r<b. Note that Jn(iz)=inIn(z) and In(iz)=inJn(z) for all complex z. 27. Solve the nonhomogeneous heat equation for the spherical shell37 subject to the boundary conditions 37 Abstracted with permission from Malkovich, R.Sh., 1977: Heating of a spherical shell by a radial current. Sov. Phys. Tech. Phys., 22, 636. 1977 American Institute of Physics. The Heat Equation 719 and the initial condition u(r, 0)=0, <r< . Step 1: By introducing (r, t)=ru(r, t), show that the problem simplifies to subject to the boundary conditions and the initial condition (r, 0)=0, <r< . Step 2: Using Laplace transforms and variation of parameters, show that the Laplace transform of u(r, t) is where and = a. Step 3: Take the inverse of U(r, s) and show that where n is the nth root of a +tan( )=0, and =1+ /. 720 Advanced Engineering Mathematics with MATLAB 11.5 THE FOURIER TRANSFORM METHOD We now consider the problem of one-dimensional heat flow in a rod of infinite length with insulated sides. Although there are no boundary conditions because the slab is of infinite extent, we do require that the solution remains bounded as we go to either positive or negative infinity. The initial temperature within the rod is u(x, 0)=f(x). Employing the product solution technique of 11.3, u(x, t)=X(x)T(t) with T +a2 T=0, and X + X=0. (11.5.1) (11.5.2) Solutions to (11.5.1)(11.5.2) which remain finite over the entire x-domain are X(x)=E cos(kx)+F sin(kx), (11.5.3) and T(t)=C exp(k2a2t). (11.5.4) Because we do not have any boundary conditions, we must include all possible values of k. Thus, when we sum all of the product solutions according to the principle of linear superposition, we obtain the integral (11.5.5) We can satisfy the initial condition by choosing (11.5.6) The Heat Equation 721 and (11.5.7) because the initial condition has the form of a Fourier integral (11.5.8) when t=0. Several important results follow by rewriting (11.5.8) as (11.5.9) Combining terms, (11.5.10) (11.5.11) Reversing the order of integration, (11.5.12) The inner integral is called the source function. We may compute its value through an integration on the complex plane; it equals (11.5.13) 722 Advanced Engineering Mathematics with MATLAB if 0<t. This gives the final form for the temperature distribution: (11.5.14) Example 11.5.1 Let us find the temperature field if the initial distribution is (11.5.15) Then (11.5.16) (11.5.17) (11.5.18) (11.5.19) where erf is the error function. Example 11.5.2: Kelvin's estimate of the age of the earth In the middle of the nineteenth century Lord Kelvin38 estimated the age of the earth using the observed vertical temperature gradient at the earth's surface. He hypothesized that the earth was initially formed at a uniform high temperature T0 and that its surface was subsequently maintained at the lower temperature of TS. Assuming that most of the heat conduction occurred near the earth's surface, he reasoned that he could neglect the curvature of the earth, consider the earth's surface planar, and employ our one-dimensional heat conduction model in the vertical direction to compute the observed heat flux. Following Kelvin, we model the earth's surface as a flat plane with an infinitely deep earth below (z>0). Initially the earth has the temperature T0. Suddenly we drop the temperature at the surface to TS. We wish to find 38 Thomson, W., 1863: On the secular cooling of the earth. Philos. Mag., Ser. 4, 25, 157170. The Heat Equation 723 the heat flux across the boundary at z=0 from the earth into an infinitely deep atmosphere. The first step is to redefine our temperature scale (z, t)=u(z, t)+TS, where (z, t) is the observed temperature so that u(0, t)=0 at the surface. Next, in order to use (11.5.14), we must define our initial state for z<0. To maintain the temperature u(0, t)=0, the initial temperature field f(z) must be an odd function or (11.5.20) From (11.5.14) (11.5.21) (11.5.22) following the work in the previous example. The heat flux q at the surface z=0 is obtained by differentiating (11.5.22) according to Fourier's law and evaluating the result at z=0: (11.5.23) The surface heat flux is infinite at t=0 because of the sudden application of the temperature TS at t=0. After that time, the heat flux decreases with time. Consequently, the time t at which we have the temperature gradient (0, t)/ z is (11.5.24) 724 Advanced Engineering Mathematics with MATLAB For the present near-surface thermal gradient of 25K/km, T0 TS=2000K, and a2=1mm2/s, the age of the earth from (11.5.24) is 65 million years. Although Kelvin realized that this was a very rough estimate, his calculation showed that the earth had a finite age. This was in direct contradiction to the contemporary geological principle of uniformitarianism that the earth's surface and upper crust had remained unchanged in temperature and other physical quantities for millions and millions of years. The resulting debate would rage throughout the latter half of the nineteenth century and feature such luminaries as Kelvin, Charles Darwin, Thomas Huxley, and Oliver Heaviside.39 Eventually Kelvin's arguments would prevail and uniformitarianism would fade into history. Today, Kelvin's estimate is of academic interest because of the discovery of radioactivity at the turn of the twentieth century. During the first half of the twentieth century, geologists assumed that the radioactivity was uniformly distributed around the globe and restricted to the upper few tens of kilometers of the crust. Using this model they would then use observed heat fluxes to compute the distribution of radioactivity within the solid earth.40 Today we know that the interior of the earth is quite dynamic; the oceans and continents are mobile and interconnected according to the theory of plate tectonics. However, geophysicists still use measured surface heat fluxes to infer the interior41 of the earth. Example 11.5.3 So far we have shown how a simple application of separation of variables and the Fourier transform yields solutions to the heat equation over the semi-infinite interval (0, ) via (11.5.5). Can we still use this technique for more complicated versions of the heat equation? The answer is yes but the procedure is more complicated. We illustrate it by solving42 (11.5.25) subject to the boundary conditions (11.5.26) (11.5.27) 39 40 41 See Burchfield, J.D., 1975: Lord Kelvin and the Age of the Earth. Science History Publ., 260 pp. See Slichter, L.B., 1941: Cooling of the earth. Bull Geol Soc. Am., 52, 561600. Sclater, J.G., C.Jaupart, and D.Galson, 1980: The heat flow through oceanic and continental crust and the heat loss of the earth. Re . Geophys. Space Phys., 18, 269311. The Heat Equation 725 and the initial condition u(x, 0)=0, 0<x< . (11.5.28) We begin by multiplying (11.5.25) by sin(kx) and integrating over x from 0 to : (11.5.29) Next, we integrate by parts. For example, (11.5.30) (11.5.31) (11.5.32) =kf(t) k2U(k, t), (11.5.33) where (11.5.34) Taken from Fetec u, C., and J.Zierep, 2001: On a class of exact solutions of the equations of motion of a second grade fluid. Acta Mech., 150, 135138. 42 726 Advanced Engineering Mathematics with MATLAB and the boundary conditions have been used to simplify (11.5.30) and (11.5. 32). Equation (11.5.34) is the definition of the Fourier sine transform. It and its mathematical u(x, t) cos(kx) dx, are analogous to the cousin, the Fourier cosine transform half-range sine and cosine expansions that appear in solving the heat equation over the finite interval (0, L). The difference here is that our range runs from 0 to . Applying the same technique to the other terms, we obtain [kf (t)k2U (k, t)]+a2[kf(t)k2U(k, t)]=U (k, t) (11.5.35) with U(k, 0)=0, where the primes denote differentiation with respect to time. Solving (11.5.35), (11.5.36) Using integration by parts on the second integral in (11.5.36), we find that (11.5.37) Because (11.5.38) (11.5.39) The Heat Equation 727 (11.5.40) Problems For Problems 14, find the solution of the heat equation subject to the stated initial conditions. 2. u(x, 0)=e b|x| 4. u(x, 0)= (x) Lovering43 has applied the solution to Problem 1 to cases involving the cooling of lava. 5. Solve the spherically symmetric equation of diffusion,44 with u(r, 0)=u0 (r). Step 1: Assuming v(r, t)=ru(r, t), show that the problem can be recast as 43 44 Lovering, T.S., 1935: Theory of heat conduction applied to geological problems. Bull. Geol Soc. Am., 46, 6994. From Shklovskii, I.S., and V.G.Kurt, 1960: Determination of atmospheric density at a height of 430km by means of the diffusion of sodium vapors. ARS J., 30, 662667 with permission. 728 Advanced Engineering Mathematics with MATLAB with v(r, 0)=r u0(r). Step 2: Using (11.5.14), show that the general solution is Hint: What is the constraint on (11.5.14) so that the solution remains radially symmetric? Step 3: For the initial concentration of show that where erf is the error function. 11.6 THE SUPERPOSITION INTEGRAL In our study of Laplace transforms, we showed that we can construct solutions to ordinary differential equations with a general forcing f(t) by first finding the solution to a similar problem where the forcing equals Heaviside's step function. Then we can write the general solution in terms of a superposition integral according to Duhamel's theorem. In this section we show that similar considerations hold in solving the heat equation with time-dependent boundary conditions or forcings. Let us solve the heat condition problem (11.6.1) with the boundary conditions u(0, t)=0, u(L, t)=f(t), 0<t, (11.6.2) The Heat Equation 729 and the initial condition u(x, 0)=0, 0<x<L. (11.6.3) The solution of (11.6.1)(11.6.3) is difficult because of the time-dependent boundary condition. Instead of solving this system directly, let us solve the easier problem (11.6.4) with the boundary conditions A(0, t)=0, A(L, t)=1, 0<t, (11.6.5) and the initial condition A(x, 0)=0, 0<x<L. (11.6.6) Separation of variables yields the solution (11.6.7) Consider the following case. Suppose that we maintain the temperature at zero at the end x=L until t= 1 and then raise it to the value of unity. The resulting temperature distribution equals zero everywhere when t< 1 and equals A(x, t 1 ) for t> 1. We have merely shifted our time axis so that the initial condition occurs at t= 1. Consider an analogous, but more complicated, situation of the temperature at the end position x=L held at f(0) from t=0 to t= 1 at which time we abruptly change it by the amount f( 1)f(0) to the value f( 1). This temperature remains until t= 2 when we again abruptly change it by an amount f( 2)f( 1). We can imagine this process continuing up to the instant t= n. Because of linear superposition, the temperature distribution at any given time equals the sum of these temperature increments: u(x, t)=f(0)A(x, t)+[f( 1)f(0)]A(x, t 1)+[f( 2)f( 1)]A(x, t 2) +...+[f( n)f( n 1)]A(x, t n), (11.6.8) 730 Advanced Engineering Mathematics with MATLAB where n is the time of the most recent temperature change. If we write fk=f( k)f( k 1 ), and k = k k1 , (11.6.9) (11.6.8) becomes (11.6.10) 0, (11.6.10) becomes Consequently, in the limit of k (11.6.11) assuming that f(t) is differentiable. Equation (11.6.11) is the superposition integral. We can obtain an alternative form by integration by parts: (11.6.12) or (11.6.13) because (11.6.14) To illustrate the superposition integral, suppose f(t)=t. Then, by (11.6.11), (11.6.15) (11.6.16) The Heat Equation 731 Example 11.6.1: Temperature oscillations in a wall heated by an alternating current In addition to finding solutions to heat conduction problems with timedependent boundary conditions, we can also apply the superposition integral to the nonhomogeneous heat equation when the source depends on time. Jeglic45 used this technique in obtaining the temperature distribution within a slab heated by alternating electric current. If we assume that the flat plate has a surface area A and depth L, then the heat equation for the plate when electrically heated by an alternating current of frequency is (11.6.17) where q is the average heat rate caused by the current, 2 is the density, Cp is the specific heat at constant pressure, and a is the diffusivity of the slab. We will assume that we insulated the inner wall so that (11.6.18) bigskip while we allow the outer wall to radiatively cool to free space at the temperature of zero or (11.6.19) where is the thermal conductivity and h is the heat transfer coefficient. The slab is initially at the temperature of zero or u(x, 0)=0, 0<x<L. (11.6.20) 45 Jeglic, F.A., 1962: An analytical determination of temperature oscillations in a wall heated by alternating current. NASA Tech. Note No. D-1286. In a similar vein, Al-Nimr and Abdallah [Al-Nimr, M.A., and M.R.Abdallah, 1999: Thermal behavior of insulated electric wires producing pulsating signals. Heat Transfer Engng., 20(4), 6274] have found the heat transfer with an insulated wire that carries an alternating current. 732 Advanced Engineering Mathematics with MATLAB To solve the heat equation, we first solve the simpler problem of (11.6.21) with the boundary conditions (11.6.22) and the initial condition A(x, 0)=0, 0<x<L. (11.6.23) The solution A(x, t) is the indicial admittance because it is the response of a system to forcing by the step function H(t). We solve (11.6.21)(11.6.23) by separation of variables. We begin by assuming that A(x, t) consists of a steady-state solution (x) plus a transient solution (x, t), where 2 (x)=1, (0)=0, (L)+h (L)=0, (11.6.24) (11.6.25) and (x, 0)=w(x). (11.6.26) Solving (11.6.24), (11.6.27) The Heat Equation 733 Table 11.6.1: The First Six Roots of the Equation kn tan (kn)=h* h* 0.001 0.002 0.005 0.010 0.020 0.050 0.100 0.200 0.500 1.000 2.000 5.000 10.000 20.000 k1 0.03162 0.04471 0.07065 0.09830 0.14095 0.22176 0.31105 0.43284 0.65327 0.86033 1.07687 1.31384 1.42887 1.49613 1.57080 k2 3.14191 3.14223 3.14318 3.14477 3.14795 3.15743 3.17310 3.20393 3.29231 3.42562 3.64360 4.03357 4.30580 4.49148 4.71239 k3 6.28334 6.28350 6.28398 6.28478 6.28637 6.29113 6.29906 6.31485 6.36162 6.43730 6.57833 6.90960 7.22811 7.49541 7.85399 k4 9.42488 9.42499 9.42531 9.42584 9.42690 9.43008 9.43538 9.44595 9.47748 9.52933 9.62956 9.89275 10.20026 10.51167 10.99557 k5 12.56645 12.56653 12.56677 12.56717 12.56796 12.57035 12.57432 12.58226 12.60601 12.64529 12.72230 12.93522 13.21418 13.54198 14.13717 k6 15.70803 15.70809 15.70828 15.70860 15.70924 15.71115 15.71433 15.72068 15.73972 15.77128 15.83361 16.01066 16.25336 16.58640 17.27876 Turning to the transient solution (x, t), we use separation of variables and find that (11.6.28) where kn is the nth root of the transcendental equation: kn tan(kn)=hL/ = h*. Table 11.6.1 gives the first six roots for various values of hL/ . Our final task is to compute Cn. After substituting t=0 into (11.6.28), we are left with a orthogonal expansion of w(x) using the eigenfunctions cos(knx/L). From (9.3.4), (11.6.29) (11.6.30) 734 Advanced Engineering Mathematics with MATLAB Combining (11.6.28) and (11.6.30), (11.6.31) Consequently, A(x, t) equals (11.6.32) We now wish to use the solution (11.6.32) to find the temperature distribution within the slab when it is heated by a time-dependent source f(t). As in the case of time-dependent boundary conditions, we imagine that we can break the process into an infinite number of small changes to the heating which occur at the times t= 1, t= 2, etc. Consequently, the temperature distribution at the time t following the change at t= at t= n+1 n and before the change is (11.6.33) where fk=f( k)f( k 1 ) and k = k k1 . (11.6.34) In the limit of k 0, (11.6.35) (11.6.36) In our present problem, (11.6.37) The Heat Equation 735 Therefore, (11.6.38) (11.6.39) (11.6.40) Figure 11.6.1: The nondimensional temperature a2 ApCpu(x, t)/qL within a slab that we heat by alternating electric current as a function of position x/L and time a2t/L2 when we insulate the x=0 end and let the x=L end radiate to free space at temperature zero. The initial temperature is zero, hL/k=1, and a2/(L2 )=1. 736 Advanced Engineering Mathematics with MATLAB Figure 11.6.1 illustrates (11.6.40) for hL/ =1, and a2/(L2 )=1. This figure was created using the MATLAB script [gaXo XpnUltaoUlhacXE4 D 3A dUprXo D 3A h D 2A F D 32A ]x D 203A ]r D 203A % % [oaXra eiereXg csapp Xr fUi % zaol D zaolp )gaicrd)F**A blo i D 3=32222 f3 D 203+iA f4 D 203+ )i,3*A mol] D f3 + rXi)f3*A y3 D dUprXo / mol]A y4 D dUprXo / f4 + rXi)f4*A eb)y3+y4 CD 2 ( mol] C 4 ( h C F* h D h,3A zaol)h* D f3A ai]A ai]A % % spa Iaurli/LXmdpli hardl] rl ehmolta tXgsap lb fUi % blo i D 3=FA blo f D 3=32 b D dUprXo'zaol)i* + rXi)zaol)i**A bm D ' rXi)zaol)i** ' zaol)i*+pa[)zaol)i**T4A zaol)i* D zaol)i* ' b 1 bmA ai] A ai] A % [lhmsra coe] Xi] eiereXgeza plgsreli N D O2=]x=3SA M D O2=]r=;SA rahm3 D )20: , 31dUprXo*+liap)3.3aicrd)N** / 20:+N0+NA rahm4 D liap)3. gaicrd)M** / [lp)4+M*A s D rahm3' + rahm4A NN D N' + liap)3.gaicrd)M**A MM D liap )3.gaicrd)N**'+MA % [lhmsra plgsreli bolh )330;052* blo h D3=F xrahm3 D zaol)h*+zaol)h*A xrahm4 D 5 , asq_over_omegaL2*asq_over_omegaL2*xtempl*xtempl; xtemp3 = asq_over_omegaL2 * xtemp1; xtemp4 = zero(m) + sin(2*zero (m))/2; xtemp5 = asq_over_omegaL2 * xtemp1; aaaaa = 4 * sin(zero(m))/(xtemp1 * xtemp2 * xtemp4); u = u aaaaa * cos (zero(m)*X)'... *(xtemp5*sin(2*T) - 2 * cos(2*T) + 2* exp(-xtemp5 * T)); The Heat Equation 737 end surf(XX,TT,u) xlabel('DISTANCE','Fontsize',20);ylabel('TIME','Fontsize',20) zlabel('SOLUTION','Fontsize',20) The oscillating solution, reflecting the periodic heating by the alternating current, rapidly reaches equilibrium. Because heat is radiated to space at x=L, the temperature is maximum at x=0 at any given instant as heat flows from x=0 to x=L. Example 11.6.2 Consider the following heat conduction problem with time-dependent forcing and/or boundary conditions: (11.6.41) B(u)=g(Q, t), 0<t, (11.6.42) and u(P, 0)=h(P), where (11.6.43) (11.6.44) (11.6.45) P denotes an arbitrary interior point at (x1, x2, x3) of a region R, and Q is any point on the boundary of R. Here ci, Ci, and Ki are functions of x1, x2, and x3 only. Many years ago, Bartels and Churchill46 extended Duhumel's theorem to solve this heat conduction problem. They did this by first introducing the simpler initialboundary-value problem: 46 Bartels, R.C.F., and R.V.Churchill, 1942: Resolution of boundary problems by the use of a generalized convolution. Am. Math. Soc. Bull., 48, 276282. 738 Advanced Engineering Mathematics with MATLAB (11.6.46) B( )=g(Q, t1), 0<t, and (P, 0)=h(p), (11.6.48) (11.6.47) which has a constant forcing and boundary conditions in place of the timedependent ones. Here t1 denotes an arbitrary but fixed instant of time. Then Bartels and Churchill proved that the solution to the original problem is given by the convolution integral (11.6.49) To illustrate47 this technique, let us solve (11.6.50) subject to the boundary conditions (11.6.51) and the initial condition u(r, 0)=u0, <r< . We begin by solving the alternative problem (11.6.52) subject to the boundary conditions 47 Reprinted with permission from Reiss, H., and V.K.LaMer, 1950: Diffusional boundary value problems involving moving boundaries, connected with the growth of colloidal particles. J. Chem. Phys., 18, 112. 1950, American Institute of Physics. The Heat Equation 739 (11.6.53) and the initial condition (r, 0, t )=u0, a<r< , or equivalently (11.6.54) subject to the boundary conditions (11.6.55) and the initial condition w(r, 0, t )=u0(1 e ct ), <r< , where (r, t, t )=u0e ct +w(r, t, t ). The heat condition problem (11.6.54)(11.6.55) can be solved using separation of variables. Following example 11.3.6, we find that (11.6.56) where kn is the nth root of k=tan[k( a)], and 2cn={ sin2 [kn( a)] }. Therefore, (11.6.58) (11.6.59) 740 Advanced Engineering Mathematics with MATLAB (11.6.60) and the final answer is (11.6.61) Problems 1. Solve the heat equation 48 subject to the boundary conditions u(0, t)=u(L, t)=f(t), 0<t, and the initial condition u(x, 0)=0, 0<x<L. Step 1: First solve the heat conduction problem subject to the boundary conditions A(0, t)=A(L, t)=1, 0<t, and the initial condition A(x, 0)=0, 0<x<L. Show that Step 2: Use Duhamel's theorem and show that 2. A thermometer measures temperature by the thermal expansion of a liquid (usually mercury or alcohol) stored in a bulb into a glass stem containing an empty cylindrical 48 From Tao, L.N., 1960: Magnetohydrodynamic effects on the formation of Couette flow. J. Aerosp. Sci, 27, 334338 with permission. The Heat Equation 741 channel. Under normal conditions, temperature changes occur sufficiently slow so that the temperature within the liquid is uniform. However, for rapid temperature changes (such as those that would occur during the rapid ascension of an airplane or meteorological balloon), significant errors could occur. In such situations the recorded temperature would lag behind the actual temperature because of the time needed for the heat to conduct in or out of the bulb. During his investigation of this question, McLeod49 solved subject to the boundary conditions limr0 |u(r, t)|< , and u(b, t)= (t), 0<t, and the initial condition u(r, 0)=0, 0<r<b. The analysis was as follows: Step 1: First solve the heat conduction problem subject to the boundary conditions limr0 |A(r, t)|< , and A(b, t)=1, 0<t, and the initial condition A(r, 0)=0, 0 r<b. Show that where J0(kn)=0. Step 2: Use Duhamel's theorem and show that 49 Reproduced with acknowledgment to Taylor and Francis, Publishers, from McLeod, A.R., 1919: On the lags of thermometers with spherical and cylindrical bulbs in a medium whose temperature is changing at a constant rate. Philos. Mag., Ser. 6, 37, 134144. See also Bromwich, T.J. I'A., 1919: Examples of operational methods in mathematical physics. Philos. Mag., Ser. 6, 37, 407419; McLeod, A.R., 1922: On the lags of thermometers. Philos. Mag., Ser. 6, 43, 4970. 742 Advanced Engineering Mathematics with MATLAB Step 3: If (t)=Gt, show that McLeod found that for a mercury thermometer of 10-cm length a lag of 0.01C would occur for a warming rate of 0.032C s 1 (a warming gradient of 1.9C per thousand feet and a descent of one thousand feet per minute). Although this is a very small number, when he included the surface conductance of the glass tube, the lag increased to 0.85C. Similar problems plague bimetal thermometers50 and thermistors51 used in radiosondes (meteorological sounding balloons). 3. A classic problem52 in fluid mechanics is the motion of a semi-infinite viscous fluid that results from the sudden movement of the adjacent wall starting at t=0. Initially the fluid is at rest. If we denote the velocity of the fluid parallel to the wall by u(x, t), the governing equation is with the boundary conditions u(0, t)=V(t), limx u(x, t)0, 0<t, and the initial condition u(x, 0)=0, 0<x< . Step 1: Find the step response by solving subject to the boundary conditions and the initial condition A(x, 0)=0, 0<x< . Show that 50 51 52 Mitra, H., and M.B.Datta, 1954: Lag coefficient of bimetal thermometer of chronometric radiosonde. Indian J. Meteorol. Geophys., 5, 257261. Badgley, F.I., 1957: Response of radiosonde thermistors. Re . Sci. Instrum., 28, 10791084. This problem was first posed and partially solved by Stokes, G.G., 1850: On the effect of the internal friction of fluids on the motions of pendulums. Proc. Cambridge Philos. Soc., 9, Part II, [8][106], The Heat Equation 743 where erfc is the complementary error function. Hint: Use Laplace transforms. Step 2: Use Duhamel's theorem and show that the solution is 4. During their study of the propagation of a temperature step in a nearly supercritical, van der Waals gas, Zappoli and Durand-Daubin53 solved with the boundary conditions condition u(x, 0)=0, 0<x< , where u0 is a constant. Step 1: Find the step response by solving limx u(x, t)0, 0<t, and the initial subject to the boundary conditions A(0, t)=1, limx condition A(x, 0)=0, 0<x< . Show that A(x, t) 0, 0<t, and the initial where erfc is the complementary error function. Hint: Use Laplace transforms. Step 2: Use Duhamel's theorem and show that the solution is 53 Reprinted with permission from Zappoli, B., and A.Durand-Daubin, 1994: Heat- and mass transport in a near supercritical fluid. Phys. Fluids, 6, 19291936. 1994, American Institute of Physics. 744 Advanced Engineering Mathematics with MATLAB 5. Solve the heat equation subject to the boundary conditions u(0, t)=f(t), ux(1, t)= hu(1, t), 0<t, and the initial condition u(x, 0)=0, 0<x<1. Step 1: First solve the heat conduction problem subject to the boundary conditions A(0, t)=1, Ax(1, t)= hA(1, t), 0<t, and the initial condition A(x, 0)=0, 0<x<1. Show that where kn is the nth root of k cot(k)= h. Step 2: Use Duhamel's theorem and show that 11.7 NUMERICAL SOLUTION OF THE HEAT EQUATION In the previous chapter we showed how we may use finite difference techniques to solve the wave equation. In this section we show that similar considerations hold for the heat equation. Starting with the heat equation (11.7.1) we must first replace the exact derivatives with finite differences. Drawing upon our work in 10.6, (11.7.2) The Heat Equation 745 Figure 11.7.1: Schematic of the numerical solution of the heat equation when we hold both ends at a temperature of zero. and (11.7.3) where the notation denotes u(xm, tn). Figure 11.7.1 illustrates our numerical scheme when we hold both ends at the temperature of zero. Substituting (11.7.2)(11.7.3) into (11.7.1) and rearranging, (11.7.4) and are The numerical integration begins with n=0 and the value of giyen by f(m x). Once again we must check the convergence, stability, and consistency of our scheme. We begin by writing and in terms of the exact solution u and its derivatives evaluated at the point xm=m x and tn=n t. By Taylor's expansion, (11.7.5) and (11.7.6) 746 Advanced Engineering Mathematics with MATLAB (11.7.7) Substituting into (11.7.4), we obtain (11.7.8) The first term on the right side of (11.7.8) vanishes because u(x, t) satisfies the heat equation. Thus, in the limit of x0, t0, the right side of (11.7.8) vanishes and the scheme is consistent. To determine the stability of the explicit scheme, we again use the Fourier method. Assuming a solution of the form: (11.7.9) we substitute (11.7.9) into (11.7.4) and find that (11.7.10) or (11.7.11) The quantity ei will grow exponentially unless (11.7.12) The right inequality is trivially satisfied if a2 t/( x)2>0, while the left inequality yields (11.7.13) The Heat Equation 747 leading to the stability condition This is a rather restrictive condition because doubling the resolution (halving x) requires that we reduce the time step by a quarter. Thus, for many calculations the required time step may be unacceptably small. For this reason, many use an implicit form of the finite differencing (CrankNicholson implicit method54): (11.7.14) Figure 11.7.2: The growth of error ||en|| as a function of a2t for various resolutions. For the top line, x=0.1; for the middle line, x=0.01; and for the bottom line, x=0.001. although it requires the solution of a simultaneous set of linear equations. However, there are several efficient methods for their solution. Finally we must check and see if our explicit scheme converges to the true solution. If we let denote the difference between the exact and our finite differenced solution to the heat equation, we can use (11.7.8) to derive the equation governing and find that (11.7.15) 54 Crank, J., and P.Nicholson, 1947: A practical method for numerical evaluation of solutions of partial differential equations of the heat-conduction type. Proc. Cambridge. Philos. Soc., 43, 5067. 748 Advanced Engineering Mathematics with MATLAB for m=1, 2,..., M. Assuming that then (11.7.16) ||en||+A[( t)2+ t( x)2], where Consequently, ||en+1|| ||en||+A[( t)2+ t( x)2]. Because ||e0||=0 and n t tn, we find that ||en+1|| An[( x)2] Atn[ t+( x)2]. (11.7.17) (11.7.18) (11.7.19) As x0, t0, the errors tend to zero and we have convergence. We have illustrated (11.7.19) in Figure 11.7.2 by using the finite difference equation (11.7.4) to compute ||en|| during a numerical experiment that used a2 t/( x)2=0.5, and f(x)=sin( x). Note how each increase of resolution by 10 results in a drop in the error by 100. The Heat Equation 749 Figure 11.7.3: The numerical solution u(x, t) of the heat equation with a2 t/( x)2= 0.47 at various positions x =x/L and times t =a2t/L2 using (11.7.4). The initial temperature u(x, 0) equals 4x (1x ) and we hold both ends at a temperature of zero. The following examples illustrate the use of numerical methods. Example 11.7.1 For our first example, we redo Example 11.3.1 with a2 t/( x)2=0.47 and 0.53. Our numerical solution was computed using the MATLAB script clear coeff = 0.47; % coeff = a2t/(x)2 ncount = 1; dx = 0.1; dt = coeff * dx * dx; N = 99; x = 0: dx:1; M = 1/dx + 1; % M = number of spatial grid points tplot(1) = 0; u = zeros (M,N+1); for m = 1:M; u (m,1)=4*x(m)*(1-x(m));temp(m,1)=u(m,1); end % integrate forward in time for n = 1:N t = dt * n; for m = 2 : M-1 u(m,n+1) = u(m,n) + coeff*(u(m+1,n) - 2 * u(m,n) + u(m-1,n)); end if mod(n+1,2) == 0 ncount = ncount + 1; tplot(ncount) =t; for m = 1:M; temp(m,ncount) = u(m,n+1); end end; end 750 Advanced Engineering Mathematics with MATLAB Figure 11.7.4: Same as Figure 11.7.3 except that a2 t/( x)2=0.53. % plot the numerical solution X = x' * ones(1,length(tplot)); T = ones(M,1)* tplot; surf (X,T,temp) xlabel('DISTANCE','Fontsize',20);ylabel('TIME','Fontsize',20) zlabel('TEMPERATURE','Fontsize',20) As Figure 11.7.3 shows, the solution with a2 t/( x)2<1/2 performs well. On the other hand, Figure 11.7.4 shows small-scale, growing disturbances when a2 t/( x)2>1/2. It should be noted that for he reasonable x= L/100, it takes approximately 20,000 time steps before we reach a2t/L2=1. Example 11.7.2 In this example, we redo the previous example with an insulated end at x=L. Using the centered differencing formula, (11.7.20) The Heat Equation 751 because ux(L, t)=0. Also, at i=M, (11.7.21) Eliminating between the two equations, (11.7.22) Figure 11.7.5: Same as Figure 11.7.4 except that we now have an insulated boundary condition ux(L, t)=0. To implement this new boundary condition in our MATLAB script, we add the line u(M,n+1) = u(M,n) + 2 * coeff * (u(M-1,n) - u(M,n)); after the lines for m = 2:M-1 u(m,n+1)=u(m,n) + coeff * (u(m+1,n) - 2 * u(m,n) + u (m-1,n)); end Figure 11.7.5 illustrates our numerical solution at various positions and times. Project: Implicit Numerical Integration of the Heat Equation The difficulty in using explicit time differencing to solve the heat equation is the very small time step that must be taken at moderate spatial resolutions to ensure stability. This small time step translates into an unacceptably long execution time. In this project you will investigate the Crank-Nicholson implicit scheme which allows for a much more reasonable time step. 752 Advanced Engineering Mathematics with MATLAB Step 1: Develop a MATLAB script that uses the Crank-Nicholson equation (11.7.14) to numerically integrate the heat equation. To do this, you will need a tridiagonal solver to find This is explained at the end of 14.1. However, many numerical methods 55 books actually have code already developed for your use. You might as well use this code. Figure 11.7.6: The numerical solution u(x, t) of the heat equation ut=a2uxx using the Crank-Nicholson method. The parameters used in the numerical solution are a2 t=0.005 and x=0.05. Both ends are held at zero with an initial condition of u(x, 0)=0 for and Step 2: Test your code by solving the heat equation given the initial condition u(x, 0)=sin( x), and the boundary conditions u(0, t)=u(1, t)=0. Find the solution for various values of t with x=0.01. Compare this numerical solution against the exact solution which you can find. How does the error (between the numerical and exact solutions) change with t? For small t, the errors should be small. If not, then you have a mistake in your code. Step 3: Once you have confidence in your code, discuss the behavior of the scheme for various values of x and t for the initial condition u(x, 0)=0 for 0)=1 for and u(x, with the boundary conditions u(0, t)=u(1, t)=0. 55 For example, Press, W.H., B.P.Flannery, S.A.Teukolsky, and W.T.Vetterling, 1986: Numerical Recipes: The Art of Scientific Computing. Cambridge University Press, 2.6. The Heat Equation 753 Although you can take quite a large t, what happens? Did a similar problem arise in Step 2? Explain your results. Zvan et al.56 have reported a similar problem in the numerical integration of the Black-Scholes equation from mathematical finance. 56 Zvan, R., K.Vetzal, and P.Forsyth, 1998: Swing low, swing high. Risk, 11(3), 7175. Chapter 12 Laplace's Equation In the previous chapter we solved the one-dimensional heat equation. Quite often we found that the transient solution died away, leaving a steady state. The partial differential equation that describes the steady state for two-dimensional heat conduction is Laplace's equation (12.0.1) In general, this equation governs physical processes where equilibrium has been reached. It also serves as the prototype for a wider class of elliptic equations (12.0.2) where b2<4ac. Unlike the heat and wave equations, there are no initial conditions and the boundary conditions completely specify the solution. In this chapter we present some of the common techniques for solving this equation. 12.1 DERIVATION OF LAPLACE'S EQUATION Imagine a thin, flat plate of heat-conducting material between two sheets of insulation. Sufficient time has passed so that the temperature depends only on the spatial coordinates x and y. Let us now apply the law of conservation of energy (in rate form) to a small rectangle with sides x and y. If qx (x, y) and qy (x, y) denote the heat flow rates in the x- and y-direction, respectively, conservation of energy requires that the heat flow into the slab equals the heat flow out of the slab if there is no storage or generation of heat. Now rate in=qx(x, y+ y/2) y+qy(x+ x/2, y) x, (12.1.1) and rate out=qx(x+ z, y+ y/2) y+qy(x+ x/2, y+ y) x. (12.1.2) Laplace's Equation 755 If the plate has unit thickness, [qx(x, y+ y/2)+ y/2)qx(x+ x, y+ y/2)] y +[qy(x+ x/2, y)qy(x+ x/2, (12.1.3) y+ y)] x=0. Upon dividing through by x y we obtain two differences quotients on the left side of (12.1.3). In the limit as x, y0, they become partial derivatives, giving (12.1.4) for any point (x, y). We now employ Fourier's law to eliminate the rates qx and qy, yielding (12.1.5) if we have an isotropic (same in all directions) material. Finally, if a2 is constant, (12.1.5) reduces to (12.1.6) which is the two-dimensional, steady-state heat equation (i.e., ut 0 as t ). Solutions of Laplace's equation (called harmonic functions) difFer fundamentally from those encountered with the heat and wave equations. These latter two equations describe the evolution of some phenomena. Laplace's equation, on the other hand, describes things at equilibrium. Consequently, any change in the boundary conditions affects to some degree the entire domain because a change to any one point causes its neighbors to change in order to reestablish the equilibrium. Those points will, in turn, affect others. 756 Advanced Engineering Mathematics with MATLAB Figure 12.1.1: Today we best remember Pierre-Simon Laplace (17491827) for his work in celestial mechanics and probability. In his five volumes Trait de Mcanique cleste (17991825), he accounted for the theoretical orbits of the planets and their satellites. Laplace's equation arose during this study of gravitational attraction. (Portrait courtesy of the Archives de l'Acadmie des sciences, Paris.) Because all of these points are in equilibrium, this modification must occur instantaneously. Further insight follows from the maximum principle. If Laplace's equation governs a region, then its solution cannot have a relative maximum or minimum inside the region unless the solution is constant.1 If we think of the solution as a steady-state temperature distribution, this principle is clearly true because at any one point the temperature cannot be greater than at all other nearby points. If that were so, heat would flow away from the hot point to cooler points nearby, thus eliminating the hot spot when equilibrium was once again restored. It is often useful to consider the two-dimensional Laplace's equation in other coordinate systems. In polar coordinates, where x=r cos( ), y= 1 For the proof, see Courant, R., and D.Hilbert, 1962: Methods of Mathematical Physics, Vol 2: Partial Differential Equations. Interscience, pp. 326331. Laplace's Equation 757 r sin( ), and z=z, Laplace's equation becomes (12.1.7) if the problem possesses axisymmetry. On the other hand, if the solution is independent of z, Laplace's equation becomes (12.1.8) In spherical coordinates, x=r cos( )sin( ), y=r sin( )sin( ), and z=r cos( ), where r2=x2+y2+z2, is the angle measured down to the point from the z-axis (colatitude) and is the angle made between the x-axis and the projection of the point on the xy plane. In the case of axisymmetry (no dependence), Laplace's equation becomes (12.1.9) 12.2 BOUNDARY CONDITIONS Because Laplace's equation involves time-independent phenomena, we must only specify boundary conditions. As we discussed in 11.2, we can classify these boundary conditions as follows: 1. Dirichlet condition: u given 2. Neumann condition: 3. Robin condition: given, where n is the unit normal direction given along any section of the boundary. In the case of Laplace's equation, if all of the boundaries have Neumann conditions, then the solution is not unique. This follows from the fact that if u(x, y) is a solution, so is u(x, y)+c, where c is any constant. Finally we note that we must specify the boundary conditions along each side of the boundary. These sides may be at infinity as in problems with semiinfinite domains. We must specify values along the entire boundary because we could not have an equilibrium solution if any portion of the domain was undetermined. 12.3 SEPARATION OF VARIABLES As in the case of the heat and wave equations, separation of variables is the most popular technique for solving Laplace's equation. Although the same general procedure carries over from the previous two chapters, the following examples fill out the details. 758 Advanced Engineering Mathematics with MATLAB Example 12.3.1: Groundwater flow in a valley Over a century ago, a Prench hydraulic engineer named Henri-PhilibertGaspard Darcy (18031858) published the results of a laboratory experiment on the flow of water through sand. He showed that the apparent fluid velocity q relative to the sand grains is directly proportional to the gradient of the hydraulic potential where the hydraulic potential equals the sum of the elevation of the point of measurement plus the pressure potential (p/ g). In the case of steady flow, the combination of Darcy's law with conservation of mass yields Laplace's equation if the aquifer is isotropic (same in all directions) and homogeneous. To illustrate how separation of variables can be used to solve Laplace's equation, we will determine the hydraulic potential within a small drainage basin that lies in a shallow valley. See Figure 12.3.1. Following Tth,2 the governing equation is the two-dimensional Laplace equation (12.3.1) along with the boundary conditions u(x, z0)=gz0+gcx, (12.3.2) ux(0, y)=ux(L, y)=0, and uy(x, 0)=0, (12.3.3) where u(x, y) is the hydraulic potential, g is the acceleration due to gravity, and c gives the slope of the topography. The conditions ux(L, y)=0, and uy(x, 0)=0 specify a no-flow condition through the bottom and sides of the aquifer. The condition ux(0, y)=0 ensures symmetry about the x=0 line. Equation (12.3.2) gives the fluid potential at the water table, where z0 is the elevation of the water table above the standard datum. The term gcx in (12.3.2) expresses the increase of the potential from the valley bottom toward the water divide. On average it closely follows the topography. Following the pattern set in the previous two chapters, we assume that u(x, y)=X(x)Y(y). Then (12.3.1) becomes X Y+XY =0. 2 (12.3.4) Tth, J., J. Geophys. Res., 67, 43754387, 1962, copyright by the American Geophysical Union. Laplace's Equation 759 Figure 12.3.1: Cross section of a valley. Separating the variables yields (12.3.5) Both sides of (12.3.5) must be constant, but the sign of that constant is not obvious. From previous experience we anticipate that the ordinary differential equation in the x-direction leads to a Sturm-Liouville problem because it possesses homogeneous boundary conditions. Proceeding along this line of reasoning, we consider three separation constants. Trying a positive constant (say, m2), (12.3.5) separates into the two ordinary differential equations X"m2X=0, and Y"+m2Y=0, (12.3.6) which have the solutions X(x)=A cosh(mx)+B sinh(mx), (12.3.7) 760 Advanced Engineering Mathematics with MATLAB and Y(y)=C cos(my)+D sin(my). (12.3.8) Because the boundary conditions (12.3.3) imply X (0)=X (L)=0, both A and B must be zero, leading to the trivial solution u(x, y)=0. When the separation constant equals zero, we find a nontrivial solution given by the eigenfunction X0(x)=1, and y)=A0/2. Finally, taking both sides of (12.3.5) equal to k2, X +k2X=0, and Y k2Y=0. (12.3.9) However, because from (12.3.3), B0=0. Thus, the particular solution for a zero separation constant is u0(x, The first of these equations, along with the boundary conditions X (0)= X (L)=0, gives the eigenfunction Xn(x)=cos(knx), with kn=n /L, n=1, 2, 3,... The function Yn(y) for the same separation constant is Yn(y)=An cosh(kny)+Bn sinh(kny). (12.3.10) We must take Bn=0 because We now have the product solution Xn(x)Yn(y), which satisfies Laplace's equation and all of the boundary conditions except (12.3.2). By the principle of superposition, the general solution is (12.3.11) Applying (12.3.2), we find that (12.3.12) Laplace's Equation 761 which we recognize as a Fourier half-range cosine series such that (12.3.13) and (12.3.14) Performing the integrations, A0=2gz0+gcL, and (12.3.16) Finally, the complete solution is (12.3.15) (12.3.17) Figure 12.3.2 presents two graphs by Tth for two different aquifers. We see that the solution satisfies the boundary condition at the bottom and side Figure 12.3.2: Two-dimensional potential distribution and flow patterns for different depths of the horizontally impermeable boundary. 762 Advanced Engineering Mathematics with MATLAB boundaries. Water flows from the elevated land (on the right) into the valley (on the left), from regions of high to low hydraulic potential. Example 12.3.2 In the previous example, we had the advantage of homogeneous boundary conditions along x=0 and x=L. In a different hydraulic problem, Kirkham3 solved the more difficult problem of (12.3.18) subject to the Dirichlet boundary conditions u(x, 0)=Rx, u(x, h)=RL, u(L, y)=RL, and (12.3.19) (12.3.20) This problem arises in finding the steady flow within an aquifer resulting from the introduction of water at the top due to a steady rainfall and its removal along the sides by drains. The parameter L equals half of the distance between the drains, h is the depth of the aquifer, and R is the rate of rainfall. The point of this example is: We need homogeneous boundary conditions along either the x or y boundaries for separation of variables to work. We achieve this by breaking the original problem into two parts, namely u(x, y)= (x, y)+ (x, y)+RL, (12.3.21) 3 Kirkham, D., Trans. Am. Geophys. Union, 39, 892908, 1958, copyright by the American Geophysical Union. Laplace's Equation 763 where (12.3.22) with (0, y)= (L, y)=0, (x, h)=0, (12.3.23) and (x, 0)= R(x L); (12.3.24) (12.3.25) with (x, 0)= (x, h)=0, (L, y)=0, (12.3.26) and (12.3.27) Employing the same technique as in Example 12.3.1, we find that (12.3.28) where (12.3.29) 764 Advanced Engineering Mathematics with MATLAB Similarly, the solution to (x, y) is found to be (12.3.30) where (12.3.31) (12.3.32) The complete solution consists of substituting (12.3.28) and (12.3.30) into (12.3.21). Example 12.3.3 The electrostatic potential is defined as the amount of work which must be done against electric forces to bring a unit charge from a reference point to a given point. It is readily shown4 that the electrostatic potential is described by Laplace's equation if there is no charge within the domain. Let us find the electrostatic potential u(r, z) inside a closed cylinder of length L and radius a. The base and lateral surfaces have the potential 0 while the upper surface has the potential V. Because the potential varies in only r and z, Laplace's equation in cylindrical coordinates reduces to (12.3.33) subject to the boundary conditions u(a, z)=u(r, 0)=0, and u(r, L)=V. (12.3.34) To solve this problem by separation of variables,5 let u(r, z)=R(r)Z(z) and (12.3.35) 4 where E is the electric force. From 13.4, we can such that From Gauss' law, 5 Wang and Liu [Wang, M.-L., and B.-L.Liu, 1995: Solution of Laplace equation by the method of separation of variables. J. Chinese Inst. Eng., 18, 731739] have written a review article on the solutions to (12.3.33) based upon which order the boundary conditions are satisfied. For static fields, introduce a potential Laplace's Equation 765 Only a negative separation constant yields nontrivial solutions in the radial direction. In that case, we have that (12.3.36) The solutions of (12.3.36) are the Bessel functions J0(kr/a) and Y0(kr/a). Because Y0(kr/a) becomes infinite at r=0, the only permissible solution is J0(kr/a). The condition that u(a, z)=R(a)Z(z)=0 forces us to choose values of k such that J0(k)=0. Therefore, the solution in the radial direction is J0(knr/a), where kn is the nth root of J0(k)=0. In the z direction, (12.3.37) The general solution to (12.3.37) is (12.3.38) Because u(r, 0)=R(r)Z(0)=0 and cosh(0)=1, Bn must equal zero. Therefore, the general product solution is (12.3.39) 766 Advanced Engineering Mathematics with MATLAB The condition that u(r, L)=V determines the arbitrary constant An. Along z=L, (12.3.40) where (12.3.41) from (9.5.35) and (9.5.43). Thus, (12.3.42) The solution is then (12.3.43) Figure 12.3.3 illustrates (12.3.43) for the case when L=a where we included the first 20 terms of the series. It was created using the MATLAB script clear L_over_a = 1; M = 20; dr = 0.02; % load in zeros of J_0 zero( 1) = 2.40482; zero( 2) = zero( 4) = 11.79153; zero( 5) = zero( 7) = 21.21164; zero( 8) = zero(10) = 30.63461; zero(11) = dz = 0.02; 5.52007; 14.93091; 24.35247; 33.77582; zero( 3) zero( 6) zero( 9) zero(12) = = = = 8.65372; 18.07106; 27.49347; 36.91710; Laplace's Equation 767 Figure 12.3.3: The steady-state potential (divided by V)within a cylinder of equal radius and height a when the top has the potential V while the lateral side and bottom are at potential 0. zero(13) = 40.05843; zero(14) = 43.19979; zero(15) = 46.34119; zero(16) = 49.48261; zero(17) = 52.62405; zero(18) = 55.76551; zero(19) = 58.90698; zero(20) = 62.04847; % compute Fourier coeff icients for m = 1:M a(m) = 2/ (zero(m)*besselj(1,zero(m))*sinh(L_over_a * zero(m))); end % compute grid and initialize solution R_over_a = [0:dr:1]; Z_over_a = [0:dz:1]; u = zeros(length(Z_over_a), length(R_over_a)); RR_over_a = repmat(R_over_a, [length(Z_over_a)1]); ZZ_over_a = repmat(Z_over_a',[1 length(R_over_a)]); % compute solution from (12.3.43) for m = 1:M u=u+a(m).*besselj(0,zero(m)*RR_jover_a).*sinh(zero(m)*ZZ_over_a); end surf(RR_over_a,ZZ_over_a,u) xlabel('R/A','Fontsize',20);ylabel('Z/A','Fontsize',20) zlabel('U(R,Z)','Fontsize',20) 768 Advanced Engineering Mathematics with MATLAB Of particular interest are the ripples along the line z=L. Along that line, the solution must jump from V to 0 at r=a. For that reason our solution suffers from Gibbs phenomena along this boundary. As we move away from that region the electrostatic potential varies smoothly. Example 12.3.4 Let us now consider a similar, but slightly different, version of example 12.3.3, where the ends are held at zero potential while the lateral side has the value V. Once again, the governing equation is (12.3.33) with the boundary conditions u(r, 0)=u(r, L)=0, and u(a, z)=V. (12.3.44) Separation of variables yields (12.3.45) with Z(0)=Z(L)=0. We chose a positive separation constant because a negative constant would give hyperbolic functions in z which cannot satisfy the boundary conditions. A separation constant of zero would give a straight line for Z(z). Applying the boundary conditions gives a trivial solution. Consequently, the only solution in the z direction which satisfies the boundary conditions is Zn(z)=sin(n z/L). In the radial direction, the differential equation is (12.3.46) As we showed in 9.5, the general solution is (12.3.47) where I0 and K0 are modified Bessel functions of the first and second kind, respectively, of order zero. Because K0(x) behaves as--ln(x) as x0, we must discard it and our solution in the radial direction becomes Rn(r)= AnI0(n r/L). Hence, the product solution is (12.3.48) Laplace's Equation 769 and the general solution is a sum of these particular solutions, namely (12.3.49) Finally, we use the boundary conditions that u(a, z)=V to compute An. This condition gives (12.3.50) so that (12.3.51) Therefore, the final answer is (12.3.52) Figure 12.3.4 illustrates the solution (12.3.52) for the case when L=a. It was created using the MATLAB script clear a_over_L = 1; M = 200; dr = 0.02; dz = 0.02; % % compute grid and initialize solution % R_over_L = [0:dr:1]; Z_over_L = [0:dz:1]; u = zeros(length(Z_over_L),length(R_over_L)); RR_over_L = repmat(R_over_L,[length(Z_over_L)1]); ZZ_over_L = repmat(Z_over_L',[1 length(R_over_L)]); % for m = 1:M temp = (2*m-1)*pi; prod1 = temp*a_over_L; % % compute modified besse1 functions in (12.3.52) % for j = 1:length(Z_over_L); f or i = 1:length(R_over_L); prod2 = temp*RR_over_L(i,j); % 770 Advanced Engineering Mathematics with MATLAB if prod2 - prod1 > -10 % if prod2 < 20 ratio(i,j) = besseli(0,prod2) / besseli (0,prod1); else % for large values of prod, use asymptotic expansion % for modified besse1 function ratio (i , j) = sqrt (prod1/prod2) * exp (prod2-prod1) ; end; % Figure 12.3.4: Potential (divided by V) within a conducting cylinder when the top and bottom have a potential 0 while the lateral side has a potential V. else ratio (i,j) = 0; end % end; end; % % compute solution from (12.3.52) % u = u + (4/temp)*ratio .* sin(temp*ZZ_over_L); end surf(RR_over_L,ZZ_over_L,u) xlabel('R/L','Fontsize',20);ylabel ('Z/L','Fontsize',20) zlabel('SOLUTION','Fontsize',20) Once again, there is a convergence of equipotentials at the corners along the right side. If we had plotted more contours, we would have observed Gibbs phenomena in the solution along the top and bottom of the cylinder. Laplace's Equation 771 Example 12.3.5 In the previous examples, the domain was always of finite extent. Assuming axial symmetry, let us now solve Laplace's equation (12.3.53) in the half-plane z>0 subject to the boundary conditions (12.3.54) (12.3.55) This problem gives the steady-state temperature distribution in the half-space z>0 where the temperature on the bounding plane z=0 equals u0 within a circle of radius a and equals 0 outside of the circle. As before we begin by assuming the product solution u(r, z)=R(r)Z(z) and separate the variables. Again, the separation constant may be positive, negative, or zero. Turning to the positive separation constant first, we have that (12.3.56) Focusing on the R equation, (12.3.57) The solution to (12.3.57) is R(r)=A1I0(mr)+A2k0(mr), (12.3.58) where I0( ) and K0( ) denote modified Bessel functions of order zero and the first and second kind, respectively. Because u(r, 2), and hence R(r), must be bounded as r0, A2=0. Similarly, since u(r, z) must also be bounded as r , A1=0 because lim r I0(mr) . Thus, there is only a trivial solution for a positive separation constant. 772 Advanced Engineering Mathematics with MATLAB We next try the case when the separation constant equals 0. This yields (12.3.59) The solution here is R(r)=A1+A2 ln(r). (12.3.60) Again, boundedness as r 0 requires that A2=0. What about A1? Clearly, for any arbitrary value of z, the amount of internal energy must be finite. This corresponds to (12.3.61) and A1=0. The choice of the zero separation constant yields a trivial solution. Finally, when the separation constant equals k2, the equations for R(r) and Z(z) are r2R +rR+k2r2R=0, and Z k2Z=0, (12.3.62) respectively. Solving for R(r) first, we have that R(r)=A1J0(kr)+A2Y0(kr), (12.3.63) where J0( ) and Y0( )denote Bessel functions of order zero and the first and second kind, respectively. The requirement that u(r, z), and hence R(r), is bounded as r 0 forces us to take A2=0, leaving R(r)=A1J0(kr). From the equation for Z(z), we conclude that Z(z)=B1ekz+B2e kz . (12.3.64) Laplace's Equation 773 Since u(r, z), and hence Z(z), must be bounded as z , it follows that B1=0, leaving Z(z)=B2e kz . Presently our analysis has followed closely those for a finite domain. However, we have satisfied all of the boundary conditions and yet there is still no restriction on k. Consequently, we conclude that k is completely arbitrary and any product solution uk(r, z)=A1B2 J0(kr) e kz (12.3.65) is a solution to our partial differential equation and satisfies the boundary conditions. From the principle of linear superposition, the most general solution equals the sum of all of the possible solutions or (12.3.66) where we have written the arbitrary constant A1B2 as A(k)k. Our final task remains to compute A(k). Before we can find A(k), we must derive an intermediate result. If we define our Fourier transform in an appropriate manner, we can write the twodimensional Fourier transform pair as (12.3.67) where (12.3.68) Consider now the special case where f(x, y) is only a function of f(x, y)=g(r). Then, changing to polar coordinates through the substitution x=r cos( ), y=r sin( ), k= cos( ), and = sin( ), we have that kx+y=r [cos( ) cos( )+sin( ) sin( )]=r cos( ), so that (12.3.69) 774 Advanced Engineering Mathematics with MATLAB and dA=dx dy=r dr d . Therefore, the integral in (12.3.68) becomes (12.3.71) (12.3.70) (12.3.72) If we introduce = , the integral (12.3.73) (12.3.74) =2 J0( r). (12.3.75) Integral (12.3.74) is equivalent to (12.3.73) because the integral of a periodic function over one full period is the same regardless of where the integration begins. Equation (12.3.75) follows from the integral definition of the Bessel function.6 Therefore, (12.3.76) Finally, because (12.3.76) is clearly a function of and (12.3.77) Conversely, if we begin with (12.3.67), make the same substitution, and integrate over the k plane, we have that 6 Watson, G.N., 1966: A Treatise on the Theory of Bessel Functions. Cambridge University Press, 2.2, Equation 5. Laplace's Equation 775 (12.3.78) (12.3.79) (12.3.80) Figure 12.3.5: The axisymmetric potential u(r, z)/u0 in the half-space z>0 when u(r, 0)=u0 if r<a and u(r, 0)=0 if r>a. Thus, we obtain the result that if exists, then (12.3.81) where (12.3.82) 776 Advanced Engineering Mathematics with MATLAB Taken together, (12.3.81) and (12.3.82) constitute the Hankel transform pair for Bessel function of order 0. The function G( ) is called the Hankel transform of g(r). Why did we introduce Hankel transforms? First, setting z=0 in (12.3. 66), we find that (12.3.83) If we now compare (12.3.83) with (12.3.81), we recognize that A(k) is the Hankel transform of u(r, 0). Therefore, (12.3.84) (12.3.85))) Thus, the complete solution is (12.3.86) Equation (12.3.86) is illustrated in Figure 12.3.5. Example 12.3.6: Mixed boundary-value problem In all of our previous examples, the boundary condition along any specific boundary remained the same. In this example, we relax this condition and consider a mixed boundary-value problem. Consider7 the axisymmetric Laplace equation (12.3.87) subject to the boundary conditions (12.3.88) 7 Reprinted from J. Theor. Biol, 81, A.Nir and R.Pfeffer, Transport of macromolecules across arterial wall in the presence of local endothial injury, 685711, 1979, with permission from Elsevier Science. Laplace's Equation 777 and (12.3.89) The interesting aspect of this example is the mixture of boundary conditions along the boundary z=1. For r a, we have a Dirichlet boundary condition which becomes a Robin boundary condition when r>a. Our analysis begins as it did in the previous examples with separation of variables and a superposition of solutions. In the present case the solution is (12.3.90) The first term on the right side of (12.3.90) arises from a separation constant that equals zero while the second term is the contribution from a negative separation constant. Note that (12.3.90) satisfies all of the boundary conditions given in (12.3.88). Substitution of (12.3.90) into (12.3.89) leads to the dual integral equations: (12.3.91) if 0<r<a, and (12.3.92) if 1<r<a. What sets this problem from the routine separation of variables is the solution of dual integral equations;8 in general, they are very difficult to solve. The process usually begins with finding a solution that satisfies (12.3.92) via the orthogonality condition involving Bessel functions. This is the technique employed by Tranter9 who proved that the dual integral equations: The standard references is Sneddon, I.N., 1966: Mixed Boundary Value Problems in Potential Theory. Wiley, 283 pp. 9 Tranter, C.J., 1950: On some dual integral equations occurring in potential problems with axia1 symmetry. Quart. J. Mech. Appl. Math., 3, 411419. 8 778 Advanced Engineering Mathematics with MATLAB (12.3.93) and (12.3.94) have the solution (12.3.95) if G( ) and g(a) are known. The value of k is chosen so that the difference G( ) 2k 2 is fairly small. In the present case, f( )=sinh(k)A(k, a), g(a)=1, and G( )=1+k coth(k)/ . What is the value of k here? Clearly we would like our solution to be valid for a wide range of . Because G( ) 1 as , a reasonable choice is k=1. Therefore, we take (12.3.96) Our final task remains to find An. We begin by writing (12.3.97) where Bmn depends only on a and integrating, . Multiplying (12.3.97) by J2p 1(ka) dk/k and (12.3.98) Laplace's Equation 779 Because10 (12.3.99) where mp is the Kronecker delta: (12.3.100) (12.3.98) reduces to (12.3.101) If we define (12.3.102) then we can rewrite (12.3.101) as (12.3.103) Because11 (12.3.104) if r<a, where Pm( ) is the Legendre polynomial of order m, (12.3.91) can be rewritten 10 11 Gradshteyn, I.S., and I.M.Ryzhik, 1965: Table of Integrals, Series, and Products. Academic Press, 6.538, Formula 2. Ibid., 6.512, Formula 4. 780 Advanced Engineering Mathematics with MATLAB (12.3.105) Equation (12.3.105) follows from the substitution of (12.3.96) into (12.3.91) and then using (12.3.104). Multiplying (12.3.105) by Pm 1( )d , integrating between 1 and 1, and using the orthogonality properties of the Legendre polynomial, we have that (12.3.106) (12.3.107) Table 12.3.1: The Convergence of the Coefficients An Given by (12.3.110) Where Smn Has Nonzero Values for 1 m, n N N 1 2 3 4 5 6 7 8 A1 2.9980 3.1573 3.2084 3.2300 3.2411 3.2475 3.2515 3.2542 A2 1.7181 2.0329 2.1562 2.2174 2.2521 2.2738 2.2882 A3 A4 A5 A6 A7 A8 1.5978 1.9813 2.1548 2.2495 2.3073 2.3452 1.4517 1.8631 2.0670 2.1862 2.2626 1.3347 1.7549 1.9770 2.1133 1.2399 1.6597 1.8925 1.1620 1.5772 1.0972 which shows that only m=1 yields a nontrivial sum. Thus, (12.3.108) Laplace's Equation 781 and (12.3.109) or (12.3.110) Thus, we have reduced the problem to the solution of an infinite number of linear equations which yield An--a common occurrence in the solution of dual integral equations. Selecting some maximum value for n and m, say N, each term in the matrix Smn, 1 m, n N, is evaluated numerically for a given value of a and . By inverting (12.3.110), we obtain the coefficients An for n=1,..., N. Because we solved a truncated version (12.3.110), they will only be approximate. To find more accurate values, we can increase N by 1 and again invert (12.3.110). In addition to the new AN+1, the previous coefficients will become more accurate. We can repeat this process of increasing N until the coefficients converge to their correct value. This is illustrated in Table 12.3.1 when =a=1. Once we have computed the coefficients An necessary for the desired accuracy, we use (12.3.96) to find A(k, a) and then obtain u(r, z) from (12.3.90) via numerical integration. Figure 12.3.6 illustrates the solution when =1 and a=2. Mixed boundary-value problems over a finite domain can be solved in a Figure 12.3.6: The solution of the axisymmetric Laplace's equation (12.3.87) with u(r, 0) =0 and the mixed boundary condition (12.3.89). Here we have chosen =1 and a=2. 782 Advanced Engineering Mathematics with MATLAB similar manner. Consider the partial differential equation12 (12.3.111) subject to the boundary conditions (12.3.112) and (12.3.113) We begin by solving (12.3.111) via separation of variables. This yields (12.3.114) where kn is the nth root of J1(ka)=0. Note that (12.3.114) satisfies all of the boundary conditions except those along z=1. Substituting (12.3.114) into (12.3.113), we find that (12.3.115) 12 Reprinted from Chem. Engng. Sci. ,46, J.S.Vrentas, D.C.Venerus, and C.M. Vrentes, An exact analysis of reservoir effects for rotational viscometers, 3337, 1991, with permission from Elsevier Science. Other examples include: Sherwood, J.D., and H.A.Stone, 1997: Added mass of a disc accelerating within a pipe. Phys. Fluids, 9, 31413148. Galceran, J., J.Cecilia, E.Companys, J.Salvador, and J.Puy, 2000: Analytical expressions for feedback currents at the scanning electrochemical microscope. J. Phys. Chem. B, 104, 79938000. Laplace's Equation 783 and (12.3.116) Equations (12.3.115) and (12.3.116) show that in place of dual integral equations, we now have dual Fourier-Bessel series. Cooke and Tranter13 have shown that the dual Fourier-Bessel series (12.3.117) where Jv(kn )=0, will be automatically satisfied if (12.3.118) where |p| 1. Because an=knAn cosh(kn) and v=1 here, An is given by (12.3.119) if we take p=0. Substitution of (12.3.119) into (12.3.115) gives (12.3.120) Multiplying both sides of (12.3.120) by rJ1(kpr) dr, p=1, 2 , 3,..., and integrating from 0 to 1, we find that (12.3.121) where (12.3.122) 13 Cooke, J.C., and C.J.Tranter, 1959: Dual Fourier-Bessel series. Quart. J. Mech. Appl. Math., 12, 379386. 784 Advanced Engineering Mathematics with MATLAB (12.3.123) Figure 12.3.7: The solution of (12.3.111) which satisfies the boundary condition (12.3.112) and the mixed boundary condition (12.3.113). Here we have chosen a=2. Carrying out the integration, (12.3.120) yields the infinite set of equations (12.3.124) where (12.3.125) Once again, we compute Bm by truncating (12.3.124) to M terms and inverting the systems of equations. Increasing the value of M yields more accurate results. Once we have Bm, we use (12.3.119) to find An. Finally, u(r, z) follows from (12.3.114). Figure 12.3.7 illustrates u(r, z) when a=2. Example 12.3.7 Let us find the potential at any point P within a conducting sphere of radius a. At the surface, the potential is held at V0 in the hemisphere 0< < /2, and V0 for /2< < . Laplace's Equation 785 Laplace's equation in spherical coordinates is (12.3.126) To solve (12.3.126) we use the separation of variables u(r, )=R(r) ( ). Substituting into (12.3.126), we have that (12.3.127) or r2R +2rR k2R=0, and (12.3.128) (12.3.129) A common substitution replaces with =cos( ). Then, as from 1 to 1. With this substitution (12.3.129) becomes varies from 0 to , varies (12.3.130) This is Legendre's equation which we examined in 9.4. Consequently, because the solution must remain finite at the poles, k2=n(n+1), and n ( ) Pn( )=Pn[cos( )], (12.3.131) where n=0, 1, 2, 3,.... Turning to (12.3.128), this equation is the equidimensional or EulerCauchy linear differential equation. One method of solving this equation consists of introducing a new independent variable s so that r=es, or s=ln(r). 786 Advanced Engineering Mathematics with MATLAB Because (12.3.132) it follows that (12.3.133) Substituting into (12.3.128), (12.3.134) Equation (12.3.134) is a second-order, constant coefficient ordinary differential equation which has the solution Rn(s)=Cnens+Dne (n+1)s (12.3.135) =Cn exp[n ln(r)] +Dn exp[ (n+1) ln(r)] (12.3.136) =Cn exp[ln(rn)]+Dn exp[ln(r 1 n )] (12.3.137) =Cnrn+Dnr A more convenient form of the solution is 1 n . (12.3.138) (12.3.139) where An= nCn and Bn=Dn/an+1, We introduced the constant a, the radius of the sphere, to simplify future calculations. Using the results from (12.3.131) and (12.3.139), the solution to Laplace's equation in axisymmetric problems is Laplace's Equation 787 (12.3.140) In our particular problem we must take Bn=0 because the solution becomes infinite at r=0 otherwise. If the problem had involved the domain a<r< potential must remain finite as r . Finally, we must evaluate An. Finding the potential at the surface, , then An=0 because the (12.3.141) Upon examining (12.3.141), it is merely an expansion in Legendre polynomials of the function (12.1.142) Consequently, from (12.3.142), (12.3.143) Because f( ) is an odd function, An=0 if n is even. When n is odd, however, (12.3.144) We can further simplify (12.3.144) by using the relationship that (12.3.145) where n 1. In our problem, then, (12.3.146) 788 Advanced Engineering Mathematics with MATLAB The first few terms are A1=3V0/2, A3= 7V0/8, and A5=11V0/16. Figure 12.3.8 illustrates our solution. It was created using the MATLAB script clear N = 51; dr = 0.05; dtheta = pi / 15; % compute grid and set solution equal to zero r = [0:dr:1]; theta = [0:dtheta:2*pi]; Figure 12.3.8: Electrostatic potential within a conducting sphere when the upper hemispheric surface has the potential 1 and the lower surface has the potential 1. mu = cos(theta); Z = r' * mu; for L = 1:2 if L == 1 X = r' * sin(theta); else X = -r' * sin(theta); end u = zeros(size(X)); % compute solution from (12.3.140) rfactor = r; for n = 1:2:N A = legendre(n-1, 0) ; B = legendre(n+1, 0) ; coeff =A(1)-B(1); C = legendre(n,mu); Theta = C(1,:); u = u + coeff * rfactor'* Theta; rfactor = rfactor .* r .* r ; end surf(Z,X,u); hold on; end xlabel('Z','Fontsize',20); ylabel('X','Fontsize',20) zlabel('u(R,\theta)','Fontsize',20); Laplace's Equation 789 Here we have the convergence of the equipotentials along the equator and at the surface. The slow rate at which the coefficients are approaching zero suggests that the solution suffers from Gibbs phenomena along the surface. Example 12.3.8 We now find the steady-state temperature field within a metallic sphere of radius a, which we place in direct sunlight and allow to radiatively cool. This classic problem, first solved by Rayleigh,14 requires the use of spherical coordinates with its origin at the eenter of sphere and its z-axis pointing toward the sun. With this choice for the coordinate system, the incident sunlight is (12.3.147) If heat dissipation takes place at the surface r=a according to Newton's law of cooling and the temperature of the surrounding medium is zero, the solar heat absorbed by the surface dA must balance the Newtonian cooling at the surface plus the energy absorbed into the sphere's interior. This physical relationship is (12.3.148) where is the reflectance of the surface (the albedo), is the surface conductance or coefficient of surface heat transfer, and is the thermal conductivity. Simplifying (12.3.148), we have that (12.3.149) for r=a. If the sphere has reached thermal equilibrium, Laplace's equation describes the temperature field within the sphere. In the previous example, we showed that the solution to Laplace's equation in axisymmetric problems is (12.3.150) In this problem, Bn=0 because the solution would become infinite at r=0 otherwise. Therefore, 14 Rayleigh, J.W., 1870: On the values of the integral Qn Qn d , Qn, Qn being Laplace's coefRcients of the orders n, n , with application to the theory of radiation. Philos. Trans. R. Soc. London, Ser. A, 160, 579590. 790 Advanced Engineering Mathematics with MATLAB (12.3.151) Differentiation gives (12.3.152) Substituting into the boundary condition leads to (12.3.153) or (12.3.154) where (12.3.155) We determine the coefficients by (12.3.156) Evaluation of the first few coefficients gives (12.3.157) Laplace's Equation 791 (12.3.158) (12.3.159) (12.3.160) Figure 12.3.9 illustrates the temperature field within the sphere with D(0)=1200W/m2, =45W/m K, =5W/m2 K, =0, and a=0.1 m. This corresponds to a cast iron sphere with blackened surface in sunlight. This figure was created by the MATLAB script clear dr = 0.05; dtheta = pi / 15; D_0 = 1200; kappa = 45; epsilon = 5; rho = 0; a = 0.1; % compute grid and set solution equal to zero r = [0:dr:1]; theta = [0:dtheta:pi]; mu = cos(theta); Z = r' * mu; aaaa = (1-rho) * D_0 / (4 * epsilon); aa(1) = a * (1-rho) * D_0 / (2 * (kappa+epsilon*a)); aa(2) = 5 * a * (1-rho) * D_0 / (16 * (2*kappa+epsilon*a)); aa(3) = 0; aa(4) = - 3 * a *(1-rho) * D_0 / (32 *(4*kappa+epsilon*a)); Figure 12.3.9: The difference (in C) between the temperature field within a blackened iron surface of radius 0.1m and the surrounding medium when we heat the surface by sunlight and allow it to radiatively cool. 792 Advanced Engineering Mathematics with MATLAB aa(5) = 0; aa(6) = 13 * a * (1-rho) * D_0 / (256 * (6*kappa+epsilon*a)); aa(7) = 0; aa(8) = -17 * a * (1-rho) * D_0 / (512 * (8*kappa+epsilon*a)); aa(9) = 0; aa(10)= 49 * a * (1-rho) * D_0 / (2048 *(10*kappa+epsilon*a)); for L = 1:2 if L == 1 X = r' * sin(theta); else X = -r' * sin(theta); end u = aaaa * ones(size(X)); rfactor = r; for n = 1:10 A = legendre(n,mu); Theta = A(1,:); u = u + aa(n) * rfactor' * Theta; rfactor = rfactor .* r; end surf(Z,X,u); hold on; end xlabel ('Z','Fontsize',20);ylabel('X','Fontsize',20); zlabel ('U(R,\theta)','Fontsize',20); The temperature is quite warm with the highest temperature located at the position where the solar radiation is largest; the coolest temperatures are located in the shadow region. Figure 12.3.10: Point charge +q in the presence of a grounded conducting sphere. Laplace's Equation 793 Example 12.3.9 In this example we find the potential at any point P exterior to a conducting, grounded sphere centered at z=0 after we place a point charge +q at z=a on the z-axis. See Figure 12.3.10. From the principle of linear superposition, the total potential u(r, ) equals the sum of the potential from the point charge and the potential (r, ) due to the induced charge on the sphere (12.3.161) In common with the first term q/s, (r, ) must be a solution of Laplace's equation. In Example 12.3.7 we showed that the general solution to Laplace's equation in axisymmetric problems is (12.3.162) Because the solutions must be valid anywhere outside of the sphere, An=0; otherwise, the solution would not remain finite as r . Hence, (12.3.163) We determine the coefficient Bn by the condition that u(r0, )=0, or (12.3.164) We need to expand the first term on the left side of (12.3.164) in terms of Legendre polynomials. From the law of cosines, (12.3.165) 794 Advanced Engineering Mathematics with MATLAB Consequently, if a>r, then (12.3.166) In 9.4, we showed that (12.3.167) Therefore, (12.3.168) From (12.3.164), (12.3.169) We can only satisfy (12.3.169) if the square-bracketed term vanishes identically so that (12.3.170) On substituting (12.3.170) back into (12.3.163), (12.3.171) The physical interpretation of (12.3.171) is as follows: Consider a point, such as a (see Figure 12.3.10) on the z-axis. If r>a , the Legendre expansion of 1/s is (12.3.172) Laplace's Equation 795 Figure 12.3.11: Electrostatic potential outside of a grounded conducting sphere in thepresence of a point charge located at a/r0=2. Contours are in units of q/r0. Using (12.3.172), we can rewrite (12.3.171) as (12.3.173) if we set Our final result is then (12.3.174) provided that q equals r0q/a. In other words, when we place a grounded conducting sphere near a point charge +q, it changes the potential in the same manner as would a point charge of the opposite sign and magnitude q =r0q/a, placed at the point The charge q is the image of q. Figure 12.3.11 illustrates the solution (12.3.171) and was created using the MATLAB script clear a_over_r0 = 2; % set up x-z array dx = 0.02; x = -3: dx:3; dz = 0.02; z = -3:dz:3; 796 Advanced Engineering Mathematics with MATLAB u = 1000 * zeros(length(x), length(z)); X = x' * ones(1,length(z)); Z=ones(length(x),1) * z; % compute r and theta rr = sqrt(X .* X + Z .* Z); theta = atan2(X,Z); % find the potential r_over_aprime = a_over_r0 * rr; s = 1 + r_over_aprime . * r_over_aprime ... - 2 * r_over_aprime .* cos (theta); for j = 1:1ength(z); for i = 1:1ength(x); if rr(i,j) >= 1; u(i,j) = 1 ./ sqrt(s(i,j));end; end; end % plot the solution [cs,h] = contourf(X,Z,u);colormap(hot); brighten(hot,0.5); axis square; clabel (cs, h,'manual','Fontsize', 16); xlabel('X','Fontsize',20);ylabel('Z','Fontsize',20); Because the charge is located directly above the sphere, the electrostatic potential for any fixed r is largest at the point =0 and weakest at = . Example 12.3.10: Poisson's integral formula In this example we find the solution to Laplace's equation within a unit disc. The problem can be posed as (12.3.175) with the boundary condition u(1, )=f( ). We begin by assuming the separable solution u(r, )=R(r) ( ) so that (12.3.176) The solution to +k2 =0 is ( )=A cos(k )+B sin(k ). (12.3.177) Laplace's Equation 797 The solution to R(r) is R(r)=Crk+Dr k. (12.3.178 Because the solution must be bounded for all r and periodic in , we must take D=0 and k=n, where n=0, 1, 2, 3,.... Then, the most general solution is (12.3.179) where an and bn are chosen to satisfy (12.3.180) Because (12.3.181) we may write u(r, ) as (12.3.182) If we let = , and z=r[cos( )+i sin( )], then (12.3.183) (12.3.184) (12.3.185) 798 Advanced Engineering Mathematics with MATLAB for all r such that |r|<1. Consequently, (12.3.186) (12.3.187) (12.3.188) Substituting (12.3.188) into (12.3.182), we finally have that (12.3.189) This solution to Laplace's equation within the unit circle is referred to as Poisson's integral formula.15 Problems Solve Laplace's equation over the rectangular region 0<x<a, 0<y<b with the following boundary conditions. Illustrate your solution using MATLAB. 1. u(x, 0)=u(x, b)=u(a, y)=0, u(0, y)=1 2. u(x, 0)=u(0, y )=u(a, y)=0, u(x, b)=x 3. u(x, 0)=u(0, y)=u(a, y) 0, u(x, b)=x a 4. u(x, 0)=u(0, y)=u(a, y)=0, 5. ux(0, y)=u(a, y)=u(x, 0)=0, u(x, b)=1 6. uy(x, 0) u(x, y) u(a, y)=0, u(0, y)=1 7. uy(a, 0)=uy(x, y)=0, u(0, y)=u(a, y)=1 8. ux(a, y)=uy(x, b)=0, u(0, y)=u(x, 0)=1 9. uy(x, 0)=u(x, b)=0, u(0, y)=u(a, y)=1 10. u(a, y)=u(x, 6)=0, u(0, y)=u(x, 0)=1 11. ux(0, y)=0, u(a, y)=u(x, 0)=u(x, b)=1 15 Poisson, S.D., 1820: Mmoire sur la manire d'exprimer les fonctions par des sries de quantits priodiques, et sur l'usage de cette transformation dans la rsolution de diffrens problmes. J. cole Polytech., 18, 417489. Laplace's Equation 799 12. ux(0, y)=ux( ,y)=0, u(x,b)=u1, 13. Variations in the earth's surface temperature can arise as a result of topographic undulations and the altitude dependence of the atmospheric temperature. These variations, in turn, affect the temperature within the solid earth. To show this, solve Laplace's equation with the surface boundary condition that u(x, 0)=T0+ Tcos(2 x/ ), where is the wavelength of the spatial temperature variation. What must be the condition on u(x, y) as we go towards the center of the earth (i.e., y )? 14. Tth16 generalized his earlier analysis of groundwater in an aquifer when the water table follows the topography. Find the groundwater potential if it varies as u(x, z0)=g[z0+cx+a sin(bx)] at the surface y=z0, while ux(0, y)=ux(L, y)=uy(x, 0)=0, where g is the acceleration due to gravity. Assume that bL n , where n=1, 2, 3,.... 15. Solve with 16. During their study of the role that diffusion plays in equalizing gas concentrations within that portion of the lung that is connnected to terminal bronchioles, Chang et al.17 solved Laplace's equation in cylindrical coordinates subject to the boundary conditions that and 16 17 Tth, J., J. Geophys. Res., 68, 47954812, 1963, copyright by the American Geophysical Union. Reprinted from Math. Biosci. , 29, D.B.Chang, S.M.Lewis, and A.C.Young, A theoretical discussion of diffusion and convection in the lung, 331349, 1976, with permission from Elsevier Science. 800 Advanced Engineering Mathematics with MATLAB What should they have found? 17. Solve18 with the boundary conditions u(r, L)=A, 0 r b, and 18. Solve with and 18 Reprinted from Math. Biosci., 1, K.H.Keller and T.R.Stein, A two-dimensional analysis of porous membrane transfer, 421437, 1967, with permission from Elsevier Science. Laplace's Equation 801 19. Solve with and 20. Solve with 21. Solve with 22. Solve 802 Advanced Engineering Mathematics with MATLAB with 23. Solve with the boundary conditions and 24. Solve Laplace's equation in cylindrical coordinates subject to the boundary conditions that and 25. Solve19 Reprinted from Int. J. Heat M ss Transfer, 19, J.Kern and J.O.Hansen, Transient heat conduction in cylindrical systems with an axially moving boundary, 707714, 1976, with kind permission from Elsevier Science Ltd., The Boulevard, Langford Lane, Kidlington OX5 1GB, UK. 19 Laplace's Equation 803 with the boundary conditions and where B is a constant. 26. Solve20 with the boundary conditions and where b>a. 27. Solve21 subject to the boundary conditions 20 21 Taken from Smirnova, E. V., and I.A.Krinberg, 1970: Spatial distribution of the atoms of an impurity element in an arc discharge. I. J. Appl. Spectroscopy, 13, 859864. Reprinted from J. Electroanal. Chem., 222, M.Fleischmann and S.Pons, The behavior of microdisk and microring electrodes, 107115, 1987, with permission from Elsevier Science. 804 Advanced Engineering Mathematics with MATLAB and where u and u are constants. Step 1: Show that satisfies the partial differential equation and the boundary conditions as r 0, r , and z . Step 2: Show that Step 3: Using the relationship22 show that kA(k)=C sin(ka). Step 4: Using the relationship23 show that 22 23 Gradshteyn and Ryzhik, op. cit., 6.671, Formula 7. Ibid., 6.693, Formula 1 with v=0. Laplace's Equation 805 28. Find the steady-state temperature within a sphere of radius a if the temperature along its surface is maintained at the temperature u(a, )= 100[cos( ) cos5( )]. 29. Find the steady-state temperature within a sphere if the upper half of the exterior surface at radius a is maintained at the temperature 100 while the lower half is maintained at the temperature 0. 30. The surface of a sphere of radius a has a temperature of zero everywhere except in a spherical cap at the north pole (defined by the cone = ), where it equals T0. Find the steady-state temperature within the sphere. 31. Using the relationship and Poisson's integral formula, find the solution to Laplace's equation within a unit disc if u(1, )=f( )=T0, a constant. 12.4 THE SOLUTION OF LAPLACE'S EQUATION ON THE UPPER HALF-PLANE In this section we shall use Fourier integrals and convolution to find the solution of Laplace's equation on the upper half-plane y>0. We require that the solution remains bounded over the entire domain and specify it along the x-axis, u(x, 0)=f(x). Under these conditions, we can take the Fourier transform of Laplace's equation and find that (12.4.1) If everything is sufficiently differentiable, we may successively integrate by parts the first integral in (12.4.1) which yields (12.4.2) (12.4.3) 806 Advanced Engineering Mathematics with MATLAB = where 2 U( , y), (12.4.4) (12.4.5) The second integral becomes (12.4.6) along with the boundary condition that (12.4.7) Consequently we reduced Laplace's equation, a partial differential equation, to an ordinary differential equation in y, where is merely a parameter: (12.4.8) with the boundary condition U( , 0)=F( ). The solution to (12.4.8) is U( , y)=A( )e| |y +B( )e | |y , 0 y. (12.4.9) We must discard the e| |y term because it becomes unbounded as we go to infinity along the y-axis. The boundary condition results in B( )=F( ). Consequently, U( , y)=F( )e | |y . (12.4.10) Laplace's Equation 807 The inverse of the Fourier transform e | |y equals (12.4.11) (12.4.12) (12.4.13) (12.4.14) (12.4.15) Furthermore, because (12.4.10) is a convolution of two Fourier transforms, its inverse is (12.4.16) Equation (12.4.16) is Poisson's integral formula24 for the half-plane y>0 or Schwarz' integral formula.25 Example 12.4.1 As an example, let u(x, 0)=1 if |x|<1 and u(x, 0)=0 otherwise. Then, (12.4.17) (12.4.18) Poisson, S.D., 1823: Suite du mmoire sur les intgrales dfinies et sur la sommation des sries. J. cole Polytech., 19, 404509. See pg. 462. 25 Schwarz, H.A., 1870: ber die Integration der partiellen Differentialgleichung 2u/ x2 + 2u/ y2=0 fr die Flche eines Kreises. Vierteljahrsschr. Naturforsch. Ges. Zrich, 15, 113128. 24 808 Advanced Engineering Mathematics with MATLAB Problems Find the solution to Laplace's equation in the upper half-plane for the following boundary conditions: 1. 2. 3. 4. 5. 6. 12.5 POISSON'S EQUATION ON A RECTANGLE Poisson's equation26 is Laplace's equation with a source term: (12.5.1) It arises in such diverse areas as groundwater flow, electromagnetism, and potential theory. Let us solve it if u(0, y)=u(a, y)=u(x, 0)=u(x, b)=0. We begin by solving a similar partial differential equation: (12.5.2) 26 Poisson, S.D., 1813: Remarques sur une quation qui se prsente dans la thorie des attractions des sphrodes. Nou . Bull Soc. Philomath. Paris, 3, 388392. Laplace's Equation 809 by separation of variables. If u(x,y)=X(x)Y(y), then (12.5.3) Figure 12.5.1: Simon-Denis Poisson (17811840) was a product as well as a member of the French scientific establishment of his day. Educated at the cole Polytechnique, he devoted his life to teaching, both in the classroom and with administrative duties, and to scientific research. Poisson's equation dates from 1813 when Poisson sought to extend Laplace's work on gravitational attraction. (Portrait courtesy of the Archives de l'Acadmie des sciences, Paris.) Because we must satisfy the boundary conditions that x(0)=X(a)=Y(0)= Y(b)=0, we have the following eigenfunction solutions: (12.5.4) 810 Advanced Engineering Mathematics with MATLAB with nm = n2 2/a2 m2 2/b2; otherwise, we would only have trivial solutions. The corresponding particular solutions are (12.5.5) where n=1, 2, 3,..., and m=1, 2, 3,.... For a fixed y, we can expand f(x,y) in the half-range Fourier sine series (12.5.6) where (12.5.7) However, we can also expand An(y) in a half-range Fourier sine series (12.5.8) where (12.5.9) (12.5.10) and (12.5.11) In other words, we re-expressed f(x, y) in terms of a double Fourier series. Because (12.5.2) must hold for each particular solution, Laplace's Equation 811 (12.5.12) if we now associate (12.5.1) with (12.5.2). Therefore, the solution to Poisson's equation on a rectangle where the boundaries are held at zero is the double Fourier series (12.5.13) Problems 1. The equation describes the hydraulic potential (elevation of the water table) u(x, y) within a rectangular island on which a recharging well is located at (0, 0). Here R is the rate of recharging and T is the product of the hydraulic conductivity and aquifer thickness. If the water table is at sea level around the island so that u( a, y)=u(a, y)=u(x, b)=u(x, b)=0, find u(x, y) everywhere in the island. [Hint: Use symmetry and redo the above analysis with the boundary conditions: ux(0, y)=u(a, y)=uy(x, 0)=u(x, b)=0.] 2. Let us apply the same approach that we used to find the solution of Poisson's equation on a rectangle to solve the axisymmetric Poisson equation inside a circular cylinder subject to the boundary conditions and u(r, b)=u(r, b)=0, 0 r<a. Step 1: Replace the original problem with 812 Advanced Engineering Mathematics with MATLAB subject to the same boundary conditions. Use separation of variables to show that the solution to this new problem is where kn is the nth zero of J0(k)=0, n=1, 2, 3,..., and m=0, 1, 2,.... Step 2: Show that f(r, z) can be expressed as where Step 3: Show that the general solution is 12.6 THE LAPLACE TRANSFORM METHOD Laplace transforms are useful in solving Laplace's or Poisson's equation over a semi-infinite strip. The following problem illustrates this technique. Let us solve Poisson's equation within a semi-infinite circular cylinder (12.6.1) subject to the boundary conditions (12.6.2) Laplace's Equation 813 and u(a, z)=0, 0<z< , (12.6.3) where 0<b<a. This problem gives the electrostatic potential within a semi-infinite cylinder of radius a that is grounded and has the charge density of n(z) within an infinitesimally thin shell located at r=b. Because the domain is semi-infinite in the z direction, we introduce the Laplace transform (12.6.4) Thus, taking the Laplace transform of (12.6.1), we have that (12.6.5) Although u(r, 0)=0, uz(r, 0) is unknown and we denote its value by f(r). Therefore, (12.6.5) becomes (12.6.6) with limr0 |U(r, s)|< , and U(a, s)=0. To solve (12.6.6) we first assume that we can rewrite f(r) as the FourierBessel series (12.6.7) where kn is the nth root of the J0(k)=0, and (12.6.8) Similarly, the expansion for the delta function is (12.6.9) 814 Advanced Engineering Mathematics with MATLAB because (12.6.10) Why we chose this particular expansion will become apparent shortly. Thus, (12.6.6) may be rewritten as (12.6.11) where The form of the right side of (12.6.11) suggests that we seek solutions of the form (12.6.12) We now understand why we rewrote the right side of (12.6.6) as a FourierBessel series; the solution U(r, s) automatically satisfies the boundary condition U(a, s)=0. Substituting (12.6.12) into (12.6.11), we find that (12.6.13) We have not yet determined ak. Note, however, that in order for the inverse of (12.6.13) not to grow as removable pole. Thus, k the numerator must vanish when s=kn/a and s=kn/a is a = 2N(kn/a)J0(knb/a), and (12.6.14) The inverse of U(r, s) then follows directly from simple inversions, the convolution theorem, and the definition of the Laplace transform. The complete solution is Laplace's Equation 815 (12.6.15) (12.6.16) Problems 1. Use Laplace transforms to solve subject to the boundary conditions and u(x, 0)=u(x, a)=0, 0<x< . 2. Use Laplace transforms to solve subject to the boundary conditions and 816 Advanced Engineering Mathematics with MATLAB 12.7 NUMERICAL SOLUTION OF LAPLACE'S EQUATION As in the case of the heat and wave equations, numerical methods can be used to solve elliptic partial differential equations when analytic techniques fail or are too cumbersome. They are also employed when the domain differs from simple geometries. The numerical analysis of an elliptic partial differential equation begins by replacing the continuous partial derivatives by finite-difference formulas. Employing centered differencing, (12.7.1) and (12.7.2) where um, n denotes the solution value at the grid point m, n. If x= y, Laplace's equation becomes the difference equation um+1, n+um +um, n+1+um, n 4um, n=0. 1, n 1 (12.7.3) Thus, we must now solve a set of simultaneous linear equations that yield the value of the solution at each grid point. The solution of (12.7.3) is best done using techniques developed by algebraists. Later on, in Chapter 14, we will show that a very popular method for directly solving systems of linear equations is Gaussian elimination. However, for many grids at a reasonable resolution, the number of equations are generally in the tens of thousands. Because most of the coefficients in the equations are zero, Gaussian elimination is unsuitable, both from the point of view of computational expense and accuracy. For this reason alternative methods have been developed that generally use successive corrections or iterations. The most common of these point iterative methods are the Jacobi method, unextrapolated Liebmann or Gauss-Seidel method, and extrapolated Liebmann or successive over-relaxation (SOR). None of these approaches is completely satisfactory because of questions involving convergence and efficiency. Because of its simplicity we will focus on the Gauss-Seidel method. We may illustrate the Gauss-Seidel method by considering the system: 10x+y+z=39, (12.7.4) Laplace's Equation 817 2x+10y+z=51, and 2x+2y+10z=64. (12.7.5) (12.7.6) An important aspect of this system is the dominance of the coefficient of x in the first equation of the set and that the coefficients of y and z are dominant in the second and third equations, respectively. The Gauss-Seidel method may be outlined as follows: Assign an initial value for each unknown variable. If possible, make a good first guess. If not, any arbitrarily selected values may be chosen. The initial value will not affect the convergence but will affect the number of iterations until convergence. Starting with (12.7.4), solve that equation for a new value of the unknown which has the largest coefficient in that equation, using the assumed values for the other unknowns. Go to (12.7.5) and employ the same technique used in the previous step to compute the unknown that has the largest coefficient in that equation. Where possible, use the latest values. Proceed to the remaining equations, always solving for the unknown having the largest coefficient in the particular equation and always using the most recently calculated values for the other unknowns in the equation. When the last equation (12.7.6) has been solved, you have completed a single iteration. Iterate until the value of each unknown does not change within a predetermined value. Usually a compromise must be struck between the accuracy of the solution and the desired rate of convergence. The more accurate the solution is, the longer it will take for the solution to converge. To illustrate this method, let us solve our system (12.7.4)(12.7.6) with the initial guess x=y=z=0. The first iteration yields x=3.9, y=4.32, and z=4.756. The second iteration yields x=2.9924, y=4.02592, and z=4.996336. As can be readily seen, the solution is converging to the correct solution of x=3, y=4, and z=5. Applying these techniques to (12.7.3), (12.7.7) where we assume that the calculations occur in order of increasing m and n. Example 12.7.1 To illustrate the numerical solution of Laplace's equation, let us redo Example 12.3.1 with the boundary condition along y=H simplified to u(x, H)=1+x/L. 818 Advanced Engineering Mathematics with MATLAB We begin by finite-differencing the boundary conditions. The condition ux(0, y)=ux(L, y)=0 leads to u1, n and u 1, n =uM+1, n if we employ centered differences at m=0 and m=M. Substituting these values in (12.7.7), we have the following equations for the left and right boundaries: (12.7.8) and (12.7.9) On the other hand, uy(x, 0)=0 yields um, 1=um, 1, and (12.7.10) At the bottom corners, (12.7.8)(12.7.10) simplify to (12.7.11) and (12.7.12) These equations along with (12.7.7) were solved using the Gauss-Seidel method using the MATLAB script clear dx=0.1; x = 0:dx:1; M = 1/dx+1; % M = number of x grid points dy=0.1; y = 0:dy:1; N = 1/dy+1; % N = number of y grid points X = x' * ones(1,N); Y = ones(M, 1) * y; u = zeros(M,N); % create initial guess for the solution % introduce boundary condition along y = H for m = 1:M; u (m,N) = 1 + x (m); end Laplace's Equation 819 % % prXor EXspp.Nbfabg hbrela clo IXmgX]b'p bnsXrfli % clo frbo C 2=3:; % % al reb firboflo cfopr % clo i C 3=M'2A clo h C 3=L'2A s(h,i) C (s(h+2,i)+s(h'2,i)+s(h,i+2)+s(h,i'2))05A biaA bia % % ilt al reb u C 1 Xia u C I pfabp % clo i C 3=M'2 s(2,i) C (3*s(3,i) +s(2,i+2) +s(2,i'2)) 0 5A s(L,i) C (3*s(L'2,i) +s(L,i+2) +s(L,i'2)) 0 5A bia % % ilt al reb x C 1 pfab % clo h C 3=L'2 s(h,2)C(s(h+2,2)+s(h'2,2)+3*s(h,3))05A bia % % cfiXggx al reb ]loibop % s(2,2) C (s(3,2)+s(2,3))03As(L,2) C (s(L'2,2)+s(L,3))03A % % mglr reb plgsrfli % fc(frbo CC 5) ps[mglr (3,3,2), T]p,eU C ]lirlsoc(O,S,s)A ]gX[bg (]p,e,T1/3 1/; 2 2/5U,'Dlirpfyb',2;) Xufp rfderA rfrgb('Xcrbo 5 frboXrflip','Dlirpfyb',31)A xgX[bg('S0F','Dlirpfyb',31)Abia fc (frbo CC 2;) ps[mglr(3,3,3),T]p,eU C ]lirlsoc(O,S,s)A ]gX[bg (]p, e,'Dlirpfyb', 2;) Xufp rfder A rfrgb('Xcrbo 2; frboXrflip', 'Dlirpfyb',31)A xgX[bg ('S0F',zDlirpfyb',31)Abia fc(frbo CC ;5) ps[mglr(3,3,4),T]p,eU C ]lirlsoc(O,S,s)A ]gX[bg (]p, e, 'Dlirpfyb', 2;) Xufp rfderA rfrgb ('Xcrbo ;5 frboXrflip','Dlirpfyb',31)A ugX[bg('O0I','Dlirpfyb',31)AxgX[bg('S0F','Dlirpfyb',31)A 820 Advanced Engineering Mathematics with MATLAB end if (iter == 256) subplot (2,2,4), [cs,h] = contourf (X,Y,u); clabel(cs,h,'Fontsize',16) axis tight; title('after 256 iterations','Fontsize',20); xlabel ('X/L','Fontsize',20); ylabel ('Y/H','Fontsize',20); end end The initial guess everywhere except along the top boundary was zero. In Figure 12.7.1 we illustrate the numerical solution after 4, 16, 64, and 256 iterations where we have taken 11 grid points in the x and y directions. Project: Successive Over-Relaxation The fundamental difficulty with relaxation methods used in solving Laplace's equation is the rate of convergence. Assuming x= y, the most popular method for accelerating convergence of these techniques is successive over-relaxation (SOR): where Laplace's Equation 821 Figure 12.7.1: The solution to Laplace's equation by the Gauss-Seidel method. The boundary conditions are ux(0, y)=ux(L, y)=uy(x, 0)=0, and u(x, H)=1+x/L. Figure 12.7.2: The number of iterations required so that |Rm, n| 10 3 as a function of during the iterative solution of the problem posed in the project. We used x= y=0.01, and L=z0=1. The iteration count for the boundary conditions stated in Step 1 is given by the solid line while the iteration count for the boundary conditions given in Step 2 is shown by the dotted line. The initial guess equaled zero. 822 Advanced Engineering Mathematics with MATLAB Most numerical methods books dealing with partial differential equations discuss the theoretical reasons behind this technique;27 the optimum value always lies between one and two. Step 1: Write a MATLAB script that uses the Gauss-Seidel method to numerically solve Laplace's equation for 0 x L, 0 y z0 with the following boundary conditions: u(x, 0)=0, u(x, z0)=1+x/L, u(0, y)=y/z0, and u(L, y)=2y/z0. Because this solution will act as "truth" in this project, you should iterate until the solution does not change. Step 2: Now redo the calculation using successive over-relaxation. Count the number of iterations until |Rm,n| 10 3 for all m and n. Plot the number of iterations as a function of . How does the curve change with resolution x? Step 3: Redo Steps 1 and 2 with the exception of u(0, y)=u(L, y)=0. How has the convergence rate changed? Can you explain why? How sensitive are your results to the first guess? 27 For example, Young, D.M., 1971: Iterative Solution of Large Linear Systems. Academic Press, 570 pp. Chapter 13 Vector Calculus Physicists invented vectors and vector operations to facilitate their mathematical expression of such diverse topics as mechanics and electromagnetism. In this chapter we focus on multivariable differentiations and integrations of vector fields, such as the velocity of a fluid, where the vector field is solely a function of its position. 13.1 REVIEW The physical sciences and engineering abound with vectors and scalars. Scalars are physical quantities which only possess magnitude. Examples include mass, temperature, density, and pressure. Vectors are physical quantities that possess both magnitude and direction. Examples include velocity, acceleration, and force. We shall denote vectors by boldfaced letters. Two vectors are equal if they have the same magnitude and direction. From the limitless number of possible vectors, two special cases are the zero vector 0 which has no magnitude and unspecified direction and the unit vector which has unit magnitude. The most convenient method for expressing a vector analytically is in terms of its components. A vector a in three-dimensional real space is any order triplet of real numbers (components) a1, a2, and a3 such that a=a1i+ a2j+a3k, where a1i, a2j, and a3k are vectors which lie along the coordinate axes and have their origin at a common initial point. The magnitude, length, or norm of a vector a, |a|, equals A particularly important vector is the position vector, defined by r=xi+yj+zk. As in the case of scalars, certain arithmetic rules hold. Addition and subtraction are very similar to their scalar counterparts: a+b=(a1+b1)i+(a2+b2)j+(a3+b3)k, (13.1.1) and a b=(a1 b1)i+(a2b2)j+(a3b3)k. (13.1.2) In contrast to its scalar counterpart, there are two types of multiplication. The dot product is defined as 824 Advanced Engineering Mathematics with MATLAB ab=|a||b| cos( )=a1b1+a2b2+a3b3, (13.1.3) where is the angle between the vector such that 0 . The dot product yields a scalar answer. A particularly important case is ab=0 with |a| 0, and |b| 0. In this case the vectors are orthogonal (perpendicular) to each other. The other form of multiplication is the cross product which is defined by a b=|a||b|sin( )n, where is the angle between the vectors such that 0 and n is a unit vector perpendicular to the plane of a and b with the direction given by the right-hand rule. A convenient method for computing the cross product from the scalar components of a and b is (13.1.4) Two nonzero vectors a and b are parallel if and only if a b=0. Most of the vectors that we will use are vector-valued functions. These functions are vectors that vary either with a single parametric variable t or multiple variables, say x, y and z. The most commonly encountered example of a vector-valued function which varies with a single independent variable involves the trajectory of particles. If a space curve is parameterized by the equations x=f(t), y=g(t), and z=h(t) with a t b, the position vector r(t)=f(t)i +g(t)j+h(t)k gives the location of a point P as it moves from its initial position to its final position. Furthermore, because the increment quotient r/ t is in the direction of a secant line, then the limit of this quotient as t0, r (t), gives the tangent to the curve at P. Example 13.1.1: Foucault pendulum One of the great experiments of mid-nineteenth century physics was the demonstration by J.B.L.Foucault (18191868) in 1851 of the earth's rotation by designing a (spherical) pendulum, supported by a long wire, that essentially swings in an nonaccelerating coordinate system. This problem demonstrates many of the fundamental concepts of vector calculus. The total force1 acting on the bob of the pendulum is F=T+mG, where T is the tension in the pendulum and G is the gravitational attraction per unit mass. Using Newton's second law, (13.1.5) 1 From Broxmeyer, C., 1960: Foucault pendulum effect in a Schuler-tuned system. J. Aerosp. Sci., 27, 343347 with permission. Vector Calculus 825 where r is the position vector from a fixed point in an inertial coordinate system to the bob. This system is inconvenient because we live on a rotating coordinate system. Employing the conventional geographic coordinate system,2 (13.1.5) becomes (13.1.6) where is the angular rotation vector of the earth and r now denotes a position vector in the rotating reference system with its origin at the center of the earth and terminal point at the bob. If we define the gravity vector g=G ( r), then the dynamical equation is (13.1.7) where the second term on the left side of (13.1.7) is called the Coriolis force. Because the equation is linear, let us break the position vector r into two separate vectors: r0 and r1, where r=r0+r1. The vector r0 extends from the center of the earth to the pendulum's point of support and r1 extends from the support point to the bob. Because r0 is a constant in the geographic system, (13.1.8) If the length of the pendulum is L, then for small oscillations r1 xi+ yj+Lk and the equations of motion are (13.1.9) (13.1.10) 2 For the derivation, see Marion, J.B., 1965: Classical Dynamics of Particles and Systems. Academic Press, 12.212.3. 826 Advanced Engineering Mathematics with MATLAB and (13.1.11) where denotes the latitude of the point and is the rotation rate of the earth. The relationships between the components of tension are Tx=xTz/L, and Ty=yTz/L. From (13.1.11), (13.1.12) Substituting the definitions of Tx, Ty, and (13.1.12) into (13.1.9) and (13.1.10), (13.1.13) and (13.1.14) The approximate solution to these coupled differential equations is (13.1.15) and (13.1.16) if 2g/L. Thus, we have a pendulum that swings with an angular frequency However, depending upon the latitude , the direction in which the pendulum swings changes counterclockwise with time, completing a full cycle in 2 /[ sin( )]. This result is most clearly seen when = /2 and we are at the North Pole. There the earth is turning underneath the pendulum. If initially we set the pendulum swinging along the 0 longitude, the pendulum will shift with time to longitudes east of the Greenwich median. Eventually, after 24 hours, the process repeats itself. Vector Calculus 827 Consider now vector-valued functions that vary with several variables. A vector function of position assigns a vector value for every value of x, y, and z within some domain. Examples include the velocity field of a fluid at a given instant: v=u(x, y, z)i+ (x, y, z)j+ (x, y, z)k. (13.1.17) Another example arises in electromagnetism where electric and magnetic fields often vary as a function of the space coordinates. For us, however, probably the most useful example involves the vector differential operator, del or nabla, (13.1.18) Figure 13.1.1: For a two-dimensional field T(x, y), the gradient is a vector that is perpendicular to the isotherms T(x, y)=constant and points in the direction of most rapidly increasing temperatures. which we apply to the multivariable differentiable scalar function F(x, y, z) to give the gradient An important geometric interpretation of the gradient--one which we shall use frequently--is the fact that is perpendicular (normal) to the level surface at a given point P. To prove this, let the equation F(x, y, z)=c describe a three-dimensional surface. If the differentiable functions x=f(t), y=g(t), and z=h(t) are the parametric equations of a curve on the surface, then the derivative of F[f(t), g(t), h(t)]=c is (13.1.19) 828 Advanced Engineering Mathematics with MATLAB or (13.1.20) When r' 0, the vector is orthogonal to the tangent vector. Because our argument holds for any differentiable curve that passes through the arbitrary point (x, y, z), then is normal to the level surface at that point. Figure 13.1.1 gives a common application of the gradient. Consider a twodimensional temperature field T(x, y). The level curves T(x, y)=constant are lines that connect points where the temperature is the same (isotherms). The gradient in this case is a vector that is perpendicular or normal to these isotherms and points in the direction of most rapidly increasing temperature. Example 13.1.2 Let us find the gradient of the function f(x, y, z)=x2z2 sin(4y). Using the definition of gradient, (13.1.21) = 2xz2 sin(4y)i+4x2z2 cos(4y)j+2x2z sin(4y)k. (13.1.22) Example 13.1.3 Let us find the unit normal to the unit sphere at any arbitrary point (x, y, z). The surface of a unit sphere is defined by the equation f(x, y, z) x2+ y2+z2=1. Therefore, the normal is given by the gradient (13.1.23) and the unit normal (13.1.24) because x2+y2+z2=1. Vector Calculus 829 and u(a, z)=0, 0<z< , (12.6.3) where 0<b<a. This problem gives the electrostatic potential within a semi-infinite cylinder of radius a that is grounded and has the charge density of n(z) within an infinitesimally thin shell located at r=b. Because the domain is semi-infinite in the z direction, we introduce the Laplace transform (12.6.4) Thus, taking the Laplace transform of (12.6.1), we have that (12.6.5) Although u(r, 0)=0, uz(r, 0) is unknown and we denote its value by f(r). Therefore, (12.6.5) becomes (12.6.6) with limr0 |U(r, s)|< , and U(a, s)=0. To solve (12.6.6) we first assume that we can rewrite f(r) as the FourierBessel series (12.6.7) where kn is the nth root of the J0(k)=0, and (12.6.8) Similarly, the expansion for the delta function is (12.6.9) 830 Advanced Engineering Mathematics with MATLAB with a velocity field that does not vary with time, the streamlines give the paths along which small parcels of the fluid move. To find the streamlines of a given vector field F with components P(x, y, z), Q(x, y, z), and R(x, y, z), we assume that we can parameterize the streamlines in the form r(t)=x(t)i+y(t)j+z(t)k. Then the tangent line is r (t)=x (t)i+y (t)j+z (t)k. Because the streamline must be parallel to the vector field at any t, r (t)= F, or (13.1.25) or (13.1.26) The solution of this system of differential equations yields the streamlines. Example 13.1.5 Let us find the streamlines for the vector field F=sec(x)i cot(y)j+ k that passes through the point ( /4, , 1). In this particular example, F represents a measured or computed fluid's velocity at a particular instant. From (13.1.26), (13.1.27) This yields two differential equations: (13.1.28) Integrating these equations gives sin(x)=ln |cos(y)|+c1, and z=ln |cos(y)|+c2. (13.1.29) Substituting for the given point, we finally have that (13.1.30) Vector Calculus 831 Example 13.1.6 Let us find the streamlines for the vector field F=sin(z)j+eyk that passes through the point (2, 0, 0). From (13.1.26), (13.1.31) This yields two differential equations: dx=0, and sin(z) dz=ey dy. (13.1.32) Integrating these equations gives x=c1, and ey= cos(z)+c2. (13.1.33) Substituting for the given point, we finally have that x=2, and ey=2 cos(z). Note that (13.1.34) only applies for a certain strip in the yz-plane. Problems Given the following vectors a and b, verify that a(a b)=0, and b(a b)= 0: 1. a=4i 2j+5k, b=3i+j k 2. a=i 3j+k, b=2i+4k 3. a=i+j+k, b= 5i+2j+3k 4. a=8i+j 6k, b=i 2j+10k 5. a=2i+7j 4k, b=i+j k. 6. Prove a (b c)=(ac)b (ab)c. 7. Prove a (b c)+b (c a)+c (a b)=0. Find the gradient of the following functions: 8. f(x, y, z)=xy2/z3 9. f(x, y, z)=xy cos(yz) 10. f(x, y, z)=ln(x2+y2+z2) 11. f(x, y, z)=x2y2(2z+1)2 12. f(x, y, z)=2x y2+z2. (13.1.34) 832 Advanced Engineering Mathematics with MATLAB Use MATLAB to illustrate the following surfaces as well as the the unit normal. 13. z=3 14. x2+y2=4 15. z=x2+y2 16. 17. z=y 18. x+y+z=1 19. z=x2 Find the streamlines for the following vector fields that pass through the specified point : 20. F=i+j+k; (0, 1, 1) 21. F=2i y2j+zk; (1, 1, 1) 22. F=3x2i y2j+z2k; (2, 1, 3) 23. F=x2i+y2j z3k; (1, 1, 1) 24. F=(1/x)i+eyj k; (2, 0, 4) 25. Solve the differential equations (13.1.13)(13.1.14) with the initial conditions x(0)=y(0)=y (0)=0, and assuming that 2 g/L. 26. If a fluid is bounded by a fixed surface f(x, y, z)=c, show that the fluid must satisfy the boundary condition where v is the velocity of the fluid. 27. A sphere of radius a is moving in a fluid with the constant velocity u. Show that the fluid satisfies the boundary condition (vu)(rut)=0 at the surface of the sphere, if the center of the sphere coincides with the origin at t=0 and v denotes the velocity of the fluid. 13.2 DIVERGENCE AND CURL Consider a vector field v defined in some region of three-dimensional space. The function v(r) can be resolved into components along the i, j, and k directions or v(r)=u(x, y, z)i+ (x, y, z)j+ (x, y, z)k. (13.2.1) Vector Calculus 833 Figure 13.2.1: Divergence of a vector function v(x, y, z). If v is a fluid's velocity field, then we can compute the flow rate through a small (differential) rectangular box defined by increments ( x, y, z) centered at the point (x, y, z). See Figure 13.2.1. The flow out from the box through the face with the outwardly pointing normal n= j is v( j)= (x, y y/2, z) x z, (13.2.2) and the flow through the face with the outwardly pointing normal n=j is vj= (x, y+ y/2, z) x z. (13.2.3) The net flow through the two faces is [ (x, y+ y/2, z) (x, y y/2, z)] x z vy(x, y, z) x y z. (13.2.4) A similar analysis of the other faces and combination of the results give the approximate total flow from the box as [ux (x, y, z)+ y(x, y, z)+ (x, y, z)] x y z. z (13.2.5) Dividing by the volume x y z and taking the limit as the dimensions of the box tend to zero yield ux+ y+ z as the flow out from (x, y, z) per unit volume per unit time. This scalar quantity is called the divergence of the vector v: 834 Advanced Engineering Mathematics with MATLAB (13.2.6) Thus, if the divergence is positive, either the fluid is expanding and its density at the point is falling with time, or the point is a source at which fluid is entering the field. When the divergence is negative, either the fluid is contracting and its density is rising at the point, or the point is a negative source or sink at which fluid is leaving the field. If the divergence of a vector field is zero everywhere within a domain, then the flux entering any element of space exactly balances that leaving it and the vector field is called nondivergent or solenoidal (from a Greek word meaning a tube). For a fluid, if there are no sources or sinks, then its density cannot change. Some useful properties of the divergence operator are (13.2.7) (13.2.8) and (13.2.9) The expression (13.2.9) is very important in physics and is given the special name of the Laplacian.3 Example 13.2.1 If F=x2zi 2y3z2j+xy2zk, compute the divergence of F. (13.2.10) =2xz 6y2z2+xy2. (13.2.11) 3 Some mathematicians write instead of Vector Calculus 835 Example 13.2.2 If r=xi+yj+zk, show that r/|r|3 is nondivergent. (13.2.12) (13.2.13) Another important vector function involving the vector field v is the curl of v, written curl(v) or rot(v) in some older textbooks. In fluid flow problems Figure 13.2.2: Examples of vector fields with and without divergence and curl. it is proportional to the instantaneous angular velocity of a fluid element. In rectangular coordinates, (13.2.14) where v=ui+ j+ k as before. However, it is best remembered in the mnemonic form: (13.2.15) If the curl of a vector field is zero everywhere within a region, then the field is irrotational. Figure 13.2.2 illustrates graphically some vector fields that do and do not possess divergence and curl. Let the vectors that are illustrated represent the motion of fluid 836 Advanced Engineering Mathematics with MATLAB particles. In the case of divergence only, fluid is streaming from the point, at which the density is falling. Alternatively the point could be a source. In the case where there is only curl, the fluid rotates about the point and the fluid is incompressible. Finally, the point that possesses both divergence and curl is a compressible fluid with rotation. Some useful computational formulas exist for both the divergence and curl operations: (13.2.16) (13.2.17) (13.2.18) (13.2.19) (13.2.20) (13.2.21) (13.2.22 and (13.2.23) In this book the operation is undefined. Example 13.2.3 If F=xz3i 2x2yzj+2yz4k, compute the curl of F and verify that Vector Calculus 837 From the definition of curl, (13.2.24) (13.2.25) =(2z4+2x2y)i(0 3xz2)j+( 4xyz 0)k (13.2.26) =(2z4+2x2y)i+3xz2j 4xyzk. (13.2.27) From the definition of divergence and (13.2.27), (13.2.28) Example 13.2.4: Potential flow theory One of the topics in most elementary fluid mechanics courses is the study of irrotational and nondivergent fluid flows. Because the fluid is irrotational, the velocity vector field v satisfies From (13.2.17) we can introduce a potential such that Because the flow field is nondivergent, Thus, the fluid flow can be completely described in terms of solutions to Laplace's equation. This area of fluid mechanics is called potential flow theory. Compute 1. F=x2zi+yz2j+xy2k 2. F=4x2y2i+(2x+2yz)j+(3z+y2)k 3. F=(x y)2i+e xyj+xze2yk 4. F=3xyi+2xz2j+y3k 5. F=5yzi+x2zj+3x3k 6. F=y3i+(x3y2 xy)j (x3yz xz)k Problems and for the following vector fields: 838 Advanced Engineering Mathematics with MATLAB 7. F=xe yi+yz2j+3e zk 8. F=y ln(x)i+(2 3yz)j+xyz3k 9. F=xyzi+x3yzezj+xyezk 10. F=(xy3 z4)i+4x4y2 y4z5k 11. F=xy2i+xyz2j+xy cos(z)k 12. F=xy2i+xyz2j+xy sin(z)k 13. F=xy2i+xyzj+xy cos(z)k 14. (a) Assuming continuity of all partial derivatives, show that (b) Using F=3xyi+4yzj+2xzk, verify the results in part (a). 15. If E=E(x, y, z, t) and B=B(x, y, z, t) represent the electric and magnetic fields in a vacuum, Maxwell' field equations are: where c is the speed of light. Using the results from Problem 14, show that E and B satisfy 16. If f and g are continuously differentiable scalar fields, show that is solenoidal. Hint: Show that = F, 17. An inviscid (frictionless) fluid in equilibrium obeys the relationship where denotes the density of the fluid, p denotes the pressure, and F denotes the body forces (such as gravity). Show that Vector Calculus 839 Figure 13.3.1: Diagram for the line integration in Example 13.3.1. 13.3 LINE INTEGRALS Line integrals are ubiquitous in physics. In mechanics they are used to compute work. In electricity and magnetism, they provide simple methods for computing the electric and magnetic fields for simple geometries. The line integral most frequently encountered is an oriented one in which the path C is directed and the integrand is the dot product between the vector function F(r) and the tangent of the path dr. It is usually written in the economical form (13.3.1) where F=P(x, y, z)i+Q(x, y, z)j+R(x, y, z)k. If the starting and terminal points are the same so that the contour is closed, then this closed contour integral will be denoted by In the following examples we show how to evaluate the line integrals along various types of curves. Example 13.3.1 If F=(3x2+6y)i 14yzj+20xz2k, let us evaluate the line integral cFdr along the parametric curves x(t)=t, y(t)=t2, and z(t)=t3 from the point (0, 0, 0) to (1, 1, 1). Using the MATLAB commands u MdaFn u q : ,2,+,02. u oqae1(q*q+=0*q+=1)5 rdFGad(...r...*...;mfqocta...*0,)5... sdFGad (...s...*...;mfqocta...*0,)5 tdFGad(...t...*...;mfqocta...*0,)5 840 Advanced Engineering Mathematics with MATLAB we illustrate these parametric curves in Figure 13.3.1. We begin by finding the values of t which give the corresponding end points. A quick check shows that t=0 gives (0, 0, 0) while t=1 yields (1, 1, 1). Figure 13.3.2: Diagram for the line integration in Example 13.3.2. It should be noted that the same value of t must give the correct coordinates in each direction. Failure to do so suggests an error in the parameterization. Therefore, (13.3.2) (13.3.3) (13.3.4) Example 13.3.2 Let us redo the previous example with a contour that consists of three "dog legs," namely straight lines from (0, 0, 0) to (1, 0, 0), from (1, 0, 0) to (1, 1, 0), and from (1, 1, 0) to (1, 1, 1). See Figure 13.3.2. In this particular problem we break the integration down into integrals along each of the legs: (13.3.5) Vector Calculus 841 For C1, y=z=dy=dz=0, and (13.3.6) For C2, x=1 and z=dx=dz=0, so that (13.3.7) Figure 13.3.3: Diagram for the line integration in Example 13.3.3. For C3, x=y=1 and dx=dy=0, so that (13.3.8) Therefore, (13.3.9) Examle 13.3.3 For our third calculation, we redo the first example where the contour is a straight line. The parameterization in this case is x=y=z=t with 0 t 1. See Figure 13.3.3. Then, 842 Advanced Engineering Mathematics with MATLAB (13.3.10 (13.3.11) An interesting aspect of these three examples is that, although we used a common vector field and moved from (0, 0, 0) to (1, 1, 1) in each case, we obtained a different answer in each case. Thus, for this vector field, the line integral is path dependent. This is generally true. In the next section we will meet conservative vector fields where the results will be path independent. Figure 13.3.4: Diagram for the line integration in Example 13.3.4. Example 13.3.4 If F=(x2+y2)i2xyj+xk, let us evaluate 2 2 2 C Fdr if the contour is that portion of the circle sin( ) d , y=a sin( ), x +y =a from the point (a, 0, 3) to ( , 0, 3). See Figure 13.3.4. The parametric equations for this example are x=a cos( ), dx= dy=a cos( ) d , z=3, and dz=0 with 0 . Therefore, (13.3.12) Vector Calculus 843 (13.3.13) (13.3.14) (13.3.15) Example 13.3.5: Circulation Let v(x, y, z) denote the velocity at the point (x, y, z) in a moving fluid. If it varies with time, this is the velocity at a particular instant of time. The integral vdr around a closed path C is called the circulation around that path. The average component of velocity along the path is (13.3.16 where s is the total length of the path. The circulation is thus the product of the length of the path and the average velocity along the path. When the circulation is positive, the flow is more in the direction of integration than opposite to it. Circulation is thus an indication and to some extent a measure of motion around the path. Problems Evaluate C Fdr for the following vector fields and curves: 1. F=y sin( z)i+x2eyj+3xzk and C is the curve x=t, y=t2, and z=t3 from (0, 0, 0) to (1, 1, 1). Use MATLAB to illustrate the parametric curves. 2. F=yi+zj+xk and C consists of the line segments from (0, 0, 0) to (2, 3, 0), and from (2, 3, 0) to (2, 3, 4). Use MATLAB to illustrate the parametric curves. 3. F=exi+xexyj+xyexyzk and C is the curve x=t, y=t2, and z=t3 with 0 t 2. Use MATLAB to illustrate the parametric curves. 4. F=yzi+xzj+xyk and C is the curve x=t3, y=t2, and z=t with 1 t 2. Use MATLAB to illustrate the parametric curves. 5. F=yixj+3xyk and C consists of the semicircle x2+y2=4, z=0, y>0, and the line segment from ( 2, 0, 0) to (2, 0, 0). Use MATLAB to illustrate the parametric curves. 6. F=(x+2y)i+(6y 2x)j and C consists of the sides of the triangle with vertices at (0, 0, 0), (1, 1, 1), and (1, 1, 0). Proceed from (0, 0, 0) to (1, 1, 1) to (1, 1, 0) and back to (0, 0, 0). Use MATLAB to illustrate the parametric curves. 844 Advanced Engineering Mathematics with MATLAB 7. F=2xzi+4y2j+x2k and C is taken counterclockwise around the ellipse x2/4+y2/9=1, z=1. Use MATLAB to illustrate the parametric curves. 8. F=2xi+yj+zk and C is the contour x=t, y=sin(t), and z= cos(t)+sin(t) with 0 t 2 . Use MATLAB to illustrate the parametric curves. 9. F=(2y2+z)i+4xyj+xk and C is the spiral x=cos(t), y=sin(t), and z=t with 0 t 2 between the points (1, 0, 0) and (1, 0, 2 ). Use MATLAB to illustrate the parametric curves. 10. F=x2i+y2j+(z2+2xy)k and C consists of the edges of the triangle with vertices at (0, 0, 0), (1, 1, 0), and (0, 1, 0). Proceed from (0, 0, 0) to (1, 1, 0) to (0, 1, 0) and back to (0, 0, 0). Use MATLAB to illustrate the parametric curves. 13.4 THE POTENTIAL FUNCTION In 13.2 we showed that the curl operation applied to a gradient produces the zero vector: Consequently, if we have a vector field F such that everywhere, then that vector field is called a conservative field and we can compute a potential such that Example 13.4.1 Let us show that the vector field F=yexy cos(z)i+xexy cos(z)j exy sin(z)k is conservative and then find the corresponding potential function. To show that the field is conservative, we compute the curl of F or (13.4.1) To find the potential we must solve three partial differential equations: x=yexy cos(z)=Fi, (13.4.2) y=xexy cos(z)=Fj, and z= exy sin(z)=Fk. (13.4.3) (13.4.4) We begin by integrating any one of these three equations. Choosing (13.4.2), Vector Calculus 845 (x, y, z)=exy cos(z)+f(y, z). (13.4.5) To find f(y, z) we differentiate (13.4.5) with respect to y and find that y=xexy cos(z)+f (y, z)=xexy cos(z) y (13.4.6) from (13.4.3). Thus, fy=0 and f(y, z) can only be a function of z, say g(z). Then, (x, y, z)=exy cos(z)+g(z). (13.4.7) Finally, z= exy sin(z)+g (z)= exy sin(z) (13.4.8) from (13.4.4) and g (z)=0. Therefore, the potential is (x, y, z)=exy cos(z)+constant. (13.4.9) Potentials can be very useful in computing line integrals because (13.4.10) where the point B is the terminal point of the integration while the point A is the starting point. Thus, any path integration between any two points is path independent. Finally, if we close the path so that A and B coincide, then (13.4.11) It should be noted that the converse is not true. Just because necessarily have a conservative field F. we do not 846 Advanced Engineering Mathematics with MATLAB In summary then, an irrotational vector in a given region has three fundamental properties: (1) its integral around every simply connected circuit is zero, (2) its curl equals zero, and (3) it is the gradient of a scalar function. For continuously differentiable vectors these properties are equivalent. For vectors which are only piece-wise differentiable, this is not true. Generally the first property is the most fundamental and taken as the definition of irrotationality. Example 13.4.2 Using the potential found in Example 13.4.1, let us find the value of the line integral Fdr from the point (0, 0, 0) to ( 1, 2, ). C From (13.4.9), (13.4.12) Problems Verify that the following vector fields are conservative and then find the corresponding potential: 1. 2. 3. 4. 5. 6. 7. F=2xyi+(x2+2yz)j+(y2+4)k F=(2x+2ze2x)i+(2y 1)j+e2xk F=yzi+xzj+xyk F=2xi+3y2j+4z3k F=[2x sin(y)+e3z]i+x2 cos(y)j+(3xe3z+4)k F=(2x+5)i+3y2j+(1/z)k F=e2zi+3y2j+2xe2zk Figure 13.5.1: Diagram for the surface integration in Example 13.5.1. Vector Calculus 847 8. F=yi+(x+z)j+yk 9. F=(x+y)i+xj+xk. 13.5 SURFACE INTEGRALS Surface integrals appear in such diverse fields as electromagnetism and fluid mechanics. For example, if we were oceanographers we might be interested in the rate of volume of seawater through an instrument which has the curved surface S. The volume rate equals vn d , where v is the velocity and n d is an infinitesimally small element on the S surface of the instrument. The surface element n d must have an orientation (given by n) because it makes a considerable difference whether the flow is directly through the surface or at right angles. In the special case when the surface encloses a threedimensional volume, then we have a closed surface integral. To illustrate the concept of computing a surface integral, we will do three examples with simple geometries. Later we will show how to use surface coordinates to do more complicated geometries. Example 13.5.1 Let us find the flux out the top of a unit cube if the vector field is F=xi+yj+zk. See Figure 13.5.1. The top of a unit cube consists of the surface z=1 with 0 x 1 and 0 y 1. By inspection the unit normal to this surface is n=k, or n= k. Because we are interested in the flux out of the unit cube, n=k, and (13.5.1) because z=1. Figure 13.5.2: Diagram for the surface integration in Example 13.5.2. 848 Advanced Engineering Mathematics with MATLAB Example 13.5.2 Let us find the flux out of that portion of the cylinder y2+z2=4 in the first octant bounded by x=0, x=3, y=0, and z=0. The vector field is F=xi+2zj+yk. See Figure 13.5.2. Because we are dealing with a cylinder, cylindrical coordinates are appropriate. Let y=2cos( ), z=2sin( ), and x=x with 0 /2. To find n, we use the gradient in conjunction with the definition of the surface of the cylinder f(x, y, z)=y2+z2=4. Then (13.5.2) because y2+z2=4 along the surface. Since we want the flux out of the surface, then n=yj/2+zk/2 whereas the flux into the surface would require n= yj/2 zk/2. Therefore, (13.5.3) What is d ? Our infinitesimal surface area has a side in the x direction of length dx and a side in the direction of length 2 d because the radius equals 2. Therefore, d =2 dx d . Bringing all of these elements together, (13.5.4) (13.5.5) As counterpoint to this example, let us find the flux out of the pie-shaped surface at x=3. In this case, y=r cos( ), z=r sin( ), and Figure 13.5.3: Diagram for the surface integration in Example 13.5.3. Vector Calculus 849 (13.5.6) (13.5.7) Example 13.5.3 Let us find the flux of the vector field F=y2i+x2j+5zk out of the hemispheric surface x2+y2+z2=a2, z>0. See Figure 13.5.3. We begin by finding the outwardly pointing normal. Because the surface is defined by f(x, y, z)=x2+y2+z2=a2, (13.5.8) because x2+y2+z2=a2. This is also the outwardly pointing normal since n=r/a, where r is the radial vector. Using spherical coordinates, x=a cos( ) sin( ), y=a sin( )sin ( ), and z=a cos( ), where is the angle made by the projection of the point onto the equatorial plane, measured from the x-axis, and is the colatitude or "cone angle" measured from the z-axis. To compute d , the infinitesimal length in the direction is a d while in the direction it is a sin( ) d , where the sin( ) factor takes into account the convergence of the meridians. Therefore, d =a2 sin( ) d d , and (13.5.9) (13.5.10) (13.5.11) 850 Advanced Engineering Mathematics with MATLAB (13.5.12) (13.5.13) (13.5.14) Although these techniques apply for simple geometries such as a cylinder or sphere, we would like a general method for treating any arbitrary surface. We begin by noting that a surface is an aggregate of points whose coordinates are functions of two variables. For example, in the previous example, the surface was described by the coordinates and . Let us denote these surface coordinates in general by u and . Consequently, on any surface we c an reexpress x, y, and z in terms of u and ; x=x(u, ), y=y(u, ), and z=z (u ). Next, we must find an infinitesimal element of area. The position vector to the surface is r=x(u, v)i+y(u, )j+z(u, )k. Therefore, the tangent vectors along =constant, ru, and along u=constant, r , equal ru=xui+yuj+zuk, and r =x i+y j+z k. (13.5.16) (13.5.15) Consequently, the sides of the infinitesimal area are ru du and r d . Therefore, the vectorial area of the parallelogram that these vectors form is n d =ru r du d (13.5.17) and is called the vector element of area on the surface. Thus, we may convert Fn d into an expression involving only u and and then evaluate the surface integral by integrating over the appropriate domain in the u -plane. Of course, we are in trouble if ru r =0. Vector Calculus 851 Therefore, we only treat regular Figure 13.5.4: Diagram for the surface integration in Example 13.5.4. points where ru r 0. In the next few examples, we show how to use these surface coordinates to evaluate surface integrals. Example 13.5.4 Let us find the flux of the vector field F=xi+yj+zk through the top of the plane 3x+2y+z=6 which lies in the first octant. See Figure 13.5.4. Our parametric equations are x=u, y= , and z=6 3u 2 . Therefore, r=ui+ j+(6 3u 2v)k, (13.5.18) so that ru=i 3k, r =j 2k, (13.5.19 and ru r =3i+2j+k. (13.5.20) Bring all of these elements together, (13.5.21) 852 Advanced Engineering Mathematics with MATLAB (13.5.22) (13.5.23) To set up the limits of integration, we note that the area in u, space corresponds to the xy-plane. On the xy-plane, z=0 and 3u+2v=6, along with boundaries u=v=0. Figure 13.5.5: Diagram for the surface integration in Example 13.5.5. Example 13.5.5 Let us find the flux of the vector field F=xi+yj+zk through the top of the surface z=xy+1 which covers the square 0 x 1, 0 y 1 in the xy-plane. See Figure 13.5.5. Our parametric equations are x=u, y= , and z=u +1 with 0 u 1 and 0 1. Therefore, r=ui+ j+(u +1)k, (13.5.24) so that ru=i+ k, r =j+uk, (13.5.25) and ru r = i uj+k. (13.5.26) Vector Calculus 853 Bring all of these elements together, (13.5.27) (13.5.28) (13.5.29) Example 13.5.6 Let us find the flux of the vector field F=4xzi+xyz2j+3zk through the exterior surface of the cone z2 x2+y2 above the xy-plane and below z=4. See Figure 13.5.6. Figure 13.5.6: Diagram for the surface integration in Example 13.5.6. A natural choice for the surface coordinates is polar coordinates r and . Because x=r cos( ) and y=r sin( ), z=r. Then r=r cos( )i+r sin( )j+rk (13.5.30) with 0 r 4 and 0< <2 so that rr=cos( )i+sin( )j+kr = r sin( )i+r cos( )j, (13.5.31) 854 Advanced Engineering Mathematics with MATLAB and rr r = r cos( )i r sin( )j+rk. (13.5.32) This is the unit area inside the cone. Because we want the exterior surface, we must take the negative of (13.5.32). Bring all of these elements together, (13.5.33) (13.5.34) (13.5.35) Problems Compute the surface integral S Fn d for the following vector fields and surfaces: 1. F=xi zj+yk and the surface is the top side of the z=1 plane where 0 x 1 and 0 y 1. 2. F=xi+yj+xzk and the surface is the top side of the cylinder x2+y2=9, z=0, and z=1. 3. F=xyi+zj+xzk and the surface consists of both exterior ends of the cylinder defined by x2+y2=4, z=0, and z=2. 4. F=xi+zj+yk and the surface is the lateral and exterior sides of the cylinder defined by x2+y2=4, z= 3, and z=3. 5. F=xyi+z2j+yk and the surface is the curved exterior side of the cylinder y2+z2=9 in the first octant bounded by x=0, x=1, y=0, and z=0. 6. F=yj+z2k and the surface is the exterior of the semicircular cylinder y2+z2=4, z 0, cut by the planes x=0 and x=1. 7. F=zi+xj+yk and the surface is the curved exterior side of the cylinder x2+y2=4 in the first octant cut by the planes z=1 and z=2. 8. F=x2i z2j+yzk and the surface is the exterior of the hemispheric surface of x2+y2+z2=16 above the plane z=2. 9. F=yi+xj+yk and the surface is the top of the surface z=x+1, where 1 x 1 and 1 y 1. 10. F=zi+xj 3zk and the surface is the top side of the plane x+y+z=2a that lies above the square 0 x<a, 0<y<a in the xy-plane. 11. F=(y2+z2)i+(x2+z2)j+(x2+y2)k and the surface is the top side of the surface z=1 x2 with 1 x 1 and 2 y 2. 12. F=y2i+xzj k and the surface is the cone normal pointing away from the z-axis. with the Vector Calculus 855 13. F=y2i+x2j+5zk and the surface is the top side of the plane z=y+1, where 1 x 1 and 1 y 1. 14. F= yi+xj+zk and the surface is the exterior or bottom side of the paraboloid z=x2+y2, where 0 z 1. 15. F= yi+xj+6z2k and the surface is the exterior of the paraboloids z=4 x2 y2 and z=x2+y2. 13.6 GREEN'S LEMMA Consider a rectangle in the xy-plane which is bounded by the lines x=a, x=b, y=c, and y=d. We assume that the boundary of the rectangle is a piece-wise smooth curve which we denote by C. If we have a continuously differentiable vector function F=P(x, y)i+Q(x, y)j at each point of enclosed region R, then (13.6.1) (13.6.2) (13.6.3) where the last integral is a closed line integral counterclockwise around the rectangle because the horizontal sides vanish since dy=0. By similar arguments, (13.6.4) so that (13.6.5) 856 Advanced Engineering Mathematics with MATLAB This result, often known as Green's lemma, may be expressed in vector form as (13.6.6) Although this proof was for a rectangular area, it can be generalized to any simply closed region on the xy-plaue as follows. Consider an area which is surrounded by simply closed curves. Within the closed contour we can divide the area into an infinite number of infinitesimally small rectangles and apply (13.6.6) to each rectangle. When we sum up all of these rectangles, we find where the integration is over the entire surface area. On the other hand, away from the boundary, the line integral along any one edge of a rectangle cancels the line integral along the same edge in a contiguous Figure 13.6.1: Diagram for the verification of Green's lemma in Example 13.6.1. rectangle. Thus, the only nonvanishing contribution from the line integrals arises from the outside boundary of the domain Example 13.6.1 Let us verify Green's lemma using the vector field F=(3x2 8y2)i+ (4y 6xy)j and the enclosed area lies between the curves The two curves intersect at x=0 and x=1. See Figure 13.6.1. We begin with the line integral: (13.6.7) Vector Calculus 857 (13.6.8) In (13.6.7) we used y=x2 in the first integral and the areal integration, in our return integration. For (13.6.9) (13.6.10 and Green's lemma is verified in this particular case. Example 13.6.2 Let us redo Example 13.6.1 except that the closed contour is the triangular region defined by the lines x=0, y=0, and x+y=1. The line integral is (13.6.11) (13.6.12) (13.6.13) On the other hand, the areal integration is (13.6.14) 858 Advanced Engineering Mathematics with MATLAB (13.6.15 and Green's lemma is verified in this particular case. Example 13.6.3 Let us verify Green's lemma using the vector field F=(3x+4y)i+(2x 3y)j and the closed contour is a circle of radius two centered at the origin of the xy-plane. See Figure 13.6.2. Beginning with the line integration, (13.6.16) (13.6.17) (13.6.18) = 8 . (13.6.19) Figure 13.6.2: Diagram for the verification of Green's lemma in Example 13.6.3. Vector Calculus 859 For the areal integration, (13.6.20 and Green's lemma is verified in the special case. Problems Verify Green's lemma for the following two-dimensional vector fields and contours: 1. F=(x2+4y)i+(y x)j and the contour is the square bounded by the lines x=0, y=0, x=1, and y=1. 2. F=(x y)i+xyj and the contour is the square bounded by the lines x=0, y=0, x=1, and y 1. 3. F= y2i+x2j and the contour is the triangle bounded by the lines x=1, y=0, and y=x. 4. F=(xy x2)i+x2yj and the contour is the triangle bounded by the lines y=0, x=1, and y=x. 5. F=sin(y)i+xcos(y)j and the contour is the triangle bounded by the lines x+y=1, y x=1, and y=0. 6. F=y2i+x2j and the contour is the same contour used in Problem 4. 7. F= y2i+x2j and the contour is the circle x2+y2=4. 8. F= x2i+xy2j and the contour is the closed circle of radius a. 9. F=(6y+x)i+(y+2x)j and the contour is the circle (x 1)2+(y 2)2=4. 10. F=(x+y)i+(2x2 y2)j and the contour is the boundary of the region determined by the curves y=x2 and y=4. 11. F=3yi+2xj and the contour is the boundary of the region determined by the curves y=0 and y=sin(x) with 0 x . 12. F= 16yi+(4ey+3x2)j and the contour is the pie wedge defined by the lines y=x, y= x, x2+y2=4, and y>0. 13.7 STOKES' THEOREM v which gives a measure of the rotation of a parcel of fluid lying within the velocity field v. In this section we show how the curl can be used to simplify the calculation of certain closed line integrals. This relationship between a closed line integral and a surface integral involving the curl is Stokes' Theorem: The circulation of F=Pi+Qj+Rk around the closed boundary C of an oriented surface S in the direction counterclockwise with respect to the surface s unit normal vector n equals the integral of Fn over S or In 13.2 we introduced the vector quantity 860 Advanced Engineering Mathematics with MATLAB (13.7.1) Stokes' theorem requires that all of the functions and derivatives be continuous. The proof of Stokes' theorem is as follows: Consider a finite surface S whose boundary is the loop C. We divide this surface into a number of small elements n d and compute the circulation around each element. When we add all of the circulations together, the contribution from an integration along a boundary line between two adjoining elements cancels out because the boundary is transversed once in each direction. For this reason, the only contributions that survive are those parts where the element Figure 13.7.1: Sir George Gabriel Stokes (18191903) was Lucasian Professor of Mathematics at Cambridge University from 1849 until his death. Having learned of an integral theorem from his friend Lord Kelvin, Stokes included it a few years later among his questions on an examination that he wrote for the Smith Prize. It is this integral theorem that we now call Stokes' theorem. (Portrait courtesy of the Royal Society of London.) boundaries form part of C. Thus, the sum of all circulations equals the circulation around the edge of the whole surface. Next, let us compute the circulation another way. We begin by finding the Taylor expansion for P(x, y, z) about the arbitrary point (x0, y0, z0): Vector Calculus 861 (13.7.2) with similar expansions for Q(x, y, z) and R(x, y, z). Then (13.7.3) where L denotes some small loop located in the surface S. Note that integrals such as dx and vanish. If we now require that the loop integrals be in the clockwise or positive sense so that we preserve the right-hand screw convention, then (13.7.4) (13.7.5) (13.7.6) and (13.7.7) Therefore, the sum of all circulations in the limit when all elements are made infinitesimally small becomes the surface integral is proven. and Stokes' theorem 862 Advanced Engineering Mathematics with MATLAB In the following examples we first apply Stokes' theorem to a few simple geometries. We then show how to apply this theorem to more complicated surfaces.4 Example 13.7.1 Let us verify Stokes' theorem using the vector field F=x2i+2xj+z2k and the closed curve is a square with vertices at (0, 0, 3), (1, 0, 3), (1, 1, 3), and (0, 1, 3). See Figure 13.7.2. We begin with the line integral: (13.7.8) where C1, C2, C3, and C4 represent the four sides of the square. Along C1, x varies while y=0 and z=3. Therefore, (13.7.9) Figure 13.7.2: Diagram for the verification of Stokes' theorem in Example 13.7.1. because dy=dz=0, and z=3. Along C2, y varies with x=1 and z=3. Therefore, 4 Thus, different Stokes for different folks. Vector Calculus 863 (13.7.10) Along C3, x again varies with y=1 and z=3, and so, (13.7.11) Note how the limits run from 1 to 0 because x is decreasing. Finally, for C4, y again varies with x=0 and z=3. Hence, (13.7.12) Hence, (13.7.13) Turning to the other side of the equation, (13.7.14) Our line integral has been such that the normal vector must be n=k. Therefore, (13.7.15) 864 Advanced Engineering Mathematics with MATLAB Figure 13.7.3: Diagram for the verification of Stokes' theorem in Example 13.7.2. and Stokes' theorem is verified for this special case. Example 13.7.2 Let us verify Stokes' theorem using the vector field F=(x2 y)i+4zj+ x2k, where the closed contour consists of the x and y coordinate axes and that portion of the circle x2+y2=a2 that lies in the first quadrant with z=1. See Figure 13.7.3. The line integral consists of three parts: (13.7.16) Along C1, x varies while y=0 and z=1. Therefore, (13.7.17) Along the circle C2, we use polar coordinates with x=a cos(t), y=a sin(t), and z=1. Therefore, (13.7.18) (13.7.19) Vector Calculus 865 (13.7.20) (13.7.21) Figure 13.7.4: Diagram for the verification of Stokes' theorem in Example 13.7.3. because dx= a sin(t)dt, and dy=a cos(t)dt. Finally, along C3, y varies with x=0 and z=1 Therefore, (13.7.22) so that (13.7.23) Turning to the other side of the equation, (13.7.24) 866 Advanced Engineering Mathematics with MATLAB From the path of our line integral, our unit normal vector must be n=k. Then, (13.7.25) and Stokes' theorem is verified for this case. Example 13.7.3 Let us verify Stokes' theorem using the vector field F=2yzi (x+3y 2)j+(x2+z)k, where the closed triangular region is that portion of the plane x+y+z=1 that lies in the first octant. As shown in Figure 13.7.4, the closed line integration consists of three line integrals: (13.7.26) Along C1, z=0 and y=1 x. Therefore, using x as the independent variable, (13.7.27) Along C2, x=0 and y=1 z. Thus, (13.7.28) Finally, along C3, y=0 and z=1 x. Hence, (13.7.29) Vector Calculus 867 Thus, (13.7.30) On the other hand, (13.7.31) To find n d , we use the general coordinate system x=u, y= , and z= 1 u r=ui+ j+(1 u )k and . Therefore, (13.7.32) Thus, (13.7.33) (13.7.34) (13.7.35) (13.7.36) and Stokes' theorem is verified for this case. Problems Verify Stokes' theorem using the following vector fields and surfaces: 1. F=5yi 5xj+3zk and the surface S is that portion of the plane z=1 with the square at the vertices (0, 0, 1), (1, 0, 1), (1, 1, 1), and (0, 1, 1). 2. F=x2i+y2j+z2k and the surface S is the rectangular portion of the plane z=2 defined by the corners (0, 0, 2), (2, 0, 2), (2, 1, 2), and (0, 1, 2). 3. F=zi+xj+yk and the surface S is the triangular portion of the plane z=1 defined by the vertices (0, 0, 1), (2, 0, 1), and (0, 2, 1). 868 Advanced Engineering Mathematics with MATLAB 4. F=2zi 3xj+4yk and the surface S is that portion of the plane z=5 within the cylinder x2+y2=4. 5. F=zi+xj+yk and the surface S is that portion of the plane z=3 bounded by the lines y=0, x=0, and x2+y2=4. 6. F=(2z+x)i+(y z)j+(x+y)k and the surface S is the interior of the triangularly shaped plane with vertices at (1, 0, 0), (0, 1, 0), and (0, 0, 1). 7. F=zi+xj+yk and the surface S is that portion of the plane 2x+y+2z=6 in the first octant. 8. F=xi+xzj+yk and the surface S is that portion of the paraboloid z=9 x2 y2 within the cylinder x2+y2=4. 13.8 DIVERGENCE THEOREM Although Stokes' theorem is useful in computing closed line integrals, it is usually very difficult to go the other way and convert a surface integral into a closed line integral because the integrand must have a very special form, namely In this section we introduce a theorem that allows with equal facility the conversion of a closed surface integral into a volume integral and ice ersa. Furthermore, if we can convert a given surface integral into a closed one by the introduction of a simple surface (for example, closing a hemispheric surface by adding an equatorial plate), it may be easier to use the divergence theorem and subtract off the contribution from the new surface integral rather than do the original problem. This relationship between a closed surface integral and a volume integral involving the divergence operator is Figure 13.8.1: Carl Friedrich Gauss (17771855), the prince of mathematicians, must be on the list of the greatest mathematicians who ever lived. Gauss, a child prodigy, is almost as well known for what he did not publish during his lifetime as for what he did. This is true of Gauss's divergence theorem which he proved while working on the theory of gravitation. It was only when his notebooks were published in 1898 that his precedence over the published work of Ostrogradsky (1801 1862) was established. (Portrait courtesy of Photo AKG, London.) Vector Calculus 869 The Divergence or Gauss's Theorem: Let V be a closed and bounded region in threedimensional space with a piece-wise smooth boundary S that is oriented outward. Let F=P(x, y, z)i+Q(x, y, z)j+R(x, y, z)k be a vector field for which P, Q, and R are continuous and have continuous first partial derivatives in a region of three dimensional space containing V. Then (13.8.1) Here, the circle on the double integral signs denotes a closed surface integral. A nonrigorous proof of Gauss's theorem is as follows. Imagine that our volume V is broken down into small elements d of volume of any shape so long as they include all of the original volume. In general, the surfaces of these elements are composed of common interfaces between adjoining elements. However, for the elements at the periphery of V, part of their surface will be part of the surface S that encloses V. Now is the net flux of the vector F out from the element dr. At the common interface between elements, the flux out of one element equals the flux into its neighbor. Figure 13.8.2: Diagram for the verification of the divergence theorem in Example 13.8.1. 870 Advanced Engineering Mathematics with MATLAB Therefore, the sum of all such terms yields (13.8.2) and all of the contributions from these common interfaces cancel; only the contribution from the parts on the outer surface S is left. These contributions, when added together, give over S and the proof is completed. Example 13.8.1 Let us verify the divergence theorem using the vector field F=4xi 2y2j+z2k and the enclosed surface is the cylinder x2+y2=4, z=0, and z=3. See Figure 13.8.2. We begin by computing the volume integration. Because (13.8.3) (13.8.4) (13.8.5) (13.8.6) (13.8.7) (13.8.8) Vector Calculus 871 (13.8.9) Turning to the surface integration, we have three surfaces: (13.8.10 The first integral is over the exterior to the cylinder. Because the surface is defined by f(x, y, z)=x2+y2=4, (13.8.11) Therefore, (13.8.12) (13.8.13) (13.8.14) (13.8.15) (13.8.16) because x=2 cos( ), y=2 sin( ), and d =2 d dz in cylindrical coordinates. Along the top of the cylinder, z=3, the outward pointing normal is n=k, and d =r dr d . Then, 872 Advanced Engineering Mathematics with MATLAB (13.8.17) However, along the bottom of the cylinder, z=0, the outward pointing normal is n= k and d =r dr d . Then, (13.8.18) Consequently, the flux out the entire cylinder is (13.8.19) and the divergence theorem is verified for this special case. Example 13.8.2 Let us verify the divergence theorem given the vector field F=3x2y2i+ yj 6xy2zk and the volume is the region bounded by the paraboloid z=x2+y2 and the plane z=2y. See Figure 13.8.3. Computing the divergence, (13.8.20) Then, (13.8.21) (13.8.22) (13.8.23) Vector Calculus 873 (13.8.24) (13.8.25) (13.8.26) (13.8.27) (13.8.28) The limits in the radial direction are given by the intersection of the paraboloid and plane: r2=2r sin( ), or r=2 sin( ), and y is greater than zero. Turning to the surface integration, we have two surfaces: (13.8.29) Figure 13.8.3: Diagram for the verification of the divergence theorem in Example 13.8.2. The dashed line denotes the curve r=2 sin( ). 874 Advanced Engineering Mathematics with MATLAB where S1 is the plane z=2y, and S2 is the paraboloid. For either surface, polar coordinates are best so that x=r cos( ), and y=r sin( ). For the integration over the plane, z=2r sin( ). Therefore, r=r cos( )i+r sin( )j+2r sin( )k, (13.8.30) so that rr=cos( )i+sin( )j+2 sin( )k, (13.8.31) and r = r sin( )i+r cos( )j+2r cos( )k. (13.8.32) Then, (13.8.33) This is an outwardly pointing normal so that we can immediately set up the surface integral: (13.8.34) (13.8.35) (13.8.36) Vector Calculus 875 (13.8.37) (13.8.38) = 2 . (13.8.39) For the surface of the paraboloid, r=r cos( )i+r sin( )j+r2k, (13.8.40) so that rr=cos( )i+sin( )j+2rk, and (13.8.42) (13.8.41 r = r sin( )i+r cos( )j. Then, (13.8.43) = 2r2 cos( )i 2r2 sin( )j+rk. (13.8.44) This is an inwardly pointing normal so that we must take the negative of it before we do the surface integral. Then, 876 Advanced Engineering Mathematics with MATLAB (13.8.45) (13.8.46) (13.8.47) (13.8.48) (13.8.49) (13.8.50) (13.8.51) (13.8.52 Consequently, (13.8.53) and the divergence theorem is verified for this special case. Vector Calculus 877 Example 13.8.3: Archimedes' principle Consider a solid5 of volume V and surface S that is immersed in a vessel filled with a fluid of density . The pressure field p in the fluid is a function of the distance from the liquid/air interface and equals P=P0 gz, (13.8.54) where g is the gravitational acceleration, z is the vertical distance measured from the interface (increasing in the k direction), and p0 is the constant pressure along the liquid/air interface. If we define F= pk, then Fn d is the vertical component of the force on the surface due to the pressure and d is the total lift. Using the divergence theorem and noting that the total lift also equals (13.8.55) which is the weight of the displaced liquid. This is Archimedes' principle: the buoyant force on a solid immersed in a fluid of constant density equals the weight of the fluid displaced. Example 13.8.4: Conservation of charge Let a charge of density flow with an average velocity v. Then the charge crossing the element dS per unit time is vdS=JdS, where J is defined as the conduction current vector or current density vector. The current across any surface drawn in the medium is The total charge inside the closed surface is dV. If there are no sources or sinks Because this (13.8.56) V inside the surface, the rate at which the charge decreases is change is due to the outward flow of charge, 5 Adapted from Altintas, A., 1990: Archimedes' principle as an application of the divergence theorem. IEEE Trans. Educ., 33, 222. IEEE. 878 Advanced Engineering Mathematics with MATLAB Applying the divergence theorem, (13.8.57) Because the result holds true for any arbitrary volume, the integrand must vanish identically and we have the equation of continuity or the equation of conservation of charge: (13.8.58) Problems Verify the divergence theorem using the following vector fields and volumes: 1. F=x2i+y2j+z2k and the volume V is the cube cut from the first octant by the planes x=1, y=1, and z=1. 2. F=xyi+yzj+xzk and the volume V is the cube bounded by 0 x 1, 0 y 1, and 0 z 1. 3. F=(y x)i+(z y)j+(y x)k and the volume is the cube bounded by 1 x 1, 1 y 1, and 1 z 1. 4. F=x2i+yj+zk and the volume V is the cylinder defined by the surfaces x2+y2=1, z=0, and z=1. 5. F=x2i+y2j+z2k and the volume V is the cylinder defined by the surfaces x2+y2=4, z=0, and z=1. 6. F=2/2i+xz3j+(z 1)2k and the volume V is the cylinder bounded by the surface x2+y2=4, and the planes z=1 and z=5. 7. F=6xyi+4yzj+xe yk and the volume V is that region created by the plane x+y+z=1, and the three coordinate planes. 8. F=yi+xyj zk and the volume V is that solid created by the paraboloid z=x2+y2 and plane z=1. Chapter 14 Linear Algebra Linear algebra involves the systematic solving of linear algebraic or differential equations that arise during the mathematical modeling of an electrical, mechanical, or even human system where two or more components are interacting with each other. In this chapter we present efficient techniques for expressing these systems and their solution. 14.1 FUNDAMENTALS OF LINEAR ALGEBRA Consider the following system of m simultaneous linear equations in n unknowns x1, x2, x3,..., xn: (14.1.1) where the coefficients ij and constants bj denote known real or complex numbers. The purpose of this chapter is to show how matrix algebra can be used to solve these systems by first introducing succinct notation so that we can replace (12.1.1) with rather simple expressions and then employing a set of rules to manipulate these expressions. In this section we focus on developing these simple expressions. The fundamental quantity in linear algebra is the matrix.1 A matrix is an ordered rectangular array of numbers or mathematical expressions. We shall use upper case letters to denote them. The m n matrix (14.1.2) 1 This term was first used by Sylvester, J.J., 1850: Additions to the articles, "On a new class of theorems," and "On Pascal's theorem." Philos. Mag., Ser. 4, 37, 363370. 880 Advanced Engineering Mathematics with MATLAB has m rows and n columns. The order (or size) of a matrix is determined by the number of rows and columns; (12.1.2) is of order m by n. If m=n, the matrix is a square matrix; otherwise, A is rectangular. The numbers or expressions in the array aij are the elements of A and can be either real or complex. When all of the elements are real, A is a real matrix. If some or all of the elements are complex, then A is a complex matrix. For a square matrix, the diagonal from the top left corner to the bottom right corner is the principal diagonal. From the limitless number of possible matrices, certain ones appear with sufficient regularity that they are given special names. A zero matrix (sometimes called a null matrix) has all of its elements equal to zero. It fulfills the role in matrix algebra that is analogous to that of zero in scalar algebra. The unit or identity matrix is a n n matrix having 1's along its principal diagonal and zero everywhere else. The unit matrix serves essentially the same purpose in matrix algebra as does the number one in scalar algebra. A symmetric matrix is one where ij= ji for all i and j. Example 14.1.1 Examples of zero, identity, and symmetric matrices are (14.1.3) respectively. A special class of matrices are column vectors and row vectors: (14.1.4) We denote row and column vectors by lower case, boldfaced letters. The length or norm of the vector x of n elements is (14.1.5) Two matrices A and B are equal if and only if ij =bij for all possible i and j and they have the same dimensions. Having defined a matrix, let us explore some of its arithmetic properties. For two matrices A and B with the same dimensions (conformable for addition), the matrix C=A+B contains the elements cij= ij+bij. Similarly, C=A B contains the elements Linear Algebra 881 cij=aij bij. Because the order of addition does not matter, addition is commutative: A+B=B+A. Consider now a scalar constant k. The product kA is formed by multiplying every element of A by k. Thus the matrix kA has elements kaij. So far the rules for matrix arithmetic conform to their scalar counterparts. However, there are several possible ways of multiplying two matrices together. For example, we might simply multiply together the corresponding elements from each matrix. As we will see, the multiplication rule is designed to facilitate the solution of linear equations. We begin by requiring that the dimensions of A be m n while for B they are n p. That is, the number of columns in A must equal the number of rows in B. The matrices A and B are then said to be conformable for multiplication. If this is true, then C=AB is a matrix m p, where its elements equal (14.1.6) The right side of (14.1.6) is referred to as an inner product of the ith row of A and the jth column of B. Although (14.1.6) is the method used with a computer, an easier method for human computation is as a running sum of the products given by successive elements of the ith row of A and the corresponding elements of the jth column of B. The product AA is usually written A2; the product AAA, A3, and so forth. Example 14.1.2 If (14.1.7) then (14.1.8) (14.1.9) Checking our results using MATLAB, we have that A = [ 1 4 ; 2 3]; B = [1 2 ; 3 4]; 882 Advanced Engineering Mathematics with MATLAB C = A*B C = 11 14 7 8 Note that there is a tremendous difference between the MATLAB command for matrix multiplication * and element-by-element multiplication .*. Matrix multiplication is associative and distributive with respect to addition: (kA)B=k(AB)=A(kB), A(BC)=(AB)C, (A+B)C=AC+BC, and C(A+B)=CA+CB. On the other hand, matrix multiplication is not commutative. In general, AB BA. Example 14.1.3 Does AB=BA if (14.1.14) (14.1.13) (14.1.10) (14.1.11) (14.1.12) Because (14.1.15) and (14.1.16) Linear Algebra AB BA. 883 (14.1.17) Example 14.1.4 Given (14.1.18) find the product AB. Performing the calculation, we find that (14.1.19) The point here is that just because AB=0, this does not imply that either A or B equals the zero matrix. We cannot properly speak of division when we are dealing with matrices. Nevertheless, a matrix A is said to be nonsingular or invertible if there exists a matrix B such that AB=BA=I. This matrix B is the multiplicative inverse of A or simply the inverse of A, written A 1. A n n matrix is singular if it does not have a multiplicative inverse. Example 14.1.5 If (14.1.20) let us verify that its inverse is (14.1.21) 884 Advanced Engineering Mathematics with MATLAB We perform the check by finding AA 1 or A 1A, (14.1.22) In a later section we will show how to compute the inverse, given A. Another matrix operation is transposition. The transpose of a matrix A with dimensions m n is another matrix, written AT, where we interchanged the rows and columns from A. In MATLAB, AT is computed by typing A'. Clearly, (AT)T=A as well as (A+B)T=AT+BT, and (kA)T=kAT. If A and B are conformable for multiplication, then (AB)T=BT AT. Note the reversal of order between the two sides. To prove this last result, we first show that the results are true for two 3 3 matrices A and B and then generalize to larger matrices. Having introduced some of the basic concepts of linear algebra, we are ready to rewrite (14.1.1) in a canonical form so that we can present techniques for its solution. We begin by writing (14.1.1) as a single column vector: (14.1.23) We now use the multiplication rule to rewrite (14.1.23) as (14.1.24) or Ax=b, (14.1.25) where x is the solution vector. If b=0, we have a homogeneous set of equations; otherwise, we have a nonhomogeneous set. In the next few sections, we will give a number of methods for finding x. Linear Algebra Example 14.1.6: Solution of a tridiagonal system A common problem in linear algebra involves solving systems such as b1y1+c1y2=d1, 885 (14.1.26) a2y1+b2y2+c2y3=d2, (14.1.27) (14.1.28) bNyN 1+cNyN=dN. (14.1.29) Such systems arise in the numerical solution of ordinary and partial differential equations. We begin by rewriting (14.1.26)(14.1.29) in the matrix notation: (14.1.30) The matrix in (14.1.30) is an example of a banded matrix: a matrix where all of the elements in each row are zero except for the diagonal element and a limited number on either side of it. In the present case, we have a tridiagonal matrix in which only the diagonal element and the elements immediately to its left and right in each row are nonzero. Consider the nth equation. We can eliminate an by multiplying the (n 1)th equation by an/bn 1 and subtracting this new equation from the nth equation. The values of bn and dn become (14.1.31) 886 Advanced Engineering Mathematics with MATLAB and (14.1.32) for n=2, 3,..., N. The coefficient cn is unaffected. Because elements a1 and cN are never involved, their values can be anything or they can be left undefined. The new system of equations may be written (14.1.33) The matrix in (14.1.33) is in upper triangular form because all of the elements below the principal diagonal are zero. This is particularly useful because yn can be computed by back substitution. That is, we first compute yN. Next, we calculate yN The solution yN simple: (14.1.34) 2 1 in terms of yN. can then be computed in terms of yN and yN 1. We continue this process until we find y1 in terms of yN, yN 1,..., y2. In the present case, we have the rather and (14.1.35) for n=N 1, N 2,..., 2,1. As we shall show shortly, this is an example of solving a system of linear equations by Gaussian elimination. For a tridiagonal case, we have the advantage that the solution can be expressed in terms of a recurrence relationship, a very convenient feature from a computational point of view. This algorithm is very robust, being stable2 as long as |ai+ai| <|bi|. By stability, we mean 2 Torii, T., 1966: Inversion of tridiagonal matrices and the stability of tridiagonal systems of linear systems. Tech. Rep. Osaka Uni ., 16, 403414. Linear Algebra that if we change b by b so that x changes by 0<M< , for any N. Problems Given and find x, then 887 where 1. A+B, B+A 2. A B, B A 3. 3A 2B, 3(2A B) 4. AT, BT, (BT)T 5. (A+B)T, AT+BT 6. B+BT, B BT 7. AB, ATB, BA, BT A 8. A2, B2 9. BBT, BTB 10. A2 3A+I 11. A3+2A 12. A4 4A2+2I by hand and using MATLAB. Can multiplication occur between the following matrices? If so, compute it. 13. 14. 15. 16. 17. If verify that 18. 7A=4A+3A, 19. 10A=5(2A), 20. (AT)T=A by hand and using MATLAB. 888 Advanced Engineering Mathematics with MATLAB If 21. (A+B)+C=A+(B+C), 22. (AB)C=A(BC), 23. A(B+C)=AB+AC, 24. (A+B)C=AC+BC by hand and using MATLAB. Verify that the following A 1 are indeed the inverse of A: 25. verify that 26. by hand and using MATLAB. Write the following linear systems of equations in matrix form: Ax=b. 27. x1 2x2=5 3x1+x2=1 28. 2x1+x2+4x3=2 29. x2+2x3+3x4=2 x1+x2+x3+x4= 3 3x1 4x3 4x4=5 2x1 3x2+x3 3x4=7. 14.2 DETERMINANTS Determinants appear naturally during the solution of simultaneous equations. Consider, for example, two simultaneous equations with two unknowns x1 and x2, a11x1+a12x2=b1, and a21x1+a22x2=b2. The solution to these equations for the value of x1 and x2 is (14.2.3) (14.2.2) (14.2.1) 4x1+2x2+5x3=6 6x1 3x2+5x3=2 Linear Algebra and 889 (14.2.4) Note that the denominator of (14.2.3) and (14.2.4) is the same. This term, which always appears in the solution of 2 2 systems, is formally given the name of determinant and written (14.2.5) MATLAB provides a simple command det (A) which computes the determinant of A. For example, in the present case, A = [2 det(A) ans = 0 1 2; 1 3 2; 5 1 6]; Although determinants have their origin in the solution of systems of equations, any square array of numbers or expressions possesses a unique determinant, independent of whether it is involved in a system of equations or not. This determinant is evaluated (or expanded) according to a formal rule known as Laplace's expansion of cofactors.3 The process revolves around expanding the determinant using any arbitrary column or row of A. If the ith row or jth column is chosen, the determinant is given by det(A)=ai1Ai1+ai2Ai2+...+ainAin (14.2.6) =a1jA1j+a2jA2j+...+anjAnj, (14.2.7) where Aij, the cofactor of aij, equals ( 1)i+j Mij. The minor Mij is the determinant of the (n 1) (n 1) submatrix obtained by deleting row i, column j of A. This rule, of course, was chosen so that determinants are still useful in solving systems of equations. Laplace, P.S., 1772: Recherches sur le calcul intgral et sur le systme du monde. Hist. Acad. R. Sci., IIe Partie, 267376. OEuvres, 8, pp. 369501. See Muir, T., 1960: The Theory of Determinants in the Historical Order of Development, Vol. I, Part 1, General Determinants Up to 1841. Dover Publishers, pp. 2433. 3 890 Advanced Engineering Mathematics with MATLAB Example 14.2.1 Let us evaluate by an expansion in cofactors. Using the first column, (14.2.8) =2(16) 1( 8)+5( 8)=0. (14.2.9) The greatest source of error is forgetting to take the factor ( 1)i+j into account during the expansion. Although Laplace's expansion does provide a method for calculating det(A), the number of calculations equals (n!). Consequently, for hand calculations, an obvious strategy is to select the column or row that has the greatest number of zeros. An even better strategy would be to manipulate a determinant with the goal of introducing zeros into a particular column or row. In the remaining portion of this section, we show some operations that may be performed on a determinant to introduce the desired zeros. Most of the properties follow from the expansion of determinants by cofactors. G Rule 1: For every square matrix A, det(AT)=det(A). The proof is left as an exercise. G Rule 2: If any two rows or columns of A are identical, det(A)=0. To see that this is true, consider the following 3 3 matrix: (14.2.10) G Rule 3: The determinant of a triangular matrix is equal to the product of its diagonal elements. Linear Algebra If A is lower triangular, successive expansions by elements in the first column give 891 (14.2.11) =...=a11a22...ann. (14.2.12) If A is upper triangular, successive expansions by elements of the first row prove the property. Rule 4: If a square matrix A has either a row or a column of all zeros, then det(A)=0. The proof is left as an exercise. Rule 5: If each element in one row (column) of a determinant is multiplied by a number c, the value of the determinant is multiplied by c. Suppose that |B| has been obtained from |A| by multiplying row i (column j) of |A| by c. Upon expanding |B| in terms of row i (column j) each term in the expansion contains c as a factor. Factor out the common c, the result is just c times the expansion |A| by the same row (column). Rule 6: If each element of a row (or a column) of a determinant can be expressed as a binomial, the determinant can be written as the sum of two determinants. To understand this property, consider the following 3 3 determinant: (14.2.13) The proof follows by expanding the determinant by the row (or column) that contains the binomials. Rute 7: If B is a matrix obtained by interchanging any two rows (columns) of a square matrix A, then det(B)= det(A). The proof is by induction. It is easily shown for any 2 2 matrix. Assume that this rule holds of any (n 1) (n 1) matrix. If A is n n, then let B be a matrix formed by interchanging rows i and j. Expanding |B| and |A| by a different row, say k, we have that (14.2.14) where Mks and Nks are the minors formed by deleting row k, column s from |B| and |A|, respectively. For s=1, 2,..., n, we obtain Nks and Mks by interchanging rows i and j. By the induction hypothesis and recalling that Nks and Mks are (n 1) (n 1) determinants, 892 Advanced Engineering Mathematics with MATLAB Nks= Mks for s=1, 2,..., n. Hence, |B|= |A|. Similar arguments hold if two columns are interchanged. G Rule 8: If one row (column) of a square matrix A equals to a number c times some other row (column), then det(A)=0. Suppose one row of a square matrix A is equal to c times some other row. If c=0, then |A|=0. If c 0, then |A|=c|B|, where |B|=0 because |B| has two identical rows. A similar argument holds for two columns. G Rule 9: The value of det(A) is unchanged if any arbitrary multiple of any line (row or column) is added to any other line. To see that this is true, consider the simple example: (14.2.15) where c 0. The first determinant on the left side is our original determinant. In the second determinant, we again expand the first column and find that (14.2.16) Example 14.2.2 Let us evaluate using a combination of the properties stated above and expansion by cofactors. By adding or subtracting the first row to the other rows, we have that (14.2.17) (14.2.18) Linear Algebra 893 (14.2.19) Problems Evaluate the following determinants. Check your answer using MATLAB. 1. 2. 3. 4. 5. 6. 7. 8. 9. Using the properties of determinants, show that This determinant is called Vandermonde's determinant. 10. Show that 894 Advanced Engineering Mathematics with MATLAB 11. Show that if all of the elements of a row or column are zero, then det(A)= 0. 12. Prove that det(AT)=det(A). 14.3 CRAMER'S RULE One of the most popular methods for solving simple systems of linear equations is Cramer's rule.4 It is very useful for 2 2 systems, acceptable for 3 3 systems, and of doubtful use for 4 4 or larger systems. Let us have n equations with n unknowns, Ax=b. Cramer's rule states that (14.3.1) where Ai is a matrix obtained from A by replacing the ith column with b and n is the number of unknowns and equations. Obviously, det(A) 0 if Cramer's rule is to work. To prove5 Cramer's rule, consider (14.3.2) by Rule 5 from the previous section. By adding x2 times the second column to the first column, (14.3.3) Multiplying each of the columns by the corresponding xi and adding it to the first column yields 4 Cramer, G., 1750: Introduction l'analyse des lignes courbes algbriques. Geneva, p. 657. 5 First proved by Cauchy, L.A., 1815: Mmoire sur les fonctions quine peuvent obtemir que deux valeurs gales et de signes contraires par suite des transportations opres entre les variables qelles renferment. J. l'Ecole Polytech., 10, 29112. Linear Algebra 895 (14.3.4) The first column of (14.3.4) equals Ax and we replace it with b. Thus, (14.3.5) or (14.3.6) provided det(A) 0. To complete the proof we do exactly the same procedure to the jth column. Example 14.3.1 Let us solve the following system of equations by Cramer's rule: 2x1+x2+2x3= 1, (14.3.7) x1+x3= 1, (14.3.8) and x1+3x2 2x3=7. From the matrix form of the equations, (14.3.9) 896 Advanced Engineering Mathematics with MATLAB (14.3.10) we have that (14.3.11) (14.3.12) (14.3.13) and (14.3.14) Finally, (14.3.15) You can also use MATLAB to perform Cramer's rule. In the present example, the script is as follows: clear ; % clear all previous computations A = [2 1 2; 1 0 1; 1 3 2]; % input coefficient matrix b = [ 1 ; 1; 7]; % input right side A1 = A; A1(:,1) = b ; % compute A_1 A2 = A; A2(:,2) = b ; % compute A_2 A3 = A; A3(:,3) = b ; % compute A_3 % compute solution vector x = [det(A1), det(A2), det(A3)] / det(A) Linear Algebra Problems Solve the following systems of equations by Cramer's rule: 1. x1+2x2=3, 3x1+x2=6 2. 2x1+x2= 3, x1 x2=1 3. x1+2x2 2x3=4, 2x1+x2+x3= 2, x1+x2 x3=2 4. 2x1+3x2 x3= 1, x1 2x2+x3=5, 3x1--x2= 2. Check your answer using MATLAB. 14.4 ROW ECHELON FORM AND GAUSSIAN ELIMINATION 897 So far, we assumed that every system of equations has a unique solution. This is not necessary true as the following examples show. Example 14.4.1 Consider the system x1+x2=2, and 2x1+2x2= 1. (14.4.2) (14.4.1) This system is inconsistent because the second equation does not follow after multiplying the first by 2. Geometrically (14.4.1) and (14.4.2) are parallel lines; they never intersect to give a unique x1 and x2. Example 14.4.2 Even if a system is consistent, it still may not have a unique solution. For example, the system x1+x2=2, and 2x1+2x2=4 (14.4.4) (14.4.3) 898 Advanced Engineering Mathematics with MATLAB is consistent, the second equation formed by multiplying the first by 2. However, there are an infinite number of solutions. Our examples suggest the following: Theorem: A system of m linear equations in n unknowns may: (1) have no solution, in which case it is called an inconsistent system, or (2) have exactly one solution (called a unique solution), or (3) have an infinite number of solutions. In the latter two cases, the system is said to be consistent. Before we can prove this theorem at the end of this section, we need to introduce some new concepts. The first one is equivalent systems. Two systems of equations involving the same variables are equivalent if they have the same solution set. Of course, the only reason for introducing equivalent systems is the possibility of transforming one system of linear systems into another which is easier to solve. But what operations are permissible? Also what is the ultimate goal of our transformation? From a complete study of possible operations, there are only three operations for transforming one system of linear equations into another. These three elementary row operations are (1) interchanging any two rows in the matrix, (2) multiplying any row by a nonzero scalar, and (3) adding any arbitrary multiple of any row to any other row. Armed with our elementary row operations, let us now solve the following set of linear equations: x1 3x2+7x3=2, (14.4.5) 2x1+4x2 3x3= 1, (14.4.6) and x1+13x2 21x3=2. (14.4.7) We begin by writing (14.4.5)(14.4.7) in matrix notation: (14.4.8) Linear Algebra 899 The matrix in (14.4.8) is called the coefficient matrix of the system. We now introduce the concept of the augmented matrix: a matrix B composed of A plus the column vector b or (14.4.9) We can solve our original system by performing elementary row operations on the augmented matrix. Because xi functions essentially as a placeholder, we can omit them until the end of the computation. Returning to the problem, the first row can be used to eliminate the elements in the first column of the remaining rows. For this reason the first row is called the pivotal row and the element a11 is the pivot. By using the third elementary row operation twice (to eliminate the 2 and 1 in the first column), we have the equivalent system (14.4.10) At this point we choose the second row as our new pivotal row and again apply the third row operation to eliminate the last element in the second column. This yields (14.4.11) Thus, elementary row operations transformed (14.4.5)(14.4.7) into the triangular system: x1 3x2+7x3=2, (14.4.12) 10x2 17x3= 5, (14.4.13) 3x3=9, (14.4.14) 900 Advanced Engineering Mathematics with MATLAB which is equivalent to the original system. The final solution is obtained by back substitution, solving from (14.4.14) back to (14.4.12). In the present case, x3=3. Then, 10x2=17(3) 5, or x2=4.6. Finally, x1=3x2 7x3+2= 5.2. In general, if an n n linear system can be reduced to triangular form, then it has a unique solution that we can obtain by performing back substitution. This reduction involves n 1 steps. In the first step, a pivot element, and thus the pivotal row, is chosen from the nonzero entries in the first column of the matrix. We interchange rows (if necessary) so that the pivotal row is the first row. Multiples of the pivotal row are then subtracted from each of the remaining n 1 rows so that there are 0's in the (2,1),..., (n, 1) positions. In the second step, a pivot element is chosen from the nonzero entries in column 2, rows 2 through n, of the matrix. The row containing the pivot is then interchanged with the second row (if necessary) of the matrix and is used as the pivotal row. Multiples of the pivotal row are then subtracted from the remaining n 2 rows, eliminating all entries below the diagonal in the second column. The same procedure is repeated for columns 3 through n 1. Note that in the second step, row 1 and column 1 remain unchanged, in the third step the first two rows and first two columns remain unchanged, and so on. If elimination is carried out as described, we arrive at an equivalent upper triangular system after n 1 steps. However, the procedure fails if, at any step, all possible choices for a pivot element equal zero. Let us now examine such cases. Consider now the system x1+2x2+x3= 1, (14.4.15) 2x1+4x2+2x3= 2, (14.4.16) x1+4x2+2x3=2. (14.4.17) Its augmented matrix is (14.4.18) Choosing the first row as our pivotal row, we find that (14.4.19) Linear Algebra or 901 (14.4.20) The difficulty here is the presence of the zeros in the third row. Clearly any finite numbers satisfy the equation 0x1+0x2+0x3=0 and we have an infinite number of solutions. Closer examination of the original system shows a underdetermined system; (14.4.15) and (14.4.16) differ by a multiplicative factor of 2. An important aspect of this problem is the fact that the final augmented matrix is of the form of a staircase or echelon form rather than of triangular form. Let us modify (14.4.15)(14.4.17) to read x1+2x2+x3= 1, (14.4.21) 2x1+4x2+2x3=3, (14.4.22) x1+4x2+2x3=2, then the final augmented matrix is (14.4.23) (14.4.24) We again have a problem with the third row because 0x1+0x2+0x3=5, which is impossible. There is no solution in this case and we have an inconsistent system. Note, once again, that our augmented matrix has a row echelon form rather than (1) The first nonzero entry in each row is 1. (2) If row k does not consist entirely of zeros, the number of leading zero entries in row k+1 is greater than the number of leading zero entries in row k. (3) If there are rows whose entries are all zero, they are below the rows having nonzero entries. 902 Advanced Engineering Mathematics with MATLAB The number of nonzero rows in the row echelon form of a matrix is known as its rank. In MATLAB, the rank is easily found using the command rank( ). Gaussian elimination is the process of using elementary row operations to transform a linear system into one whose augmented matrix is in row echelon form. Example 14.4.3 Each of the following matrices is not of row echelon form because they violate one of the conditions for row echelon form: (14.4.25) Example 14.4.4 The following matrices are in row echelon form: (14.4.26) Example 14.4.5 Gaussian elimination can also be used to solve the general problem AX= B. One of the most common applications is in finding the inverse. For example, let us find the inverse of the matrix (14.4.27) by Gaussian elimination. Because the inverse is defined by AA 1=I, our augmented matrix is (14.4.28) Linear Algebra Then, by elementary row operations, 903 (14.4.29) (14.4.30) (14.4.31) (14.4.32) (14.4.33) (14.4.34) (14.4.35) Thus, the right half of the augmented matrix yields the inverse and it equals (14.4.36) MATLAB has the ability of doing Gaussian elimination step-by-step. We begin by typing % input augmented matrix aug = [4 2 2 1 0 0 ; 2 rrefmovie(aug); 4 4 0 1 0; 4 2 8 0 0 1] ; The MATLAB command rrefmovie(A) produces the reduced row echelon form of A. Repeated pressing of any key gives the next step in the calculation along with a statement of how it computed the modified augmented matrix. Eventually you obtain 904 Advanced Engineering Mathematics with MATLAB A= 1 0 0 0 1 0 0 0 1 1/5 0 1/10 1/10 0 1/5 1/10 0 1/10 You can read the inverse matrix just as we did earlier. Gaussian elimination may be used with overdetermined systems. Over-determined systems are linear systems where there are more equations than unknowns (m>n). These systems are usually (but not always) inconsistent. Example 14.4.6 Consider the linear system x1+x2=1, (14.4.37) x1+2x2= 2, (14.4.38) x1 x2=4. (14.4.39) After several row operations, the augmented matrix (14.4.40) becomes (14.4.41) From the last row of the augmented matrix (14.4.41) we see that the system is inconsistent. If we test this system using MATLAB by typing % input augmented matrix aug = [1 1 1; 1 2 2; 1 rrefmovie(aug) ; eventually you obtain 1 4] ; Linear Algebra A= 1 0 0 0 1 0 0 0 1 905 Although the numbers have changed from our hand calculation, we still have an inconsistent system because x1=x2=0 does not satisfy x1+x2=1. Considering now a slight modification of this system to x1+x2=1, (14.4.42) x1+2x2=5, (14.4.43) x1= 1, the final form of the augmented matrix is (14.4.44) (14.4.45) which has the unique solution x1= 1 and x2=2. How does MATLAB handle this problem? Typing % input augmented matrix aug = [1 1 1 ; 1 2 5; 1 0 rrefmovie (aug) ; 1] ; we eventually obtain A= 1 0 0 0 1 0 1 2 0 This yields x1= 1 and x2=2, as we found by hand. Finally, by introducing the set: x1+x2=1, (14.4.46) 906 Advanced Engineering Mathematics with MATLAB 2x1+2x2=2, (14.4.47) 3x1+3x3=3, (14.4.48) the final form of the augmented matrix is (14.4.49) There are an infinite number of solutions: x1=1 Turning to MATLAB, we first type % input augmented matrix aug = [1 1 1; 2 2 2 ; 3 3 3] ; rrefmovie (aug); , and x2= . and we eventually obtain A= 1 0 0 1 0 0 1 0 0 This is the same as (14.4.49) and the final answer is the same. Gaussian elimination can also be employed with underdetermined systems. An underdetermined linear system is one where there are fewer equations than unknowns (m<n). These systems usually have an infinite number of solutions although they can be inconsistent. Example 14.4.7 Consider the underdetermined system: 2x1+2x2+x3= 1, (14.4.50) 4x1+4x2+2x3=3. (14.4.51) Linear Algebra Its augmented matrix can be transformed into the form: 907 (14.4.52) Clearly this case corresponds to an inconsistent set of equations. On the other hand, if (14.4.51) is changed to 4x1+4x2+2x3= 2, (14.4.53) then the final form of the augmented matrix is (14.4.54) and we have an infinite number of solutions, namely x3= , x2= , and 2x1= 1 2 . Consider now one of the most important classes of linear equations: the homogeneous equations Ax=0. If det(A) 0, then by Cramer's rule x1= x2=x3=...=xn=0. Thus, the only possibility for a nontrivial solution is det(A)=0. In this case, A is singular, no inverse exists, and nontrivial solutions exist but they are not unique. Example 14.4.8 Consider the two homogeneous equations: x1+x2=0, (14.4.55) x1 x2=0. (14.4.56) Note that det(A)= 2. Solving this system yields x1 x2=0. However, if we change the system to x1+x2=0, (14.4.57) 908 Advanced Engineering Mathematics with MATLAB x1+x2=0, (14.4.58) which has the det(A)=0 so that A is singular. Both equations yield x1= x2= , any constant. Thus, there is an infinite number of solutions for this set of homogeneous equations. We close this section by outlining the proof of the theorem which we introduced at the beginning. Consider the system Ax=b. By elementary row operations, the first equation in this system can be reduced to x1+ 12 2 x +...+ 1n n x = 1. (14.4.59) The second equation has the form xp+ 2p+1 p+1 x +...+ 2n n x = 2, (14.4.60) where p>1. The third equation has the form xq+ 3q+1 xq+1+...+ 3n n x = 3, (14.4.61) where q>p, and so on. To simplify the notation, we introduce zi where we choose the first k values so that z1=x1, z2=xp, z3=xq,.... Thus, the question of the existence of solutions depends upon the three integers: m, n, and k. The resulting set of equations have the form: (14.4.62) Note that k+1 ,..., m need not be all zero. k+1 There are three possibilities: (a) k<m and at least one of the elements ,..., m is nonzero. Linear Algebra Suppose that an element p 909 is nonzero (p>k). Then the pth equation is 0z1+0z2+...+0zn= p 0. (14.4.63) However, this is a contradiction and the equations are inconsistent. (b) k=n and either (i) k<m and all of the elements k+1,..., m are zero, or (ii) k=m. Then the equations have a unique solution which can be obtained by back-substitution. (c) k<n and either (i) k<m and all of the elements k+1,..., m are zero, or (ii) k=m. Then, arbitrary values can be assigned to the n k variables zk+1,..., zn. The equations can be solved for z1, z2,..., zk and there is an infinity of solutions. For homogeneous equations b=0, all of the i are zero. In this case, we have only two cases: (b ) k=n, then (14.4.62) has the solution z=0 which leads to the trivial solution for the original system Ax=0. (c ) k<n, the equations possess an infinity of solutions given by assigning arbitrary values to zk+1,..., zn. Problems Solve the following systems of linear equations by Gaussian elimination. Check your answer using MATLAB. 1. 2x1+x2=4, 5x1 2x2=1 2. x1+x2=0, 3x1 4x2=1 3. x1+x2+2x3=0, 3x1+4x2+x3=0, x1+x2+2x3=0 4. 4x1+6x2+x3=2, 2x1+x2 4x3=3, 3x1 2x2+5x3=8 5. 3x1+x2 2x3= 3, x1 x2+2x3= 1, 4x1+3x2 6x3=4 6. x1 3x2+7x3=2, 2x1+4x23x3= 1, 3x1+7x2+2x3=3 7. x1 x2+3x3=5, 2x1 4x2+7x3=7, 4x1 9x2+2x3= 15 8. x1+x2+x3+x4= 1, 2x1 x2+3x3=1, 2x2+3x4=15, x1+2x2+x4= 2 Find the inverse of each of the following matrices by Gaussian elimination. Check your answers using MATLAB. 9. 10. 11. 910 Advanced Engineering Mathematics with MATLAB 12. 13. Does (A2) 1=(A 1)2? Justify your answer. 14.5 EIGENVALUES AND EIGENVECTORS One of the classic problems of linear algebra6 is finding all of the 's which satisfy the n n system Ax= x. (14.5.1) The nonzero quantity is the eigenvalue or characteristic value of A. The vector x is the eigenvector or characteristic vector belonging to . The set of the eigenvalues of A is called the spectrum of A. The largest of the absolute values of the eigenvalues of A is called the spectral radius of A. To find and x, we first rewrite (14.5.1) as a set of homogeneous equations: (A I)x=0. (14.5.2) From the theory of linear equations, (14.5.2) has trivial solutions unless its determinant equals zero. On the other hand, if det(A I)=0, (14.5.3) there are an infinity of solutions. The expansion of the determinant (14.5.3) yields a nth-degree polynomial in , the characteristic polynomial. The roots of the characteristic polynomial are the eigenvaluesof A. Because the characteristic polynomial has exactly n roots, A has n eigenvalues,some of which can be repeated (with multiplicity k n) and some of which can becomplex numbers. For each eigenvalue i, there is a corresponding eigenvector xi. Thiseigenvector is the solution of the homogeneous equations (A iI)xi=0. An important property of eigenvectors is their linear independence if there are n distinct eigenvalues. Vectors are linearly independent if the equation can be satisfied only by taking all of the coefficients n equal to zero. The standard reference is Wilkinson, J.H., 1965: The Algebraic Eigenvalue Problem. Oxford University Press, 662 pp. 6 Linear Algebra x + 2x2+...+ nxn=0 , ,..., 911 1 1 (14.5.4) To show that this is true in the case of n distinct eigenvalues i 1 2 n , each eigenvalue having a corresponding eigenvector xi, we first write down the linear dependence condition 1 1 x + 2x2+...+ nxn=0. (14.5.5) Premultiplying (14.5.5) by A, 1 Ax1+ 2Ax2+...+ nAxn= 1 1 1 x+ 2 2 2 x +...+ n n n x =0. (14.5.6) Premultiplying (14.5.5) by A2, (14.5.7) In a similar manner, we obtain the system of equations: (14.5.8) Because (14.5.9) since it is a Vandermonde determinant, 1x1= 2x2= 3x3=...= nxn= 0. Because the eigenvectors are nonzero, 1= 2= 3=...= n=0, and the eigenvectors are linearly independent. 912 Advanced Engineering Mathematics with MATLAB This property of eigenvectors allows us to express any arbitrary vector x as a linear sum of the eigenvectors xi, or x=c1x1+c2x2+...+cnxn. We will make good use of this property in Example 14.5.3. Example 14.5.1 Let us find the eigenvalues and corresponding eigenvectors of the matrix (14.5.10) (14.5.11) We begin by setting up the characteristic equation: (14.5.12) Expanding the determinant, ( 4 )( 1 )+2= 2+5 +6=( +3)( +2)=0. (14.5.13) Thus, the eigenvalues of the matrix A are 1 = 3, and 2 = 2. To find the corresponding eigenvectors, we must solve the linear system: (14.5.14) For example, for 1 = 3, (14.5.15) Linear Algebra or x1=2x2. Thus, any nonzero multiple of the vector Similarly, for 2 913 (14.5.16) is an eigenvector belonging to = 3. 1 = 2, the eigenvector is any nonzero multiple of the vector Of course, MATLAB will do all of the computations for you via the command eig which computes the eigenvalues and corresponding eigenvalues. In the present case, you would type A = [ 4 2; 1 1] % load in array A ; % find eigenvalues and eigenvectors [eigenvector, eigenvalue] = eig(A) This yields eigenvector = 0.8944 0.4472 0.7071 0.7071 and eigenvalue = 3 0 0 2. The eigenvalues are given as the elements along the principal diagonal of eigenvalue. The corresponding vectors are given by the corresponding column of eigenvector. As this example shows, these eigenvectors have been normalized so that their norm (14.1.5) equals one. Also their sign may be different than you would choose. We can recover our hand-computed results by dividing the first eigenvector by 0.4472 while in the second case we would divide by 0.7071. Example 14.5.2 Let us now find the eigenvalues and corresponding eigenvectors of the matrix (14.5.17) 914 Advanced Engineering Mathematics with MATLAB Setting up the characteristic equation: det(A I) (14.5.18) (14.5.19) (14.5.20) Thus, the eigenvalues of the matrix A are 1, 2 =1 (twice), and 3 =6. To find the corresponding eigenvectors, we must solve the linear system: ( 4 )x1+5x2+5x3=0, (14.5.21) 5x1+(6 )x2+5x3=0, (14.5.22) and 5x1+5x2+(6 )x3=0. (14.5.23) For 3 =6, (14.5.21)(14.5.23) become 10x1+5x2+5x3=0, (14.5.24) 5x1+5x3=0, (14.5.25) Linear Algebra and 5x1+5x2=0. 915 (14.5.26) Thus, x1=x2=x3 and the eigenvector is any nonzero multiple of the vector The interesting aspect of this example centers on finding the eigenvector for the eigenvalue 1, 2=1. If 1, 2=1, then (14.5.21)(14.5.23) collapses into one equation x1+x2+x3=0 (14.5.27) and we have two free parameters at our disposal. Let us take x2= , and x3= . Then the eigenvector equals In this example, we may associate the eigenvector so that, along with the eigenvector and we still have n linearly independent eigenvectors for our 3 3 matrix. However, with repeated eigenvalues this is not always true. For example, (14.5.28) has the repeated eigenvalues both 1 1, 2 =1. However, there is only a single eigenvector for and 2 . What happens in MATLAB in the present case? Typing in A= [ 4 5 5; 5 6 5; 5 5 6]; % load in array A % find eigenvalues and eigenvectors [eigenvector,eigenvalue]=eig(A) we obtain eigenvector = 0.8165 0.5774 0.6345 916 Advanced Engineering Mathematics with MATLAB 0.4082 0.4082 0.5774 0.5774 0.1278 0.7623 and eigenvalue = 1 0 0 6 0 0 0 0 1 The second eigenvector is clearly the same as the hand-computed one if you normalized it with 0.5774. The equivalence of the first and third eigenvectors is not as clear. However, if you choose = = 0.4082, then the first eigenvector agrees with the hand-computed value. Similarly, taking = 0.1278 and =0.7623 result in agreement with the third MATLAB eigenvector. Example 14.5.3 When we discussed the stability of numerical schemes for the wave equation in 10.6, we examined the behavior of a prototypical Fourier harmonic to variations in the parameter c t/ x. In this example we shall show another approach to determining the stability of a numerical scheme via matrices. Consider the explicit scheme for the numerical integration of the wave equation (10.6.11). We can rewrite that single equation as the coupled difference equations: (14.5.29) and (14.5.30) where r=c t/ x. (14.5.29)(14.5.30) become and where is real. Then (14.5.31) and (14.5.32) Linear Algebra or in the matrix form 917 (14.5.33) where The eigenvalues of this amplification matrix are given by (14.5.34) or (14.5.35) Because each successive time step consists of multiplying the solution from the previous time step by the amplification matrix, the solution is stable only if remains bounded. This occurs only if all of the eigenvalues have a magnitude less or equal to one because (14.5.36) where A denotes the amplification matrix and xk denotes the eigenvectors corresponding to the eigenvalues k . Equation (14.5.36) follows from our ability to express any initial condition in terms of an eigenvector expansion (14.5.37) In our particular example, two cases arise. If r2 sin2( x/2) 1, (14.5.38) and | 1, 2 |=1. On the other hand, if r2sin2( x/2)>1, | 1, 2 |>1. Thus, we have stability only if c t/ x 1. Problems Find the eigenvalues and corresponding eigenvectors for the following matrices. Check your answers using MATLAB. 1. 918 Advanced Engineering Mathematics with MATLAB 2. 3. 4. 5. 6. 7. 8. Project: Numerical Solution of the Sturm-Liouville Problem You may have been struck by the similarity of the algebraic eigenvalue problem to the SturmLiouville problem. In both cases nontrivial solutions exist only for characteristic values of . The purpose of this project is to further deepen your insight into these similarities. Figure 14.5.1: Schematic for finite-differencing a Sturm-Liouville problem into a set of difference equations. Linear Algebra Consider the Sturm-Liouville problem y + y=0, y(0)=y( )=0. 919 (14.5.39) We know that it has the nontrivial solutions m =m2, ym(x)=sin(mx), where m=1, 2, 3,.... step 1: Let us solve this problem numerically. Introducing centered finite differencing and the grid shown in Figure 14.5.1, show that (14.5.40) where x= /(N+1). Show that the finite-differenced form of (14.5.39) is h2yn+1+2h2yn h2yn 1= yn with y0=yN+1=0, and h=1/( x). step 2: Solve (14.5.41) as an algebraic eigenvalue problem using N=1, 2,.... Show that (14.5.41) can be written in the matrix form of (14.5.41) (14.5.42) Table 14.5.1: Eigenvalues Computed from (14.5.42) as a Numerical Approximation of the Sturm-Liouville Problem (14.5.39) N 1 2 3 4 1 2 3 4 5 6 7 0.81057 0.91189 0.94964 0.96753 2.73567 3.24228 3.50056 5.53491 6.63156 9.16459 920 Advanced Engineering Mathematics with MATLAB 5 6 7 8 20 50 0.97736 0.98333 0.98721 0.98989 0.99813 0.99972 3.64756 3.73855 3.79857 3.84016 3.97023 3.99498 7.29513 7.71996 8.00605 8.20702 8.84993 8.97438 10.94269 12.13899 12.96911 13.56377 15.52822 15.91922 13.61289 16.12040 17.93217 19.26430 23.85591 24.80297 18.87563 22.13966 24.62105 33.64694 35.59203 24.95100 28.98791 44.68265 48.24538 Note that the coefficient matrix is symmetric. Step 3: You are now ready to compute the eigenvalues. For small N this could be done by hand. However, it is easier just to write a MATLAB program that will handle any N 2. Table 14.5.1 has been provided so that you can check your program. With your program, answer the following questions: How do your computed eigenvalues compare to the eigenvalues given by the Sturm-Liouville problem? What happens as you increase N? Which computed eigenvalues agree best with those given by the Sturm-Liouville problem? Which ones compare the worst? Step 4: Let us examine the eigenfunctions now. Starting with the smallest eigenvalue, use MATLAB to plot Cyj as a function of xi where yj is the jth eigenvector, j=1, 2,..., N, xi=i x, i=1, 2,..., N, and C is chosen so that On the same plot, graph Why did we choose C as we did? Which eigenvectors and eigenfunctions agree the best? Which eigenvectors and eigenfunctions agree the worst? Why? Why are there N eigenvectors and an infinite number of eigenfunctions? Step 5: The most important property of eigenfunctions is orthogonality. But what do we mean by orthogonality in the case of eigenvectors? Recall from three-dimensional vectors we had the scalar dot product ab=a1b1+a2b2+a3b3. For n-dimensional vectors, this dot product is generalized to the inner product (14.5.43) (14.5.44) Orthogonality implies that xy=0 if x y. Are your eigenvectors orthogonal? How might you use this property with eigenvectors? 14.6 SYSTEMS OF LINEAR DIFFERENTIAL EQUATIONS In this section we show how we may apply the classic algebraic eigenvalue problem to solve a system of ordinary differential equations. Linear Algebra Let us solve the following system: 921 (14.6.1) and (14.6.2) where the primes denote the time derivative. We begin by rewriting (14.6.1)(14.6.2) in matrix notation: x =Ax, (14.6.3) where (14.6.4) Note that (14.6.5) Assuming a solution of the form (14.6.6) is a constant vector, we substitute (14.6.6) into (14.6.3) and find that e tx0=Ae tx0. (14.6.7) Because e t does not generally equal zero, we have that 922 Advanced Engineering Mathematics with MATLAB (A I)x0=0, (14.6.8) which we solved in the previous section. This set of homogeneous equations is the classic eigenvalue problem. In order for this set not to have trivial solutions, (14.6.9) Expanding the determinant, (1 )29=0 or = 2, 4. (14.6.10) Thus, we have two real and distinct eigenvalues: = 2 and 4. We must now find the corresponding x0 or eigen ector for each eigenvalue. From (14.6.8), (1 )a+3b=0, (14.6.11) and 3a+(1 )b=0. (14.6.12) If =4, these equations are consistent and yield a=b=c1. If = 2, we have that a= b=c2. Therefore, the general solution in matrix notation is (14.6.13) To evaluate c1 and c2, we must have initial conditions. For example, if x1(0) =x2(0)=1, then (14.6.14) Linear Algebra 923 Solving for c1 and c2, c1=1, c2=0, and the solution with this particular set of initial conditions is (14.6.15) Example 14.6.1 Let us solve the following set of linear ordinary differential equations (14.6.16) (14.6.17) and (14.6.18) or in matrix form, (14.6.19) Assuming the solution x=x0e t, (14.6.20) or (14.6.21) 924 Advanced Engineering Mathematics with MATLAB For nontrivial solutions, (14.6.22) and ( 1)( 3)( +1)=0, or = 1, 1, 3. (14.6.23) To determine the eigenvectors, we rewrite (14.6.21) as a b+c=0, (14.6.24) 4a (1+ )b 4c=0, and (14.6.25) 3a b+(4 )c=0. (14.6.26) For example, if =1, a b+c=0, (14.6.27) 4a 2b 4c=0, and 3a b+3c=0; (14.6.28) (14.6.29) or a=c, and b=0. Thus, the eigenvector for Similarly, Linear Algebra 925 for is and for Thus, the most general solution (14.6.30) Example 14.6.2 Let us solve the following set of linear ordinary differential equations: (14.6.31) and (14.6.32) or in matrix form, (14.6.33) Assuming the solution x=x0e t, (14.6.34) For nontrivial solutions, (14.6.35) 926 Advanced Engineering Mathematics with MATLAB Thus, we have the solution (14.6.36) The interesting aspect of this example is the single solution that the traditional approach yields because we have repeated roots. To find the second solution, we try the solution (14.6.37) We guessed (14.6.37) using our knowledge of solutions to differential equations when the characteristic polynomial has repeated roots. Substituting (14.6.37) into (14.6.33), we find that c=d=2c2, and a b=c2. Thus, we have one free parameter, which we choose to be b, and set it equal to zero. This is permissible because (14.6.37) can be broken into two terms: and The first term can be incorporated into the term. Thus, the general solution is (14.6.38) Example 14.6.3 Let us solve the system of linear differential equations: (14.6.39) and (14.6.40) or in matrix form, (14.6.41) Linear Algebra Assuming the solution x=x0e t, 927 (14.6.42) For nontrivial solutions, (14.6.43) and =23i. If solution is then b= ai if =2+3i, and b=ai if =2 3i. Thus, the general (14.6.44) where c1 and c2 are arbitrary complex constants. Using Euler relationships, we can rewrite (14.6.44) as (14.6.45) where c3=c1+c2 and c4=i(c1 c2). Problems Find the general solution of the following sets of ordinary differential equations using matrix technique. You may find the eigenvalues and eigenvectors either by hand or use MATLAB. 1. 2. 3. 4. 5. 6. 7. 8. 928 Advanced Engineering Mathematics with MATLAB 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. Answers To the Odd-Numbered Problems Section 1.1 1. 1+2i 3. 2/5 5. 7. 4e i 9. 11. 2e2 i/3 Section 1.2 1. 3. 5. 7. z1, 2=(1+i); z3, 4=2(1 i) Section 1.3 1. u=2 y, =x 3. u=x3 3xy2, =3x2y y3 5. f (z)=3z(1+z2)1/2 7. f (z)=2(1+4i)z 3 9. f (z)= 3i(iz 1) 4 11. 1/6 13. (x, y)=2xy+constant 15. (x, y)=x sin(x)e y+ye Section 1.4 1. 0 3. 2i 5. 14/15 i/3 Section 1.5 1. (e 2 e 4)/2 3. /2 Section 1.6 1. i/32 3. i/2 5. 2 i y cos(x)+constant. 930 Advanced Engineering Mathematics with MATLAB 7. 2 i 9. 6 Section 1.7 1. 3. We have an essential singularity and the residue equals 1/11! 5. We have a removable singularity where the value of the residue equals zero. 7. We have a simple pole and the residue equals 2. 9. We have a simple pole and the residue equals 1/2. Section 1.8 1. 3 i/4 3. 2 i. 5. 2 i 7. 2 i Section 2.1 1. first-order, linear 3. first-order, nonlinear 5. second-order, linear 7. third-order, nonlinear 9. second-order, nonlinear 11. first-order, nonlinear 13. first-order, nonlinear 15. second-order, nonlinear Section 2.2 1. y= ln(C x2/2) 3. y2(x) ln2(x)=2C 5. 2+y2(x)=C(1+x2) 7. y(x)= ln(C ex) 9. Answers To the Odd-Numbered Problems 931 13. 15. N(t)=N(0)exp{ln[K/N(0) (1 e bt )} 17. Section 2.3 1. In |y| x/y=C 3. |x|(x2+3y2)=C 5. y=x (ln |x|+C)2 7. sin(y/x) ln |x|=C Section 2.4 1. 3. xy2 x+cos(y)=C 5. y/x+ln(y)=C 7. cos(xy)=C 9. x2y3+x5y+y=C 11. xy ln(y)+ex e y=C 13. Section 2.5 1. 3. y=ln(x)/x+Cx 1, x 0 5. 7. esin(2x)y=C, n + <2x<(n+1) + , where 9. 11. y(x)=(x+C)csc(x) 13. 15. 17. y2(x)=2(x x2/k)/(2 k) if k 2; y2(x)=x ln(1/x) if k=2 is any real and n is any integer. 932 Advanced Engineering Mathematics with MATLAB 19. 21. y(x)=[Cx+x ln(x)] 23. 1 25. y(x)=[Cx x ln(x)]1/2 Section 2.6 5. The equilibrium points are x=0, , and 1. The equilibrium at x= is unstable while the equilibriums at x=0 and 1 are stable. 7. The equilibrium point for this differential equation is x=0, which is stable. Section 2.7 1. x(t)=et+t+1 2. x(t)=et2/2 3. x(t)=[1 ln(t+1)] 4. Section 3.0 1. y2(x)=A/x 3. y2(x)=Ax 4 1 5. y2(x)=A(x2 x+1) 7. 9. y(x)=C2eC1x 11. y=(1+C2eC1x)/C1 13. y= ln|1 x| 15. y=C1 2 ln(x2+C2) Section 3.1 1. y(x)=C1e x+C2e 3. y(x)=C1ex+C2xex 5. y(x)=C1e2x cos(2x)+C2e2x sin(2x) 7. y(x)=C1e 10x 5x +C2e4x Answers To the Odd-Numbered Problems 9. y(x)=e 4x 933 [C1 cos(3x)+C2 sin(3x)] 4x 11. y(x)=C1e 15. 17. Section 3.2 1. +C2xe 4x 13. y(x)=C1+C2x+C3 cos(2x)+C4 sin(2x) 3. x(t)=2cos( t 5. 2 /3) and (t)= 0 cos( t) s0 sin( t), where =Mg/mL. 2t 4t Section 3.3 1. x(t)=4e 2e 3. 5. The roots are equal when c=4 when m= 2. Section 3.4 1. 3. 5. 7. 9. 11. Section 3.5 1. =3 5. Section 3.6 1. 3. y(x)=Ae2x+Be 5. y(x)=(A+Bx)e (3x+2)ex/9 2x 3 2x +x e /6 2x y(x)=e x[A cos(x)+B sin(x)]+x2 x+2 7. 9. y(x)=Aex+Bxex+x ln (x)ex 934 Advanced Engineering Mathematics with MATLAB Section 3.7 1. y(x) C1x+C2x 1 3. y(x)=C1x2+C2/x 5. y(x)=C1/x+C2 ln(x)/x 7. y(x)=C1x cos[2 ln(x)]+C2xsin[ln(x)] 9. y(x)=C1 cos[ln(x)]+C2 sin[ln(x)] 11. y(x)=C1x2+C2x4+C3/x Section 3.8 1. The trajectories spirals outward from (0, 0). 3. The equilibrium points are (x, 0); they are unstable. 5. The equilibrium points are =0 and |x|<2; they are unstable. Section 4.1 1 3. 5. 7. 9. 11. 13. 15. Section 4.3 1. Answers To the Odd-Numbered Problems 935 3. 5. 7. 9. 13. Section 4.4 1. 3. Section 4.5 1. 936 Advanced Engineering Mathematics with MATLAB 3. 5. Section 4.6 1. 3. 5. 7. Section 4.7 1. Section 5.3 1. e | /a|/|a| Section 5.4 1. t/(1 + t2)2 3. 5. 7. f(t)=ie atH(t)/2 ieatH( t)/2 9. f(t)=(1 |t|)e a|t|/(4a) 11. f(t)=( 1)n+1t2n+1e atH(t)/(2n+1)! 13. f(t)=e2tH( t)+e tH(t) 15. Answers To the Odd-Numbered Problems 937 17. Section 5.6 1. y(t)=[(t 1)e t+e 3. Section 6.1 1. F(s)=s/(s2 a2) 3. F(s)=1/s+2/s2+2/s3 5. F(a)=[1 e 2(s 1)] /(s 1) 7. F(s)=2/(s2+1) s/(s2+4)+cos(3)/s 1/s2 9. f(t)=e 3t 11. 13. 17. F(s)=1/(2s) sT2/[2(s2T2+ 2)] Section 6.2 1. f(t)=(t 2)H(t 2) (t 2)H(t 3) 3. y +3y +2y=H(t 1) 5. y +4y +4y=tH(t 2) 7. y 3y +2y=e tH(t 2) 9. y +y=sin(t)[1 H(t )] Section 6.3 1. F(s)=2/(s2+2s+5) 3. F(s)=1/(s 1)2+3/(s22s+10)+(s 2)/(s24s+29) 5. F(s)=2/(s+1)3+2/(s2 2s+5)+(s+3)/(s2+6s+18) 7. F(s)=e6e 3s/(s 2) 9. F(s)=2e s/s3+2e s/s2+3e s/s+e 2s/s 11. F(s)=(1+e s )/(s2+1) 13. F(s)=4(s+3)/(s2+6s+13)2 15. 17. f(t)=s t cos(t)+2e t sin(t) 19. (t)=e 2t 2te 2t+cos(t)e t+sin(t)e t 21. f(t)=et 3H(t 3) 23. f(t)=e (t 1)[cos(t 1) sin(t 1)]H(t 1) 25. 2t ]H(t) 938 Advanced Engineering Mathematics with MATLAB 27. 29. f(t)=t[H(t) H(t a)]; F(s)=1/s2 e as/s2 ae as/s 31. F(s)=1/s2 e s/s2 e 2s/s 33. F(s)=e s/s2 e 2s/s2 e 3s/s 35. Y(s)=s/(s2+4)+3e 4s/[s(s2+4)] 37. Y(s)=e (s 1)/[(s 1)(s+1)(s+2)] 39. Y(s)=5/[(s 1)(s 2)]+e s/[s3(s 1)(s 2)] +2e s[s2(s 1)(s 2)]+e s[s(s 1)(s 2)] 41. Y(s)=1/[s2(s+2)(s+1)]+ae as/[(s+1)2(s+2)] e as/[s2(s+1)(s+2)] e as/[s(s+1)(s+2)] 43. f(0)=1 45. f(0)=0 47. Yes 49. No 51. No Section 6.4 1. 3. Section 6.5 1. f(t)=e t e 3. 5. 7. f(t)=2.3584 cos(4t+0.5586) 9. Section 6.6 11. f(t)=et t 1 Section 6.7 1. f(t)=1+2t 3. f(t)=t+t2/2 5. f(t)=t3+t5/20 7. f(t)=t2 t4/3 9. f(t)=5e2t 4et 2tet 11. f(t)=(1 t)2e t 13. 15. 2t Answers To the Odd-Numbered Problems 17. 19. Section 6.8 1. 3. y(t)=e3t e2t 5. 9. y(t)=(t 1)H(t 1) 11. 13. y(t)=[1 e 2(t 2) 2(t 2)e 15. 17. y(t)=1 cos(t) [1 cos(t T)]H(t T) 19. 21. y(t)=tet+3(t 2)et 2H(t 2) 23. y(t)=3 [e 2(t 2) e 3(t 2)] H(t 2) +4[e 25 27. x(t)=t 1+e t cos(t), y(t)=t2 t+e t sin(t) 29. x(t)=3F1 2F2 F1 cosh(t)+F2et 2F1 cos(t)+F2 cos(t) F2 sin(t) y(t)=F2 2F1+F1e Section 6.9 1. G(s)=1/(s+k) g(t)=e 3. G(s)=1/(s2+4s+3) 5. G(s)=1/[(s 2)(s 1)] g(t)=e2t et 7. G(s)=1/(s2 9) 9. G(s)=1/[s(s 1)] g(t)=et 1 a(t)=et t 1 Section 6.10 1. f(t)=(2 t)e 3. 5. 2t 3t t 2(t 2) 939 7. ]H(t 2) 3(t 5) e 2(t 5) ]H(t 5) F2 cos(t)+F1 cos(t)+F1 sin(t) kt a(t)=(1 e kt)/k 2e 940 Advanced Engineering Mathematics with MATLAB 7. Section 7.1 1. F(z)=2z/(2z 1) if |z|>1/2 3. F(z)=(z6 1)/(z6 z5) if |z|>0 5. F(z)=(a2+a z)/[z(z a)] if |z|>a. Section 7.2 1. F(z)=zTeaT/(zeaT 1)2 3. F(z)=z(z+a)/(z a)3 5. F(z)=[z cos(1)]/{z[z2 2z cos(1)+1]} 7. F(z)=z[z sin( )+sin( 0T )]/[z2 2z cos( 9. F(z)=z/(z+1) 11. fn*gn=n+1 13. fn*gn=2n/n! Section 7.3 1. f0=0.007143, f1=0.08503, f2=0.1626, f3=0.2328 3. f0=0.09836, f1=0.3345, f2=0.6099, f3=0.7935 5. 7. fn=(1 9. 11. 13. fn=an/n! Section 7.4 1. 3. 5. 7. 9. yn=2n n 1 11. xn=2+( 1)n; yn=1+( 1)n 13. xn=1 2( 6)n; yn= 7( 6)n n+1 0 T)+1] )/(1 ) Answers To the Odd-Numbered Problems Section 7.5 1. marginally stable 3. unstable Section 8.1 7. Section 8.2 5. w(t)=u(t)* (t)= e Section 8.3 1. z(t)=ei Section 8.4 3. Section 9.1 1. n=(2n 1)2 2/(4L2), yn(x)=cos[(2n 1) x/(2L)] 3. 5. 7. 9. 11. (a) (b) (c) 13. n n 0 n t 1 941 sin(t) = 1, y0(x)=e x and n =n2, yn(x)=sin(nx) n cos(nx) = n4 4/L4, yn(x)=sin(n x/L) =n2 2, yn(x) sin[n ln(x)] =(2n 1)2 2/4, yn(x)=sin[(2n 1) ln(x)/2] n n 0 =0, y0(x)=1; =n2 2, yn(x)=cos[n ln(x)] =n2+1, yn(x)=sin[n ln(x)]/x n 15. =0, y0(x)=1; yn(x)=cosh( nx)+cos( nx) tanh( n)[sinh( nx)+ sin( nx)], where n=1, 2, 3,..., and Section 9.3 1. is the nth root of tanh( )= tan( ). 3. 942 Advanced Engineering Mathematics with MATLAB Section 9.4 1. 3. 5. Section 10.3 1. 3. 5. 7. 9. where kn is the nth solution of J0(2k)=0. 11. Section 10.4 1. u(x, t)=sin(2x) cos(2ct)+cos(x) sin(ct)/c 3. 5. Section 10.5 1. 3. u(x,t)=sin( x) cos( t) sin( x) sin( t)/ Answers To the Odd-Numbered Problems 5. 943 7. 9. u(x,t)=xt te x+sinh(t)e x+[1 e (t x)+t x sinh(t x)] H(t x) 11. 13. 15. 17. Section 11.3 1. 3. 5. 7. 9. 11. 944 Advanced Engineering Mathematics with MATLAB 13. 15. 17. 19. 21. 23. 25. 27. where 29. n is the nth root of tan( )=hL/k. where kn denotes the nth root of k tan(kL)=k2/a2 31. 33. where kn is the nth root of k cot(k)=1 A, n <kn <(n+1) . 35. where kn is the nth root of J0(k)=0. Answers To the Odd-Numbered Problems 37. where kn is the nth root of J0(k)=0. 39. where kn is the nth root of kJ1(kL)=hJ0(kL). Section 11.4 1. 3. 5. 7. 9. 945 11. 13. 15. 17. 946 Advanced Engineering Mathematics with MATLAB where 19. where 21. where 23. where kn is the nth root of J0(k)=0. 25. where kn is the nth root of J0(k)=0. Section 11.5 1. 3. Section 12.3 1. n n is the nth root of is the nth root of cot( )=(3a+ 2)/3a. 3. 5. 7. u(x, y)=1 9. 11. u(x, y)=1 13. u(x,y)=T0+ T cos(2 x/ )e 2 y/ Answers To the Odd-Numbered Problems 15. where kn is the nth root of J0(k)=0. 17. where kn is the nth root of J1(kb)=0. 19. where kn is the nth root of J1(k)=0. 21. 23. where kn is the nth root of kJ0(k)=J1(k). 25. where kn is the nth root of kJ1(k)=BJ0(k). 29. 31. u(r, )=T0 Section 12.4 1. 3. 947 5. 948 Advanced Engineering Mathematics with MATLAB Section 12.5 1. Section 12.6 1. Section 13.1 1. a b= 3i+19j+10k 3. a b=i 8j+7k 5. a b= 3i 2j 5k 9. 11. 13. Plane parallel to the xy plane at height of z=3, n=k 15. Paraboloid, 17. A plane, 19. A parabola of infinite extent along the y-axis, 21. y=2/(x+1); z=exp[(y 1)/y] 23. y=x; z2=y/(3y 2) Section 13.2 1. 3. 5. 7. 9. Answers To the Odd-Numbered Problems 11. 949 13. Section 13.3 1. 16/7 + 2/(3 ) 3. e2+2e8/3+e64/2 13/6 5. 4 7. 0 9. 2 Section 13.4 1. (x, y, z)=x2y+y2z+4z+constant 3. (x, y, z)=xyz+constant 5. (x, y, z)=x2 sin(y)+xe3z+4z+constant 7. (x, y, z)=xe2z+y3+constant 9. (x, y, z)=xy+xz+constant Section 13.5 1. 1/2 3. 0 5. 27/2 7. 5 9. 0 11. 40/3 13. 86/3 15. 96 Section 13.6 1. 5 3. 1 5. 0 7. 0 9. 16 11. 2 Section 13.7 1. 10 3. 2 5. 7. 45/2 950 Advanced Engineering Mathematics with MATLAB Section 13.8 1. 3. 5. 7. 3 16 4 5/12 Section 14.1 1. 3. 5. 7. 9. 11. 13. yes 15. 17. 19. yes no 21. 23. 25. 27. Answers To the Odd-Numbered Problems 29. 951 Section 14.2 1. 7 3. 1 5. 24 7. 3 Section 14.3 1. 3. x1=0, x2=0, x3= 2 Section 14.4 1. x2=2, x1=1 3. x3= , x2 , x1= 5. x3= , x2=2 , x1= 1 7. x3=2.2, x2=2.6, x1=1 9. 11. Section 14.5 1. 3. 5. 7. 952 Advanced Engineering Mathematics with MATLAB Section 14.6 1. 3. 5. 7. 9. 11. 13. 15. 17. 19. Index abscissa of convergence, 284 absolute value of a complex number, 2ff addition of complex numbers, 2 of matrices, 745 of vectors, 694 age of the earth, 608 aliasing, 219ff amplitude modulation, 246 of a complex number, 4 spectrum, 229 analytic complex function, 11 derivative of, 11 analytic signal, 417ff Archimedes' principle, 740ff argument of a complex number, 4 autonomous ordinary differential eq, 65, 110 auxiliary eq, 112 back substitution, 749, 761 band-pass functions, 415 Bernoulli equation, 92 Bessel eq of order n, 460ff function of the first kind, 462 expansion in, 466ff function of the second kind, 462 function, modified, 464 recurrence formulas, 466 Bessel, Friedrich Wilhelm, 460 Biot number, 563 boundary conditions Cauchy, 482 Dirichlet, 548 Neumann, 548 Robin, 548 boundary-value problem, 108 branches of a complex function, 11 principal, 4 Bromwich contour, 351 Bromwich integral, 351 Bromwich, Thomas J.I'A., 352 954 Index carrier frequency, 246 Cauchy boundary condition, 482 data, 482 integral formula, 28ff principle value, 54ff problem, 482 Cauchy, Augustin-Louis, 13 Cauchy-Goursat theorem, 25 Cauchy-Riemann eqs, 13 centered finite differences, 535 characteristic eq, 112 functions, 425 polynomial, 770 value, 424, 770 vector, 770 characteristics, 504 chemical reaction, 73ff circular frequency, 121 circulation, 710 closed contour integral, 23, 707 surface integral, 714 cofactor, 752 column in a matrix, 744 column vector, 744 complementary error function, 289 complementary solution of an ordinary differential eq, 132 complex conjugate, 1 envelope, 419 Fourier coefficients, 199, 439 Fourier integral, 228ff Fourier series, 198ff number, 1 plane, 4 -valued function, 9ff variable, 1 components of a vector, 693 compound interest, 71, 389ff conformable for addition of matrices, 745 for multiplication of matrices, 745 conservative field, 712 consistency in finite differencing for the heat eq, 629 for the wave eq, 537 Index consistent system of linear eqs, 760 contour integral, 20ff convergence of finite difference solution for heat eq, 630 for wave eq, 538 of a Fourier integral, 230 of Fourier series, 169 convolution theorem for Fourier transform, 269ff for Hilbert transform, 412 for Laplace transform, 317ff for z-transform, 371ff Coriolis force, 695 Cramer's rule, 756 Crank-Nicolson method, 629 critically damped, 127 critical points, 97, 158 stable, 97, 158 stable node, 160 unstable, 97, 159 cross product, 694 curl, 703 curve simply closed, 25 space, 694 cutoff frequency, 524 d'Alembert, Jean Le Rond, 504 d'Alembert's solution, 503ff damped constant, 126 damped harmonic motion, 126ff deformation principle, 26 degenerate eigenvalue problem, 433 del operator, 696 delay differential eq, 338 (Dirac) delta function, 231ff, 294ff de Moivre's theorem, 3 design of film projectors, 313ff design of wind vane, 129 determinant, 751ff diagonal, principal, 744 difference eq, 359 differential eqs, 61 first-order, 61ff linear, 63 linear, first-order, 83 linear nth-order, 107 nonlinear, 63 order, 62 955 956 Index ordinary, 61ff partial, 61 type, 61 differentiation of a Fourier series, 181 diffusivity, 547 direction fields, 95 Dirichlet conditions, 169 Dirichlet, Peter G.Lejeune-, 171 Dirichlet problem, 548 dispersion, 490 divergence theorem, 733ff of a vector, 702 division of complex numbers, 2 dot product, 694 double Fourier series, 682 dual Fourier-Bessel series, 659 dual integral eq, 654 Duhamel's theorem for the heat eq, 614ff for ordinary differential eqs, 349 eigenfunctions, 425ff expansion in, 437 orthogonality of, 434 eigenvalue of a matrix, 770 of a Sturm-Liouville problem, 424ff eigenvalue problem for matrices, 770ff for ordinary differential eqs, 423ff singular, 424 eigenvectors, 770ff orthogonality of, 778 electrical circuit, 87, 143, 333ff electrostatic potential, 644 element of a matrix, 744 elementary row operations, 760 elliptic partial differential eq, 635 entire complex function, 11 equilibrium points, 97, 158 equivalent systems of linear eqs, 760 error function, 289 essential singularity, 36 Euler-Cauchy equation, 152ff Euler's formula, 3 Euler method, 98 exact ordinary differential eq, 79 explicit numerical method for heat eq, 627 Index for wave eq, 535 exponential order, 284 existence of ordinary differential eq first-order, 69 n-order, 108 evaluation of partial sums using z-transforms, 383 fast Fourier transform, 219 filter, 222 final-value theorem for Laplace transforms, 302 for z-transforms, 369 finite differences approximation to derivatives, 535ff finite Fourier series, 212ff first shifting theorem, 297 first-order ordinary differential eq, 61 linear, 83ff flux lines, 698 folding frequency, 220 forced harmonic motion, 137ff Fourier coefficients, 168 cosine series, 175 cosine transform, 612 number, 557 series in amplitude/phase form, 195ff series of an even function, 189 series of an odd function, 189 series for a multivariable function, 202 series on [-L, L], 167ff sine series, 175 sine transform, 612 Fourier, Joseph, 170 Fourier-Bessel coefficients, 467 expansion, 466 Fourier-Legendre coefficients, 451 expansion, 451 Fourier transform, 227ff basic properties of, 241ff convolution for, 269ff inverse of, 228, 254ff method of solving the heat eq, 607 of a constant, 238 of derivatives, 245 957 958 Index of multivariable functions, 233 of sign function, 239 of step function, 240 free undamped motion, 121 frequency convolution, 271 frequency modulation, 247 frequency response, 275 frequency spectrum, 230 for a damped harmonic oscillator, 275ff for low frequency filter, 279 function even extension of, 189 generalized, 296 multivalued complex, 10 odd extension of, 189 single-valued complex, 10 vector-valued, 696ff fundamental of a Fourier series, 168 Gauss, Carl Friedrich, 734 Gauss's divergence theorem, 733ff Gaussian elimination, 763 Gauss-Seidel method, 687 general solution to ordinary differential eq, 64 generalized functions, 296 generating function for Legendre polynomials, 448 Gibbs phenomenon, 185ff gradient, 697 graphical stability analysis, 97 Green's function, 275ff, 345ff for a damped harmonic oscillator, 277 for the Klein-Gordon eq, 524 for low frequency filter, 278 Green's lemma, 722ff grid point, 534 groundwater flow, 639ff half-range expansions, 189ff Hankel transform, 653 harmonic function, 18, 636 conjugate, 18 harmonic of a Fourier series, 168 heat conduction in a rotating satellite, 207ff within a metallic sphere, 663ff heat dissipation in disc brakes, 595ff Index heat eq, 545ff for an infinite cylinder, 569ff for a semi-infinite bar, 607ff nonhomogeneous, 547 one-dimensional, 549ff within a solid sphere, 567ff Heaviside expansion theorem, 309ff step function, 291ff Heaviside, Oliver, 292 Hilbert, David, 401 Hilbert pair, 401 Hilbert transform, 399ff and convolution, 412 and derivatives, 412 and shifting, 411 and time scaling, 412 discrete, 408 linearity of, 410 product theorem, 414 holomorphic complex function, 11 homogeneous ordinary differential eq, 78, 107 solution to ordinary differential eq, 132 system of linear eqs, 748 hydraulic potential, 639 hydrostatic eq, 69 hyperbolic partial differential eq, 479 ideal Hilbert transformer, 399 ideal sampler, 361 imaginary part of a complex number, 1 impulse function, see (Dirac) delta function impulse response, 345 inconsistent system of linear eqs, 759 indicial admittance for heat eq, 617 for ordinary differential eqs, 345 inertia supercharging, 191 initial conditions, 482ff -value problem, 107, 326ff initial-boundary-value problem, 548 initial-value theorem for Laplace transforms, 301 for z-transforms, 369 inner product, 745 959 960 Index integral curve, 157 integral eq of convolution type, 321 integrals complex contour, 19 Fourier type, evaluation of, 260 line, 707ff real, evaluation of, 45 integration of a Fourier series, 182ff interest rate, 71, 389 integrating factor, 82 inverse discrete Fourier transform, 213 Fourier transform, 228, 254ff Hilbert transform, 400 Laplace transform, 309ff, 317, 350ff z-transform, 375ff inversion formula for the Fourier transform, 228 for the Laplace transform, 350ff for the z-transform, 380ff inversion of Fourier transform, 254ff by contour integration, 256 by direct integration, 254 by partial fractions, 255 inversion of Laplace transform by contour integration, 350ff by convolution, 317 by partial fractions, 309ff in amplitude/phase form, 312ff inversion of z-transform by contour integration, 380ff by partial fractions, 378ff by power series, 375ff by recursion, 376ff irrotational, 704 isoclines, 95 isolated singularities, 15 iterative methods Gauss-Seidel, 687 successive over-relaxation, 691 iterative solution of the radiative transfer eq, 455ff joint transform method, 524 Jordan curve, 25 Jordan's lemma, 256 Kirchhoff's law, 87 Klein-Gordon eq, 490 Green's function for, 524 Index Kramers-Kronig relationship, 420ff Lagrange's trignometric identity, 5 Laplace integral, 283 Laplace, Pierre Simon, 637 Laplace transform(s), 283ff basic properties of, 297ff convolution for, 317ff definition of, 283 derivative of, 300 in solving delay differential eq, 338 heat eq, 591ff integral eqs, 321ff Laplace eq, 684ff ordinary differential eqs, 326ff wave eq, 512ff integration of, 300 inverse of, 309ff, 350ff of derivatives, 290 of periodic functions, 306ff of the delta function, 295 of the step function, 291 Schouten-van der Pol theorem for, 357 Laplace's eq, 635ff in cylindrical coordinates, 638 in spherical coordinates, 638 numerical solution of, 686ff solution on the half-plane, 678ff solution by Laplace transforms, 684ff solution by separation of variables, 639ff Laplace's expansion in cofactors, 752 Laplacian, 703 Laurent expansion, 35 Lax-Wendroff scheme, 543 Legendre, Adrien-Marie, 444 Legendre polynomial, 446 expansion in, 451 generating function for, 448 orthogonality, 451 recurrence formulas, 449 Legendre's differential eq, 444 length of a vector, 693 linear dependence of functions, 116 of eigenvectors, 770 linearity 961 962 Index of Fourier transform, 241 of Hilbert transform, 410 of Laplace transform, 285 of z-transform, 367 line integral, 19ff, 707ff line spectrum, 200 lines of force, 698 Liouville, Joseph, 426 logistic eq, 73 low frequency filter, 279 magnitude of a vector, 693 mapping of complex functions, 10 matrix, 744 algebra, 743 amplification, 775 augmented, 760 banded, 749 coefficient, 760 complex, 744 identity, 744 inverse, 747 invertible, 747 method for stability of a numerical scheme, 775ff nonsingular, 747 real, 744 rectangular, 744 singular, 747 square, 744 symmetric, 744 tridiagonal, 749 unit, 744 upper triangular, 749 zero, 744 matrices addition of, 745 equal, 745 multiplication of, 745 maximum principle, 637 Maxwell's eqs, 706 mechanical filter, 316 meromorphic function, 15 method of partial fractions for Fourier transform, 255 for Laplace transform, 309ff for z-transform, 378ff method of undetermined coefficients, 131ff minor, 752 Index mixed boundary-value problems, 654ff modified Bessel function, first kind, 464 Bessel function, second kind, 464 Euler method, 98 modulation, 246ff modulus of a complex number, 2ff multiplication of complex numbers, 2 of matrices, 745 multivalued complex function, 10 nabla, 696 Neumann problem, 548 Neumann's Bessel function of order n, 462 Newton's law of cooling, 562 nondivergent, 703 nonhomogeneous heat eq, 547 ordinary differential eq, 107 system of linear eqs, 748 norm of a vector, 694, 745 normal differential eq, 107 normal modes, 489 normal to a surface, 697 not simply connected, 26 numerical solution of heat eq, 627ff of Laplace's eq, 686ff of wave eq, 534ff Nyquist frequency, 220 Nyquist sampling criteria, 219 one-sided finite differences, 534 order of a matrix, 744 of pole, 36 orthogonality of eigenfunctions, 434ff of eigenvectors, 778ff orthonormal eigenfunctions, 437 overdamped, 127 overdetermined system of linear eqs, 765 parabolic partial differential eq, 545 Parseval's identity for Fourier series, 184 963 964 Index for Fourier transform, 249ff for z-transform, 383 partial fraction expansion for Fourier transform, 255 for Laplace transform, 309ff for z-transform, 378ff particular solution to ordinary differential eq, 64, 131 path in complex integrals, 20 in line integrals, 707 path independence in complex integrals, 26 in line integrals, 713 phase, 4 angle in Fourier series, 195ff diagram, 156 line, 97 path, 157 spectrum, 229 phasor amplitude, 419 pivot, 761 pivotal row, 761 Poisson, Simon-Denis, 681 Poisson's eq, 680 integral formula for a circular disk, 670 for upper half-plane, 678 summation formula, 252, 254 polar form of a complex number, 3 pole of order n, 36 position vector, 694 positively oriented curve, 28 potential function, 712ff power content, 184 power spectrum, 251 principal branch, 4 principal diagonal, 744 principle of linear superposition, 113, 486 quadrature phase shifting, 399 quieting snow tires, 176ff radiation condition, 483 radius of convergence, 33 rank of a matrix, 763 real part of a complex number, 1 real definite integrals, Index evaluation of, 45 recurrence relation in finite differencing, 162 for Bessel functions, 466 for Legendre polynomial, 449ff reduction in order, 109 regular complex function, 11 regular Sturm-Liouville problem, 424 relaxation methods, 687ff removable singularity, 36 residue, 35 residue theorem, 39ff resonance, 142, 205, 329 rest points, 97 Riemann, G.F.B., 14 Robin problem, 548 Rodrigues' formula, 448 root locus method, 277 roots of a complex number, 6ff row echelon form, 763 row of a matrix, 744 row vector, 744 Runge, Carl, 102 Runge-Kutta method, 101, 163 scalar, 693 Schouten-van der Pol theorem for Laplace transforms, 357 Schwarz's integral formula, 679 second shifting theorem, 298 separation of variables for heat eq, 548ff for Laplace's eq, 639ff for ordinary differential eq, 65 for Poisson's eq, 680ff for wave eq, 483ff shifting in the s variable, 297 in the t variable, 242, 298 in the variable, 246 sifting property, 233 simple closed curve, 25 eigenvalue, 426 pole, 36 simple harmonic oscillator, 120ff, 329 simply close curve, 25 sinc function, 229 single sideband signal, 419 single-valued complex function, 10 965 966 Index singular solutions to ordinary differential eq, 67 Sturm-Liouville problem, 424 singularity essential, 36 isolated, 36 pole of order n, 36 removable, 36 slope field, 95 solenoidal, 703 solution curve, 95 solution of ordinary differential eq by Fourier series, 203ff by Fourier transform, 273ff space curve, 694 spectral radius, 770 spectrum of a matrix, 770 stability of numerical methods by Fourier method for heat eq, 629 for wave eq, 538 by matrix method for wave eq, 775 steady-state heat eq, 71, 556 steady-state output, 98 steady-state solution to ordinary differential eq, 139 steady-state transfer function, 275 step function, 291ff step response, 345 Stokes, Sir George Gabriel, 727 Stokes' theorem, 726ff streamlines, 698 Sturm, Charles, 424 Sturm-Liouville eq, 423 problem, 423ff subtraction of complex numbers, 2 of matrices, 745 of vectors, 694 successive over-relaxation, 691 superposition integral for heat eq, 616ff for ordinary differential eqs, 349 superposition principle, 486 surface conductance, 562 surface integral, 714ff system of linear differential eqs, 779ff homogeneous eqs, 748 Index nonhomogeneous eqs, 748 tangent vector, 694 Taylor expansion, 33 terminal velocity, 71, 90 telegraph eq, 493, 513ff thermal conductivity, 546 threadline eq, 509ff time shifting, 242, 297 trajectories, 157 transfer function, 344 transform Fourier, 227ff Hilbert, 399ff Laplace, 283ff z-transform, 359ff transient solution to ordinary differential eq, 139 transmission line, 513ff transpose of a matrix, 747 tridiagonal matrix, solution of, 748ff underdamped, 127 underdetermined system of linear eqs, 767 uniqueness of ordinary differential eq first-order, 69 nth-order, 108 unit normal, 698 step function, 291ff vector, 693 Vandermonde's determinant, 756 variation of parameters, 145ff vector, 693, 744 vector element of area, 717 vibrating string, 489 vibrating threadline, 509 vibration of floating body, 124 Volterra eq of the second kind, 321 volume integral, 733ff wave eq, 479ff damped, 492ff for a circular membrane, 496ff for an infinite domain, 503ff one-dimensional, 481 weight function, 434 Wronskian, 118 967 968 Index zero vector, 693 z-transform, 359ff basic properties of, 367 convolution for, 371 final-value theorem for, 369 initial-value theorem for, 369 inverse of, 375ff of periodic sequences, 370 of a sequence multiplied by an exponential sequence, 367 of a shifted sequence, 367 solving of difference eqs, 386ff ...
View Full Document