Report Shooting Method
Report Shooting Method
Report Shooting Method
Abstract: this research aims to use the shooting method (SM) to the numerical solutions to the boundary
value problems of ordinary differential equations (ODEs). Applied mathematics, theoretical physics,
engineering, control, and optimization theory all have two-point boundary value problems. If the two-point
boundary value problem cannot be solved analytically, numerical approaches must be used. The method
works as follows: first, a guess for the initial condition is made and an integration of the differential equation
is performed to obtain an initial value problem solution; then, the end value of the solution is used in a simple
iteration formula to correct the initial condition; the process is repeated until the second boundary condition
is satisfied.
1. Introduction
Differential equations are well known to be the basis of most physical systems. Ordinary
differential or partial differential equations are commonly used to modeled physical systems. In
applied science and engineering, many linear problems, such as second-order ODEs with
numerous types of boundary conditions, are solved analytically or numerically. Two-point BVPs
arise in a wide range of situations where boundary layer theory in fluid dynamics, modeling
chemical reactions, and heat power transfer are only a few examples. Boundary value problems
have a wide range of applications in applied science and engineering, necessitating the
development of faster and more reliable numerical methods. Shooting method have a significant
advantage for solving nonlinear differential equations. The shooting techniques are quite broad
and can be used to solve a wide range of differential equations. The foremost objective of this
research is to solve two-point boundary value problems using a simple and proficient shooting
method.
The Shooting Method solves the BVP by finding the IVP that has the same solution. A
sequence of IVPs is produced, converging to the correct one. The sequence begins with an initial
guess for the slope sa, provided to go along with the initial value ya. The IVP that results from this
initial slope is solved and compared with the boundary value yb. By trial and error, the initial slope
is improved until the boundary value is matched. To put a more formal structure on this method,
define the following function:
With this definition, the boundary value problem is reduced to solving the equation
F(s) = 0
Figure 2. The Shooting Method. To solve the BVP, the IVP with
initial conditions y(a) = ya,y’(a) = s0 is solved with initial guess s0.
The value of F(s0) is y(b) − yb. Then a new s1 is chosen, and the
process is repeated with the goal of solving F(s) = 0 for s.
4. Problem statement
The conservation of heat can be used to develop a
heat balance for a long, thin rod (Fig.3). If the rod is not
insulated along its length and the system is at a steady
state, the equation that results is
𝑑2𝑇
+ h′(Ta − T) = 0 (1)
𝑑𝑥 2
where h′ is a heat transfer coefficient (m−2) that
parameterizes the rate of heat dissipation to the surrounding air and Ta is the temperature of the
surrounding air (°C).
To obtain a solution for Eq.(1) , there must be appropriate boundary conditions. A simple
case is where the temperatures at the ends of the rod are held at fixed values. These can be
expressed mathematically as
T(0) = T1
T(L) = T2
With these conditions, Eq. (1) can be solved analytically using calculus. For a 10-m
rod with Ta = 20, T1 = 40, T2 = 200, and h′ = 0.01, the solution is
T = 73.4523e0.1x − 53.4523e−0.1x + 20
The shooting method is based on converting the boundary-value problem into an equivalent
initial-value problem. A trial-and-error approach is then implemented to solve the initial-value
version.
Convert the second order diff. eq. into first diff. eq.
𝑑𝑇
Let =𝑧
𝑑𝑥
𝑑2𝑇
= -h′(Ta − T)
𝑑𝑥 2
Then
𝑑𝑇
= 𝑓1 (𝑥, 𝑇, 𝑧) = 𝑧 𝑇(0) = 40°∁
𝑑𝑥
𝑑𝑧
= 𝑓2 (𝑥, 𝑇, 𝑧) = ℎ′(𝑇 − 𝑇𝑎 ) 𝐴𝑠𝑠𝑢𝑚𝑒 𝑧(0) = 40°∁
𝑑𝑥
To solve these equations, we require an initial value for z. For the shooting method, we guess
a value—say, z (0) = 10. For example, using a fourth order RK method with a step size of 2.
By using m code
clear all;
fy=@(x,y,z) z;
fz=@(x,y,z) 0.01*(y-20);
x(1)=0;
z(1)=10;
y(1)=40;
h=2;
xfinal=10;
N=ceil((xfinal-x(1))/h);
for j=1:N
x(j+1)=x(j)+h;
k1y=fy(x(j),y(j),z(j));
k1z=fz(x(j),y(j),z(j));
k2y=fy(x(j)+h/2,y(j)+h/2*k1y,z(j)+h/2*k1z);
k2z=fz(x(j)+h/2,y(j)+h/2*k1y,z(j)+h/2*k1z);
SHOOTING METHOD IN SOLVING BOUNDARY VALUE PROBLEMS
k3y=fy(x(j)+h/2,y(j)+h/2*k2y,z(j)+h/2*k2z);
k3z=fz(x(j)+h/2,y(j)+h/2*k2y,z(j)+h/2*k2z);
k4y=fy(x(j)+h,y(j)+h*k3y,z(j)+h*k3z);
k4z=fz(x(j)+h,y(j)+h*k3y,z(j)+h*k3z);
y(j+1)=y(j)+h/6*(k1y+2*k2y+2*k3y+k4y);
z(j+1)=z(j)+h/6*(k1z+2*k2z+2*k3z+k4z);
end
figure;
plot(x,y,'LineWidth',2);
xlabel('X');
fprintf('y z\n');
fprintf('%5.3f %11.7f\n', y, z);
are linearly related. As such, they can be used to compute the value of z (0) that yields T (10)
= 200. A linear interpolation formula can be employed for this purpose:
𝑓(𝑥1)−𝑓(𝑥0)
f1 (x) =𝑓(𝑥0 ) + (𝑥 − 𝑥0)
𝑥1−𝑥0
20−10
z (0) =10 + (200 − 168.3797)= 12.6907
285.8980−168.3797
The shooting method: (a) the first “shot,” (b) the second “shot,” and (c) the final exact “hit.
function cost=cost_function(Z0)
%parameters
Ta=20;
T0=40;
TL=200;
h=0.01;
Z0=10;
%initial condition
s0=[T0 Z0];
%%file shooting_rhs.m
function dydx = shooting_rhs(x, y)
dydx = zeros(2,1);
dydx(1) = y(2);
dydx(2) = 0.01*(y(1)-20);
7. Conclusion
In this article, we discuss the shooting method to solve ordinary differential equations of
boundary value problems, in an efficient way. It has been implemented in numerous mathematical
tools and may be easily expanded to provide a solution method for practically any boundary value
problem based on its boundary conditions. We should anticipate that the shooting method can
play a significant role in the field of engineering and applied sciences when critical boundary value
problems of ODEs arise.
SHOOTING METHOD IN SOLVING BOUNDARY VALUE PROBLEMS 7 of 7
References
[1] I. F. Akinlabi and G. O. Akinlabi, “Application of the shooting method for the solution of second order boundary value
problems,” Journal of Physics: Conference Series, vol. 1734, no. 1, Article ID 012020, 2021.
[2] M. K. Wong and J. S. W. Wong, “,e shooting method and nonhomogeneous multipoint bvps of second-order ode,”
Boundary Value Problems, vol. 2007, pp. 1–16, 2007.
[3] H. Wang, Z. Ouyang, and L. Wang, “Application of the shooting method to second-order multi-point integral boundary-
value problems,” Boundary Value Problems, vol. 2013, no. 1, p. 205, 2013.
[4] D. B. Meade, B. S. Haran, and R. E. White, “,e shooting technique for the solution of two-point boundary value
problems,” 1e Maple Technical Newsletter, vol. 3, no. 1, pp. 1–8, 1996.
[5] D. Sharma, R. Jiwari, and S. Kumar, “Numerical solution of two point boundary value problems using galerkin-finite
element method,” International Journal of Nonlinear Science, vol. 13, no. 2, pp. 204–210, 2012.
[6] M. B. M. Elgindi and R. W Langer, “On the shooting method for a class of two-point singular nonlinear boundary value
problems,” International Journal of Computer Mathematics, vol. 51, no. 1-2, pp. 107–118, 1994.
[7] D. Jones, “Use of a shooting method to compute eigenvalues of fourth-order two-point boundary value problems,” Journal
of Computational and Applied Mathematics, vol. 47, no. 3, pp. 395–400, 1993.
[8] C. Liu, The Lie-group shooting method for singularly perturbed two-point boundary value problems, Computer Modeling
in Engineering and Sciences 15 (2006) 179.
[9] A. Kaw, E. Kalu, Numerical Methods with Applications: Abridged, in, Lulu, Raleigh, NC, USA, 2011.
[10] A. Kharab, R.B. Guenther, An Introduction to Numerical Methods: A MATLAB Approach, CRC Press, 2011.
[11] M. Sajid, T. Hayat, The application of homotopy analysis method to thin film flows of a third order fluid, Chaos, Solitons
& Fractals 38 (2008) 506–515.
[12] H. Schlichting, K. Gersten, Boundary-Layer Theory, Springer, 2004.