
Solving Linear Boundary Value Problems with Shooting Method
Explore the application of the shooting method in solving linear boundary value problems for ordinary differential equations. Learn how to convert two-point boundary value problems to initial value problems and solve them effectively. Discover different boundary conditions and methods to find unique solutions.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Ordinary Differential Equations Boundary Value Problems Dr. Rajib Mandal Department of Mathematics Raiganj University 1
14.1 Shooting Method for Solving Linear BVPs We investigate the second-order, two-point boundary-value problem of the form ) , , ( y y x f y = a , x b with Dirichlet boundary conditions , ) ( = a y = (b ) y Or Neuman boundary conditions ) ( = a y ) (b = y , Or mixed boundary condition ) ( 1 + c a y + = = ( ) ( ) y b c y b ( ) , y a 2 2
14.1 Shooting Method for Solving Linear BVPs Simple Boundary Conditions = = = + + ( ) , ( ) y a y y b y ( ) ( ) ( ), , y p x y q x y r x a x b a b The approach is to solve the two IVPs = = ( ) , 0 u a = + + ( ) , u a y ( ) ( ) ( ), u p x u q x u r x a . 1 = = ( ) v a = + ( ) , 0 v a ( ) ( ) , v p x v q x u If the solution of the original two-point BVP is given by y(x) = u(x) + Av(x) is found from the requirement that y(b) = u(b) + Av(b) = yb ( ) , 0 v b b ( ) y u b b ( ) y u b = A = + ( ) ( ) ( ). y x u x v x ( ) v b ( ) v b 3
14.3 Shooting Method for Solving Linear BVPs EX14.1 2y x = = ) 1 ( y 10 , ) 2 ( y , 0 = , y convert to the pair of initial-value problems = , 2 ) 1 ( = = ) 1 ( u 10 , , 0 u u u x 2 = v v ) 1 ( = = ) 1 ( v , 0 , 0 v x 2 2 w = w = = , w = , , w w x w , w w 1 2 3 4 2 4 4 x x 0 ( ) w b 1 b = + ( ) ( ). y x w x w x 1 3 ( ) w 3 4
14.1 Shooting Method for Solving Linear BVPs General Boundary Condition at x = b = + + ( ) ( ) ( ) y p x y q x y r x The condition at x=b involves a linear combination of y(b) and y (b) = + = ( ) , ( ) ( ) y a y y b cy b y a b The approach is to solve the two IVPs ) ( q v x p v + = = = ( ) , 0 u a = + + ( ) , u a y ( ) ( ), u p x u q x u r x a . 1 = = ( ) v a ( ) , 0 v a ( ) ( ) , x u + ( ) ( ) 0 If there is a unique solution, given by ( ) ( ) ( b v v b cv b ) ( ) y u b + cu b b = + ( ). y x u x v x ( ) ( ) cv b 5
14.3 Shooting Method for Solving Linear BVPs General Boundary Condition at Both Ends of the Interval a = a + ) + ( ) y ( ) ( ) y y p + x c y ( q = x y , r x y + = ( ) ( ) ( ) . a y b c y b b y 1 2 the approach is to solve two IVPs ) ( v x p v + = = = = + + ( ) , u a y ( ) , 0 u a ( ) ( ), u p x u q x u r x a = 1 c = ( ) . v a ( ) , 1 v a ( ) ( ) , q x u If , there is a unique solution, given by 0 ) ( ) ( 2 + b v c b v ( ) ( ) y u b + c u b b 2 = + ( ) ( ) ( ). y x u x v x ( ) ( ) v b c v b 2 6
14.3 Shooting Method for Solving Linear BVPs Ex 14.4 2 2 2 x ) 1 ( = + = y = + , 1 + ) 0 ( y , 1 ) 1 ( y . 0 y 2 y y x + + 2 1 1 x x = / ) 6 + 4 2 ( 3 6 y x x x Ex 14.5 2 2 2 x y = + , 1 + 2 y y x ) 0 ( ) 1 ( + = = ) 0 ( y , 0 ) 1 ( y . 3 y y + + 2 1 1 x x = + + 4 2 / 6 3 / 2 1 y x x x 7
14.2 Shooting Method for Solving NonLinear BVPs Nonlinear Shooting Based on the Secant Method use an iterative process based on the secant method presented in Chapter 2 b ), = = = ( ) , y a ay ( ( ), ( )) , 0 h y b y ( , , y f x y y the initial slope t , begin with u (a) = t(1) = 0, error is m(1) Unless the absolute value of m(1) is less than the tolerance, we continue by solving eq. ) 1 i ( ( ) 2 t i t i = ) 1 ( ) ( ( 1 ). t i t i m i ) 1 ( ( ) 2 m i m 8
14.2 Shooting Method for Solving NonLinear BVPs EX 14.6 ) 1 ( + y = = = 2 y y ) 1 ( y . 0 25 . 0 , ) 0 ( y , 1 y y = 1/(x+1) 9
14.2 Shooting Method for Solving NonLinear BVPs Nonlinear Shooting Using Newton s Method = = = ( , , ), y f x y y ( ) , ( ) . y a ay y b by begin by solving the initial-value problem = = = ( ) , ( ) , u a y u a t ( , x , ), u f x u u a k ), = . 1 = = + ( ) , 0 ( ) v a ' ' v ( , , ) ( , , v a vf u u v f x u u u u Check for convergence: , ( t b u m = ) ; y k b if |m| < tol, stop; Otherwise, update t: = / ( , ); t t m v b t + 1 k k k 10
14.2 Shooting Method for Solving NonLinear BVPs EX 14.8 2 [ ] y = , y = = ) 1 ( y , 2 ) 0 ( y , 1 y = ) 0 ( = = 2 1 ) 0 ( u , 1 [ ] , u u u . u kt = ) 1 u 2 2 ( , , ) [ ] u ( , f x u u u u u = [ 2 ( , , ) ] . f x u u 1 u = ) 0 ( v v [ 2 ) 0 ( v , 0 . 1 = = 2 2 [ ] ] , v u u v u u 1 11
14.3 Finite Difference Method for Solving Linear BVPs Replace the derivatives in the differential equation by finite-difference approximations (discussed in Chapter 11). We now consider the general linear two-point boundary-value problem = + + ( ) ( ) ( ), , y p x y q x y r x a x b with boundary conditions = = ( ) , ( ) , y a y b To solve this problem using finite-differences, we divide the interval [a, b] into n subintervals, so that h=(b-a)/n. To approximate the function y(x) at the points we use the central difference formulas from Chapter 11: y y y x y i ) ( 2 = + = + ) 1 , ( , x a h x a n h 1 1 n + 2 y y + + 1 1 1 1 , ( ) i i i i i y x i 2 h h 12
Finite Difference Method for Solving Linear BVPs Substituting these expressions into the BVP and writing as ____ as and as gives ) ( , i i x q p , ) ( r y y p h 2 ( ) p ix ix y 2 iq ir + 2 y y = + + + + 1 1 1 1 i i i i i q y r i i i i h Further algebraic simplification leads to a tridiagonal system for the unknowns viz. , , , 1 1 y + + ny + h h = = , 1 2 2 1 2 ( ) 1 , , 1 , p y h q y p y h r i n + 1 1 i i i i i i i 2 2 = = where and . = = ) ( 0 a y y (b ) yn y 13
Finite Difference Method for Solving Linear BVPs Expanding this expression into the full system gives + h h 2 ( + + = 2 2 ) 1 1 , h q y p y h r p 1 1 1 2 1 1 2 2 + h h 2 ( + + = 2 2 1 ) 1 , p y h q y p y h r 1 1 2 2 2 3 2 2 2 + y i + h p i h 2 ( + = 2 2 1 ) 1 , p h q y y h r + 1 1 i i i i i 2 2 + h + y h 2 ( + = 2 2 1 ) 1 , p y h q y p h r 1 2 3 2 2 2 1 2 n n n n n n n 2 2 + h h 2 ( + = 2 2 1 ) 1 , p y h q y h r p 1 2 1 1 1 1 n n n n n n 2 2 14
Example 14.9 A Finite-Difference Problem Use the finite-difference method to solve the problem + = x y y ( ), 4 0 x 4, x with y(0)=y(4)=0 and n=4 subintervals. Using the central difference formula for the second derivative, we find that the differential equation becomes the system. 2 ) ( 2 = i h + y y y y + = + 1 1 ( ), 4 i 1,2,3. i i i x y x x i i i For this example, h = 1 ,i =1, y = 0, and i = 3, y = 0. Substituting this values, we obtain 0 2 1 2 = + y y + = 1 ( 1 + 4 ), y y y 1 y 2 ( 2 + 2 4 ), y y y 3 2 + 1 2 = 3 ( 3 + 0 2 4 ). y 3 2 3 15
Example 14.9 A Finite-Difference Problem Combining like terms and simplifying gives + = , 3 3 + y y 1 2 = , 4 3 y y y 1 2 3 = , 3 3 y y 2 3 Solving, we find that y_1=13/7, y_2 = 18/7, and y_3 = 13/7. We note for comparison that the exact solution of this problem is = e e e 4 4 1 ( 2 ) 1 ( 2 ) e e + 2 x x 4 . 2 y e e x x 4 4 4 4 e 16
Example 14.10 A Matlab Script for a Linear FDP. The Matlab script that follows solves the BVP. , 2 2 y y y = = = 3e ) 0 ( y , 1 . 0 ) 3 ( y 1 . 0 cos(3). function S_linear_FD aa = 0; bb = 3; n = 300; p = 2*ones(1, n-1); q = -2*ones(1, n-1); r = zeros(1, n-1); ya = 0.1; yb = 0.1*exp(3)*cos(3); h = (bb-aa)/n; h2 = h/2; hh= h*h; x = linspace(aa+h, bb, n); a = zeros(1, n-1); b = a; a(1:n-2) = 1 - p(1, 1:n-2)*h2; d = -(2 + hh*q); b(2:n-1) = 1 + p(1, 2:n-1)*h2; c(1) = hh*r(1) - (1+p(1)*h2)*ya; c(2:n-2) = hh*r(2:n-2); c(n-1) = hh*r(n-1) - (1 - p(n-1)*h2)*yb; y = Thomas(a, d, b, c) xx = [aa x]; yy = [ya y yb]; out = [xx' yy']; disp(out) plot(xx, yy), grid on, hold on plot(xx, 0.1*exp(xx).*cos(xx)) hold off 18
14.4 FDM for Solving Nonlinear BVPs We consider the nonlinear ODE-BVP of the form , 2 2 y y y = = = 3e * ) 0 ( y , 1 . 0 Q and ) 3 ( y 1 . 0 P ( x y 2 y i cos(3). * Assume that there are constants and such that * ) , , ( 0 y y x f Q y *Q , | ) * | h = , , Q f y y P * if * Use a finite-difference grid with spacing and let denote the result of evaluating at using for . The ODE then becomes the system 2 2 h ) 1 ( 2 + . = / ) , P /( + iy ( 2 ) y h f ix 1 1 i + y y y = + 1 1 . 0 i i i f i An explicit iteration scheme, analogous to the SOR method 1 i i y y = , + + 2 2 y y h f + 1 1 i i i where and The process will converge for = n y w 0y 2Q * . 2 / h 20
Example 14.12 Solving a Nonlinear BVP by Using FDM Consider again the nonlinear BVP y 2 y y = = = , ) 0 ( y , 1 ) 1 ( y . 2 We illustrate the use of the iterative procedure just outlined by taking a grid with h = . The general form of the difference equation is ) 1 ( 2 + , 1 = + + 2 2 y y y y h f + 1 1 i i i i i where 2 + 2 + i 2 i ( ) /( 2 ) 2 y y h y y y y = = + + 1 1 1 1 1 1 . i i y i i f i + 2 4 1 ( i ) h y i 21
Example 14.12 Solving a Nonlinear BVP by Using FDM Substituting the rightmost expression for f_i into the equation for y_i, we obtain 1 1 + + 2 + i 2 i 2 y y y y = + + + + 1 1 y 1 1 2 . i i y y y y + 1 i i i i 1 ( 2 ) 4 i The computed solution after 10 iterations agrees very closely with the exact solution. function S_nonlinear_FD ya = 1; yb = 2; a = 0; b = 1; max_it = 10; n = 4; w = 0.1; ww = 1/(2*(1+w)); h = (b-a)/n y(1:n-1) = 1 for k = 1:max_it y(1) = ww*(ya+2*w*y(1)+y(2)+(ya^2-2*ya*y(2)+y(2)^2)/(4*y(1))); y(2) = ww*(y(1)+2*w*y(2)+y(3)+(y(1)^2-2*y(1)*y(3)+y(3)^2)/(4*y(2))); y(3) = ww*(y(2)+2*w*y(3)+yb+(y(2)^2-2*y(2)*yb+yb^2)/(4*y(3))); end x = [ a a+h a+2*h a+3*h b ]; z = [ ya y yb ]; plot(x, z), hold on, zz = sqrt(3*x+1); plot(x, zz), hold off 22