Physics 116C Solution of inhomogeneous ordinary differential equations using Green s functions


 Ashlyn Bennett
 9 months ago
 Views:
Transcription
1 Physics 6C Solution of inhomogeneous ordinry differentil equtions using Green s functions Peter Young November 5, 29 Homogeneous Equtions We hve studied, especilly in long HW problem, second order liner homogeneous differentil equtions which cn be written s n eigenvlue problem of the form Ly n (x) = λ n y n (x), () where L is n opertor involving derivtives, λ n is n eigenvlue nd y n (x) is n eigenfunction (which stisfies some specified boundry conditions). The generl cse tht we re interested in is clled SturmLiouville problem, for which one cn show tht the eigenvlues re rel, nd the eigenfunctions re orthogonl, i.e. y n (x)y m (x) = δ n m, (2) where nd b re the upper nd lower its of the region where we re solving the problem, nd we hve lso normlized the solutions. A simple exmple, which we will study in detil, will be 2 y + 4y = λy, (3) in the intervl x π, with the boundry conditions y() = y(π) =. This corresponds to L = d (4) This is just the simple hrmonic oscilltor eqution, nd so the solutions re cos kx nd sinkx. The boundry condition y() = eintes cos kx nd the condition y(π) = gives k = n positive integer. (Note: For n = the solution vnishes nd tking n < just gives the sme solution s tht for the corresponding positive vlue of n becuse sin( nx) = sin(nx). Hence we only need consider positive integer n.) The normlized eigenfunctions re therefore 2 y n (x) = sinnx, (n =, 2, 3, ), (5) π nd the eigenvlues in Eq. (3) re since the eqution stisfied by y n (x) is y n + n 2 y n =. λ n = 4 n2, (6) The generl SturmLiouville problem hs weight function w(x) multiplying the eigenvlue on the RHS of Eq. () nd the sme weight function multiplies the integrnd shown in the LHS of the orthogonlity nd normliztion condition, Eq. (2). Furthermore the eigenfunctions my be complex, in which cse one must tke the complex conjugte of either y n or y m in in Eq. (2). Here, to keep the nottion simple, we will just consider exmples with w(x) = nd rel eigenfunctions. 2 Different books dopt different sign conventions for the definition of L, nd hence of the Green s functions.
2 2 Inhomogeneous Equtions Green s functions, the topic of this hndout, pper when we consider the inhomogeneous eqution nlogous to Eq. () Ly(x) = f(x), (7) where f(x) is some specified function of x. The ide of the method is to determine the Green s function, G(x, x ), which is given by the solution of the eqution LG(x, x ) = δ(x x ), (8) for the specified boundry conditions. In Eq. (8), the differentil opertors in L ct on x, nd x is constnt. Once G hs been determined, the solution of Eq. (7) cn be obtined for ny function f(x) from y(x) = G(x, x )f(x ), (9) which follows since Ly(x) = L G(x, x )f(x ) = δ(x x )f(x ) = f(x), () so y(x) stisfies Eq, (7) s required. Note tht we used Eq. (8) to obtin the second equlity in Eq. (). We emphsize tht the sme Green s function pplies for ny f(x), nd so it only hs to be clculted once for given differentil opertor L nd boundry conditions. 3 Expression for the Green s functions in terms of eigenfunctions In this section we will obtin n expression for the Green s function in terms of the eigenfunctions y n (x) of the homogeneous eqution, Eq. (). We ssume tht the solution y(x) of the inhomogeneous eqution, Eq. (7), cn be written s liner combintion of the eigenfunctions y n (x), obtined with the sme boundry conditions, i.e. y(x) = n c n y n (x), () for some choice of the constnts c n. Substituting into Eq. (7) gives f(x) = Ly(x) = n c n Ly n (x) = n c n λ n y n (x). (2) To determine the c n we multiply by one of the eigenfunctions, y m (x) sy, nd integrte use the orthogonlity of the eigenfunctions, Eq. (2). This gives f(x)y m (x) = n c n λ n y n (x)y m (x) = c m λ m. (3) Substituting for c n into Eq. () gives y(x) = n λ n y n (x )f(x ) y n (x), (4) 2
3 which cn be written in the form of Eq. (9) with G(x, x ) = n λ n y n (x)y n (x ). (5) Note tht G(x, x ) is symmetric function of x nd x which is quite generl result. Furthermore, it only depends on the eigenfunctions of the corresponding homogeneous eqution, i.e. on the boundry conditions nd L. It is independent of f(x) nd so cn be computed once nd for ll, nd then pplied to ny f(x) just by doing the integrl in Eq. (9). 4 A simple exmple As n exmple, let us determine the solution of the inhomogeneous eqution corresponding to the homogeneous eqution in Eq. (3), i.e. y + 4y = f(x), with y() = y(π) =. (6) First we will evlute the solution by elementry mens for two choices of f(x) (i) f(x) = sin2x, (ii) f(x) = x/2. (7) We will then obtin the solutions for these cses from the Green s function determined ccording to Eq. (5). In the elementry pproch, one writes the solution of Eq. (6) s combintion of complementry function y c (x) (the solution with f(x) = ) nd the prticulr integrl y p (x) ( prticulr solution with f(x) included). Since, for f(x) =, the eqution is the simple hrmonic oscilltor eqution, y c (x) is given by y c (x) = A cos(x/2) + B sin(x/2). (8) For the prticulr integrl, we ssume tht y p (x) is of similr form to f(x). We now determine the solution for the two choices of f(x) in Eq. (6). (i) For f(x) = sin2x we try y p (x) = C cos 2x + D sin 2x nd substituting gives ( 4 + /4)D =, nd C =. This gives y(x) = y c (x) + y p (x) = 4 sin 2x + A cos(x/2) + B sin(x/2). (9) 5 The boundry conditions re y() = y(π) =, which gives A = B =. Hence y(x) = 4 sin2x, for f(x) = sin2x. (2) 5 (ii) Similrly for f(x) = x we try y p (x) = C + Dx nd substituting into Eq. (6) gives C =, D = 2, nd so y(x) = y c (x) + y p (x) = 2x + A cos(x/2) + B sin(x/2). (2) The boundry conditions, y() = y(π) =, give A =, B = 2π. Hence This is plotted in the figure below y(x) = 2x 2π sin(x/2), for f(x) = x/2. (22) 3
4 Now lets work out the Green s function, which is given by Eq. (5). The eigenfunction re given by (5) nd the eigenvlues re given by Eq. (6) so we hve G(x, x ) = 2 π sinnx sin nx n=. (23) 4 n2 We cn now substitute this into Eq. (9) to solve Eq. (6) for the two choices of f(x) in Eq. (7). (i) First of ll for f(x) = sin 2x Eq. (9) becomes y(x) = 2 ( π ) sinnx sinnx sin2x = 2 π π n= 4 n2 n= sinnx 4 n2 sinnx sin2x. (24) Becuse of the orthogonlity of the sinnx in the intervl from to π only the n = 2 term contributes, nd the integrl for this cse is π/2. Hence the solution is in greement with Eq. (2). y(x) = sin2x 4 22 = 4 5 sin 2x. (25) (ii) Now we consider the cse of f(x) = x/2. Substituting Eq, (23) into Eq. (9) gives y(x) = π n= sinnx 4 n2 x sinnx. (26) There is no longer ny orthogonlity to simplify things nd we just hve to do the integrl: x sinnx = [ x cos nx ] π cos nx + (27) n n [ ] π cos nπ sinnx π = + n n 2 (28) = ( ) nπ n. (29) 4
5 For the prticulr cse of n = the integrl is zero. Hence the solution is y(x) = ( ) n+ sinnx n( 4 n2 ). (3) n= This my not look the sme s Eq. (22), but it is in fct, s one cn check by expnding 2x 2π sinx/2 s Fourier sine series in the intervl to π, i.e. one writes 2x 2π sinx/2 = c n sinnx, (3) n= nd determines the c n from the usul Fourier integrl. Using the Green s function my seem to be complicted wy to proceed, especilly for our second choice of f(x). However, you should relize tht the elementry derivtion of the solution my not be so simple in other cses, nd you should note tht the Green s function pplies to ll possible choices of the function on the RHS, f(x). Furthermore, we will see in the next section tht one cn often get closed form expression for G, rther thn n infinite series. It is then much esier to find closed form expression for the solution. 5 Closed form expression for the Green s function In mny useful cses, one cn obtin closed form expression for the Green s function by strting with the defining eqution, Eq. (8). We will illustrte this for the exmple in the previous section for which Eq. (8) is G + 4 G = δ(x x ). (32) Remember tht x is fixed (nd lies between nd π) while x is vrible, nd the derivtives re with respect to x. We solve this eqution seprtely in the two regions (i) x < x, nd (ii) x < x π. In ech region seprtely the eqution is G + (/4)G =, for which the solutions re G(x, x ) = A cos(x/2) + B sin(x/2), (33) where A nd B will depend on x. Since y() =, we require G(, x ) = (recll Eq. (9)) nd so, for the solution in the region x < x, the cosine is einted. Similrly G(π, x ) = nd so, for the region x < x π, the sine is einted. Hence the solution is G(x, x ) = { B sin(x/2) ( x < x ), A cos(x/2) (x < x π). (34) How do we determine the two coefficients A nd B? We get one reltion between them by requiring tht the solution is continuous t x = x, i.e. the it s x x from below is equl to the it s x x from bove. This gives B sin(x /2) = A cos(x /2). (35) The second reltion between A nd B is obtined by integrting Eq. (32) from x = x ǫ to x + ǫ, nd tking the it ǫ, which gives so ǫ [ ] dg x +ǫ + 4 ǫ ǫ ( dg x +ǫ x +ǫ G(x, x ) = dg ǫ x +ǫ δ(x x ) (36) ) + =. (37) 5
6 Hence dg/ hs discontinuity of t x = x, i.e. A 2 sin(x /2) B 2 cos(x /2) =. (38) Solving Eqs. (35) nd (38) gives Substituting into Eq. (34) gives B = 2 cos(x /2), (39) A = 2 sin(x /2). (4) G(x, x ) = { 2 cos(x /2)sin(x/2) ( x < x ), 2 sin(x /2)cos(x/2) (x < x π). (4) A sketch of the solution is shown in the figure below. The discontinuity in slope t x = x (I took x = 3π/4) is clerly seen. It is instructive to rewrite Eq. (4) in terms of x <, the smller of x nd x, nd x >, the lrger of x nd x. One hs G(x, x ) = 2 sin(x < /2)cos(x > /2), (42) irrespective of which is lrger, which shows tht G is symmetric under interchnge of x nd x s noted erlier. We now pply the closed form expression for G in Eq. (4) to solve our simple exmple, Eq. (6), with the two choices for f(x) shown in Eq. (7). (i) For f(x) = sin2x, Eqs. (9) nd (4) give y(x) = 2 cos(x/2) x sin2x sin(x /2) 2 sin(x/2) Using formule for sines nd cosines of sums of ngles nd integrting gives ( sin(3x/2) y(x) = 2 cos(x/2) sin(5x/2) ) ( cos(3x/2) 2 sin(x/2) ( ) ( ) = 2 3 sin2x sin2x x sin2x cos(x /2). (43) + cos(5x/2) ) (44) 5 (45) = 4 sin 2x, 5 (46) 6
7 where we gin used formule for sums nd differences of ngles. This result is in greement with Eq. (2). (ii) For f(x) = x/2, Eqs. (9) nd (4) give y(x) = cos(x/2) Integrting by prts gives x x sin(x /2) sin(x/2) x x cos(x /2) (47) y(x) = cos(x/2)( 2xcos(x/2) + 4 sin(x/2)) sin(x/2)(2π 4 cos(x/2) 2xsin(x/2)) (48), = 2x 2π sin(x/2), (49) which grees with Eq. (22). Note tht we obtined the closed form result explicitly, s opposed to the method in Sec. 3 where the solution ws obtined s n infinite series, Eq. (3). In generl, to find closed form expression for G(x, x ) we note from Eq. (8) tht, for x x, it stisfies the homogeneous eqution LG(x, x ) =, (x x ). (5) We solve this eqution seprtely for x < x nd x > x, subject to the required boundry conditions, nd mtch the solutions t x = x with the following two conditions (i) G(x, x ) is continuous t x = x, i.e. G(x, x x +ǫ x ) = G(x, x x ). (5) (ii) The derivtive dg/ hs discontinuity of t x = x, i.e. dg(x, x ) x x +ǫ x dg(x, x ) =. (52) 6 Summry We hve shown how to solve liner, inhomogeneous, ordinry differentil equtions by using Green s functions. These cn be represented in terms of eigenfunctions, see Sec. 3, nd in mny cses cn lterntively be evluted in closed form, see Secs. 4 nd 5. The dvntge of the Green s function pproch is tht the Green s function only needs to be computed once for given differentil opertor L nd boundry conditions, nd this result cn then be used to solve for ny function f(x) on the RHS of Eq. (7) by using Eq. (9). In this hndout we hve used Green s function techniques for ordinry differentil equtions. They cn lso be used, in very simple mnner, for prtil differentil equtions. The dvntges of Green s functions my not be redily pprent from the simple exmples presented here. However, they re used in mny dvnced pplictions in physics. 7