Chaper 3 Boundary Value Problem A boundary value problem (BVP) is a problem, ypically an ODE or a PDE, which has values assigned on he physical boundary of he domain in which he problem is specified. Le us consider a genearal ODE of he form x (n) = f(, x, x, x,,x (n 1) ), [a, b] (3.1) A = a and = b he soluion is supposed o saisfy r 1 (x(a)x (a),,x (n 1) (a), x(b)x (b),,x (n 1) (b)) = 0, (3.2). r n (x(a)x (a),,x (n 1) (a), x(b)x (b),,x (n 1) (b)) = 0. The resuling problem (3.1) (3.2) is called a wo poin boundary value problem [8]. In order o be useful in applicaions, a BVP (3.1) (3.2) should be well posed. This means ha given he inpu o he problem here exiss a unique soluion, which depends coninuously on he inpu. However, quesions of exisence and uniqueness for BVPs are much more difficul han for IVPs and here is no general heory. 3.1 Single shooing mehods 3.1.1 Linear shooing mehod Consider a linear wo-poin second-order BVP of he form x () = p()x ()+q()x()+r(), [a, b] (3.3) wih x(a) = α, x(b) = β. 37
The main idea of he mehod is o reduce he soluion of he BVP (3.3) o he soluion of an iniial value problem [10, 6]. Namely, le us consider wo special IVPs for wo funcions u() and v(). Suppose ha u() is a soluion of he IVP u () = p()u ()+q()u()+r(), u(a) = α, u (a) = 0 and v() is he unique soluion o he IVP v () = p()v ()+q()v(), v(a) = 0, v (a) = 1. Then he linear combinaion x() = u()+cv(), c = cons. (3.4) is a soluion o BVP (3.3). The unknown consan c can be found from he boundary condiion on he righ end of he ime inerval, i.e., x(b) = u(b)+cv(b) = β c = β u(b). v(b) Tha is, if v(b) 0 he unique soluion of (3.3) reads x() = u()+ β u(b) v(). v(b) Example 1 Le us solve a BVP [6] x () = 2 1+ 2 x () 2 x()+1, (3.5) 1+ 2 x(0) = 1.25, x(1) = 0.95. over he ime inerval [0, 4] using he linear shooing mehod (3.4). According o Eq. (3.4) he soluion of his equaion has he form x() = u() 0.95+u(4) v(), v(4) where u() and v() are soluions of wo IVPs and u () = v () = 2 1+ 2 u ()+ 2 1+ 2 u()+1, u(0) = 1.25, u (0) = 0 2 1+ 2 v ()+ 2 1+ 2 v(), v(0) = 0, v (0) = 1.
4 3 u() v() x() 2 1 u,v,x 0 1 Fig. 3.1 Numerical soluion of Eq. (3.5) over he inerval [0, 4] by he linear shooing mehod (3.4). 2 3 0 0.5 1 1.5 2 2.5 3 3.5 4 Numerical soluion of he problem 3.5 as well as boh duncions u() and v() are presened on Fig. 3.1 3.1.2 Single shooing for general BVP For a general BVP for a second-order ODE, he simple shooing mehod is saed as follows: Le x () = f(, x(), x ()), [a, b] (3.6) x(a) = α, x(b) = β. be he BVP in quesion and le x(, s) denoe he soluion of he IVP x () = f(, x(), x ()), [a, b] (3.7) x(a) = α, x (a) = s, where s is a parameer ha can be varied. The IVP (3.7) is solved wih differen values of s wih, e.g., RK4 mehod ill he boundary condiion on he righ side x(b) = β becomes fulfilled. As menioned above, he soluion x(, s) of (3.7) depends on he parameer s. Le us define a funcion F(s) := x(b, s) β. If he BVP (3.6) has a soluion, hen he funcion F(s) has a roo, which is jus he value of he slope x (a) giving he soluion x() of he BVP in quesion. The zeros of F(s) can be found wih, e.g., Newon s mehod [7]. The Newon s mehod is probably he bes known mehod for finding numerical approximaions o he zeroes of a real-valued funcion. The idea of he mehod is
o use he firs few erms of he Taylor series of a funcion F(s) in he viciniy of a suspeced roo, i.e., F(s n + h) = F(s n )+F (s n )h+o(h 2 ). where s n is a n h approximaion of he roo. Now if one insers h = s s n, one obains F(s) = F(s n )+F (s n )(s s n ). As he nex approximaion s n+1 o he roo we choose he zero of his funcion, i.e., F(s n+1 ) = F(s n )+F (s n )(s n+1 s n ) = 0 s n+1 = s n F(s n) F (s n ). (3.8) The derivaive F (s n ) can be calculaed using he forward difference formula F (s n ) = F(s n + δ s) F(s n ) δ s where δ s is small. Noice ha his procedure can be unsable near a horizonal asympoe or a local exremum. Example 1 Consider a simple nonlinear BVP [10] x () = 3 2 x()2, (3.9) x(0) = 4, x(1) = 1 over he inerval [0, 1] and le us solve i numerically wih he single shooing mehod discussed above. Firs of all we define a corresponding IVP x () = 3 2 x()2 x(0) = 4, x (0) = s over [0, 1] and solve i for differen values of s, e.g., s [ 100, 0] wih he classical RK4 mehod. The resul of calculaion is presened on Fig. 3.2 (a). One can see, ha he funcion F(s) = x(, s) 1 admis wo zeros, depiced on Fig. 3.2 (a) as green poins. In order o find hem we use he Newon s mehod, discussed above. The mehod gives an approximaion o boh zeros of he funcion F(s): s = { 35.8, 8.0}, which give he righ slope x (0). Boh soluions, corresponding o wo differen values of s are presened on Fig. 3.2 (b).
(a) (b) 70 4 60 2 50 0 40 2 F(,s) 1 30 20 x 4 6 10 8 0 10 10 100 80 60 40 20 0 12 0 0.2 0.4 0.6 0.8 1 Fig. 3.2 Numerical soluion of BVP (3.9) wih single shooing mehod. (a) The Funcion F(s) = x(, s) 1 is presened. Green poins depic wo zeros of his funcion, which can be found wih Newon s mehod. (b) Two soluions of (3.9) corresponding o wo differen values of parameer s (he red line corresponds o s = 35.8, whereas he blue one o s = 8.0). Example 2 Le us consider a linear eigenvalue problem of he form x + λ x = 0, x(0) = x(1) = 0, x (0) = 1 (3.10) over [0, 1] wih he simple shooing mehod. The exac soluion is λ = n 2 π 2, n N. In order o apply he simple shooing mehod we consider a corresponding IVP of he firs order wih addiional equaion for he unknown funcion λ(): wih x = y, y = λ x, λ = 0 x(0) = 0, x (0) = 1, λ(0) = s. where s is a free shooing parameer. Here we choose s = {0.5, 50, 100}. Resuls of he shooing wih hese iniial parameers are shown on Fig. 3.3. One can see, ha numerical soluions correspond o firs hree eigenvalues λ = {π 2,(2π) 2,(3π) 2 }. Example 3 Consider a nonlinear BVP of he fourh order [8]
0.5 0.4 λ=0.5 λ=50 λ=100 0.3 0.2 x Fig. 3.3 Numerical soluions of Eq. (3.10) over he inerval [0, 1] by single shooing mehod. Firs hree eigenfuncions, corresponding o eigenvalues λ = {π 2,(2π) 2,(3π) 2 } are presened. 0.1 0 0.1 0.2 0 0.2 0.4 0.6 0.8 1 wih x (4) () (1+ 2 )x () 2 + 5x() 2 = 0, [0, 1] (3.11) x(0) = 1, x (0) = 0, x (1) = 2, x (1) = 3. Our goal is o solve his equaion wih he simple shooing mehod. To his end, firs we rewrie he equaion as a sysem of four ODE s of he firs order: x 1 = x 2, x 2 = x 3, x 1 (0) = 1, x 3 (1) = 2, x 3 = x 4, x 2 (0) = 0, x 4 (1) = 3, x 4 = (1+ 2 )x 2 3 5x2 1. As he second sep we consider correspondig IVP x 1 = x 2, x 2 = x 3, x 1 (0) = 1, x 3 (1) = p, x 3 = x 4, x 2 (0) = 0, x 4 (1) = q, x 4 = (1+ 2 )x 2 3 5x2 1 wih wo free shooing parameers p and q. The soluion of his IVP fulfilles following wo requiremens: F 1 (p, q) : = x 3 (1, p, q)+2 = 0, F 2 (p, q) : = x 4 (1, p, q)+3 = 0. Tha is, a sysem of nonlinear algebraic equaions should be solved o find (p, q). The zeros of he sysem can be found wih he Newon s mehod (3.8). In his case he ieraion sep reads
1.02 1 0.98 0.96 0.94 x 0.92 Fig. 3.4 Numerical soluions of (3.11) over he inerval [0, 1] by single shooing mehod. Parameers are: p = q = 0.05, he ime sep h = 0.025, iniial shooing parameers (p 0,q 0 ) = (0, 0). 0.9 0.88 0.86 0.84 0.82 0 0.2 0.4 0.6 0.8 1 where s = (p, q) T, F = (F 1, F 2 ) T and is a Jacobian of he sysem and s i+1 = s i F(s i) DF(s i ) DF(s i ) = ( F1 F 1 p q F 2 F 2 p q ) F i p = F i(p+ p, q) F i (p, q), p F i q = F i(p, q+ q) F i (p, q), q where i = 1, 2 and p, q are given values. Numerical soluion of he problem in quesion is presened on Fig. 3.4. 3.2 Finie difference Mehod One way o solve a given BVP over he ime inerval [a, b] numerically is o approximae he problem in quesion by finie differences [8, 10, 6]. We form a pariion of he domain [a, b] using mesh poins a = 0, 1,..., N = b, where i = a+ih, h = b a, i = 0, 1,... N. N Difference quoien approximaions for derivaives can be used o solve BVP in quesion [10, 6]. In paricular, using a Taylor expansion in he viciniy of he poin
j, for he firs derivaive one obains a forward difference x ( i ) = x( i+1) x( i ) h In a similar way one ges a backward difference x ( i ) = x( i) x( i 1 ) h +O(h). (3.12) +O(h). (3.13) We can combine hese wo approaches and derive a cenral difference, which yields a more accurae approximaion: x ( i ) = x( i+1) x( i 1 ) +O(h 2 ). (3.14) 2h The second derivaive x ( i ) can be found in he same way using he linear combinaion of differen Taylor expansions. For example, a cenral difference reads x ( i ) = x( i+1) 2x( i )+x( i 1 ) h 2 +O(h 2 ). (3.15) 3.2.1 Finie Difference for linear BVP Le us consider a linear BVP of he second order (3.3) x = p()x ()+q()x()+r(), [a, b], x(a) = α, x(b) = β. and inroduce he noaion x( i ) = x i, p( i ) = p i, q( i ) = q i and r( i ) = r i. Then, using Eq. (3.14) and Eq. (3.15) one can rewrie Eq. (3.3) as a difference equaion x 0 = α, x i+1 2x i + x i 1 x i+1 x i 1 h 2 = p i 2h x N = β. + q i x i + r i, i = 1,..., N 1, Now we can muliply boh sides of he second equaion wih h 2 and collec erms, involving x i 1, x i and x i+1. As resul we ge a sysem of linear equaions ( 1+ h ) ( 2 p i x i 1 (2+h 2 q i )x i + 1 h ) 2 p i x i+1 = h 2 r i, i = 1, 2,... N 1. or, in marix noaion or, more precisely Ax = b, (3.16)
(2+h 2 q 1 ) 1 h 2 p 1 0...... 0 1+ h 2 p 2 (2+h 2 q 2 ) 1 h 2 p 2 0... 0 0 1+ h 2 p 3 (2+h 2 q 3 ) 1 h 2 p 3... 0........................................................... 1 h 2 p N 2 0...... 0 1+ 2 h p N 1 (2+h 2 q N 1 ) where ( ) ( h γ 1 = α 2 p 1 + 1, γ N = β 1 h ) 2 p N 1. Our goal is o find unknown vecor x. To his end we should inver he marix A. This marix has a band srucure and is ridiagonal. For marices of his kind a ridiagonal marix algorihm (TDMA), also known als Thomas algorihm can be used (see Appendix A for deails). x 1 x 2 x 3 x N 1 h 2 r 1 γ 1 h 2 r 2 = h 2 r 3, h 2 r N 1 γ N Example Solve a linear BVP [8] x () (1+ 2 )x() = 1, (3.17) x( 1) = x(1) = 0 over [ 1, 1] wih finie difference mehod. Firs we inroduce discree se of nodes i = 1 + ih wih given ime sep h. According o noaions used in previous secion, p() = 0, q() = (1+ 2 ), r() = 1, α = β = 0. Hence, he linear sysem (3.16) we are ineresed in reads (2+h 2 q 1 ) 1 0...... 0 x 1 h 2 1 (2+h 2 q 2 ) 1 0... 0 x 2 h 2 0 1 (2+h 2 q 3 ) 1... 0 x 3...... = h 2.......................................... 1 0...... 0 1 (2+h 2 q N 1 ) x N 1 h 2 The numerical soluion of he problem in quesion is presened on Fig. 3.5. 3.2.2 Finie difference for linear eigenvalue problems Consider a Surm-Liouville problem of he form x ()+q()x() = λ v()x(), (3.18) over [a, b] wih
1 0.9 0.8 0.7 0.6 x 0.5 0.4 0.3 Fig. 3.5 Numerical soluions of (3.17) over he inerval [ 1, 1] by finie difference mehod. 0.2 0.1 0 1 0.5 0 0.5 1 x(a) = 0, x(b) = 0. Inroducing noaion x i := x( i ), q i := q( i ), v i := v( i ), we can wrie down a difference equaion for Eq. (3.18) x 0 = 0 x i+1 2x i + x i 1 h 2 + q i x i λ v i x i = 0, i = 1,... N 1, x N = 0. If v i 0 for all i we can rewrie he difference equaion above as an eigenvalue problem (A λ I)x = 0 (3.19) for a ridiagonal marix A 2 + q h 2 1 1 v 1 v 1 0...... 0 h 2 v 1 1 2 + q h 2 v 2 h 2 2 1 v 2 v 2...... 0 h 2 v 2 1 2 A = 0 + q h 2 v 3 h 2 3 1 v 3 v 3... 0 h 2 v 3............................... 1.................. h 2 v N 2 1 2 0...... 0 + q h 2 v N 1 h 2 3 v N 1 v N 1 and a vecor x = (x 1, x 2,..., x N 1 ) T.