



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




( 6. 2 ) - The Shooting Method for Nonlinear Problems
Consider the boundary value problems (BVPs) for the second order differential equation of the form (*) y ′′^ f x , y , y ′^ , a ≤ x ≤ b , y a and y b .
When f x , y , y ′^ is linear in y and y ′, the Shooting Method introduced in Section 6.1 solves a system of two initial value problems and the solution y x of the boundary value problem (*) is of the form
y x y 1 x − y 1 b y 2 b
y 2 x
where y 1 x and y 2 x are solutions of two initial value problems, respectively. Now we consider the cases where f x , y , y ′^ is not linear in y and y ′. Assume a given boundary value problem has a unique solution y x . We will approximate the solution y x by solving a sequence of initial value problems
(**) y ′′^ f x , y , y ′^ , a ≤ x ≤ b , y a , y ′ a s (^) k
where s (^) k are real numbers. Let y x , s (^) k be solution of the initial value problem (**). We want to have a sequence s (^) k so that
lim k → y x , s (^) k y x .
One of choices for s 0 is
s 0 y ′ a ≈
y b − y a b − a
b − a
How to choose s (^) k for k ≥ 1? Consider choose s such that
(***) y b , s − 0,
that is s is a solution of the equation. Observe that the equation y b , s − 0 is a nonlinear equation in one variable. In Chapter 2, we have studied numerical methods: Bisection Method, Newton Method, Secant Method, Fixed-Point Method, for nonlinear equations of the form g s 0. For given s 0 and s 1 , the Secant Method computes s (^) k for k ≥ 2 as follows
s (^) k s (^) k − 1 − g s (^) k − 1 s (^) k − 1 − s (^) k g s (^) k − 1 − g s (^) k − 2
For given s 0 , the Newton Method computes s (^) k for k ≥ 1 as follows
s (^) k s (^) k − 1 −
g s (^) k − 1 g ′ s (^) k − 1
These methods can be used here to solve the nonlinear equation (***). 1. Use the Secant Method to approximate the solution of y b , s − 0.
s (^) k s (^) k − 1 −
y b , s (^) k − 1 − (^) s (^) k − 1 − s (^) k − 2 y b , s (^) k − 1 − y b , s (^) k − 2 Note that y b , s (^) k − 1 is the last element in the array y. Note also that we will need two initial choices s 0 and s 1 to compute s 2 in order to continue the iterations. 2. Use Newton’s Method to approximate the solution of y b , s − 0.
s (^) k s (^) k − 1 −
y b , s (^) k − 1 − dy ds b , s (^) k − 1
Again, y b , s (^) k − 1 is the last element in the array y. Since we do not know y x explicitly, how can we determine dy ds
b , s (^) k − 1? Let y x , s be the solution of the initial value problem (). Then from (), we have
y ′′ x , s f x , y x , s , y ′ x , s , a ≤ x ≤ b , y a , s , y ′ a , s s. By differentiating both sides of the differential equation with respect to s , we have ∂ y ′′ x , s ∂ s
∂ f x , y x , s , y ′ x , s ∂ s
f (^) x x (^) s f (^) y
∂ y x , s ∂ s f (^) y ′
∂ y ′ x , s ∂ s
Since x and s are independent, x (^) s 0. Hence,
(****) ∂ y ′′ x , s ∂ s
f (^) y ∂ y x , s ∂ s
f (^) y ′ ∂ y ′ x , s ∂ s for a ≤ x ≤ b. The initial conditions are: ∂ y a , s ∂ s d ds
∂ y ′ a , s ∂ s d ds s 1.
Define z x , s ∂ y x , s ∂ s
. Since ∂^3 y x , s ∂ x^2 ∂ s
∂ s
∂^2 y x , s ∂ x^2
∂ s y ′′ x , s ,
we denote z ′′ x , s ∂ ∂ s y ′′ x ,^ s .
Then the initial value problem (****) becomes the initial value problem (*****) z ′′ x , s f (^) y z x , s f (^) y ′ z ′ x , s , a ≤ x ≤ b , z a , s 0, z ′ a , s 1. We can update s (^) k using the information from z x , s as follows:
s (^) k s (^) k − 1 −
y b , s (^) k − 1 − z b , s (^) k − 1 Shooting Method for nonlinear boundary value problems : y ′′^ f x , y , y ′^ , a ≤ x ≤ b , y a and y b .
Compute s 0
b − a
. For k ≥ 1, (i) Solve the system of two initial value problems:
y ′′^ f x , y , y ′^ , a ≤ x ≤ b , y a , y ′ a s (^) k − 1 z ′′^ f (^) y z f (^) y ′ z ′, a ≤ x ≤ b , z a , s (^) k − 1 0, z ′ a , s (^) k − 1 1
for y x and z x .
(ii) Update s (^) k s (^) k − 1 −
y b , s (^) k − 1 − z b , s (^) k − 1
For a given accuracy requirement , the algorithm is terminated if y b , s (^) k − 1 − .
Example Solve the BVP: y ′′^ 1 8
32 2 x^3 − yy ′^ , 1 ≤ x ≤ 3, y 1 17, y 3 43 3
f x , y , y ′^ 18 32 2 x^3 − yy ′^ . f (^) y − y ′, f (^) y ′ − y Solve a system of 2 second-order initial value problems:
nlength(Y(:,1)); s(2)s(1)(beta-Y(n,1))/Y(n,3); clear X; clear Y; [X,Y]ode45(’funsys1’,[a,b],[alpha;s(2);0;1]); plot(X,Y(:,1),’–’) text(2.6,11.0,’y(x,s_1)’) % % the third shoot: % nlength(Y(:,1)); s(3)s(2)(beta-Y(n,1))/Y(n,3); clear X; clear Y; [X,Y]ode45(’funsys1’,[a,b],[alpha;s(3);0;1]); plot(X,Y(:,1),’:’) text(2.6,12.5,’y(x,s_3)’) % % Comparisons % title(’y"(322x^3-yy)/8, [1,3], y(1)17, y(3)43/3 (Secant)’) ysolX.^216./X; plot(X,ysol) text(1.2,20,’- solution yx^216/x’) hold off
MatLab program: funsys1.m function yvfunsys1(x,y); yv(1,1)y(2,1); yv(2,1)1/8(322x^3-y(1,1)y(2,1)); yv(3,1)y(4,1); yv(4,1)-y(2,1)/8y(3,1)-y(1,1)/8*y(4,1);
MatLab program: lect6_2_ex2.m % % lect6_2_ex % clear clf alpha17; beta43/3; a1; b3; epsiloninput(’epsilon ’); % % First shooting: % s(1)(beta-alpha)/(b-a);
[X,Y]ode45(’funsys1’,[a b],[alpha;s(1);0;1]); plot(X,Y(:,1),’-.’) hold % % iterations: % flag0; nlength(Y(:,1)); diffabs(Y(n,1)-beta); if diffepsilon flag1; end k1; while flag0, s(k1)s(k)(beta-Y(n,1))/Y(n,3); clear X; clear Y; [X,Y]ode45(’funsys1’,[a,b],[alpha;s(k1);0;1]); plot(X,Y(:,1),’–’) nlength(Y(:,1)); diffabs(Y(n,1)-beta); if diffepsilon flag1; end kk1; end title(’y"(322x^3-yy)/8, [1,3], y(1)17, y(3)43/3 (Secant)’) ysolX.^216./X; plot(X,ysol) text(1.2,20,’- solution yx^216/x’) hold off
Exercises : 1. Use the Shooting Method to approximate the solution to the boundary value problem
y ′′^ − y ′^ ^2 − y ln x , 1 ≤ x ≤ 2, y 1 0, y 2 ln 2 to within 10−^5. Compare your results to the actual solution y ln x by plotting the absolute values of the differences.
2. Use the Shooting Method to approximate the solution to each of the following boundary value problems to within 10−^4. Compare your results with given true solution by plotting the absolute values of the differences. a. y ′′^ y^3 − yy ′, 1 ≤ x ≤ 2, y 1 12 , y 2 (^13) The true solution: y x (^) x (^1) −^1. b. y ′′^ y ′^ 2 y − ln x ^3 − (^1) x , 2 ≤ x ≤ 3, y 2 12 ln 2 , f 3 13 ln 3 The true solution: y x x −^1 ln x . c. y ′′^ 2 y^3 − 6 y − 2 x^3 , 1 ≤ x ≤ 2, y 1 2. y 2 (^52) The true solution: y x x −^1 x.