n

8
OBJECTIVE To solve second order differential equation when boundary condition is known using shooting method THEORY Shooting method is a famous method for numerical solution of second order differential equation when boundary condition is known. For a boundary value problem of a second-order ordinary differential equation, the method is stated as follows. Let y''(t) = f(t, y(t), y'(t)), \quad y(t_0) = y_0, \quad y(t_1) = y_1 be the boundary value problem. Let y(t; a) denote the solution of the initial value problem. y''(t) = f(t, y(t), y'(t)), \quad y(t_0) = y_0, \quad y'(t_0) = a Then the function F(a) is defined as the difference between y(t1; a) and the specified boundary value y1 such that F(a) = y(t_1; a) - y_1 \, If F has a root a then obviously the solution y(t; a) of the corresponding initial value problem is also a solution of the boundary value problem. Conversely, if the boundary value problem has a solution y(t), then y(t) is also the unique solution y(t; a) of the initial value problem where a = y'(t0), thus a is a root of F.

description

n

Transcript of n

OBJECTIVE

To solve second order differential equation when boundary condition is known using shooting method

THEORY

Shooting method is a famous method for numerical solution of second order differential equation when boundary condition is known.For a boundary value problem of a second-order ordinary differential equation, the method is stated as follows.Lety''(t) = f(t, y(t), y'(t)),\quad y(t_0) = y_0,\quad y(t_1) = y_1be the boundary value problem. Let y(t; a) denote the solution of the initial value problem.y''(t) = f(t, y(t), y'(t)), \quad y(t_0) = y_0, \quad y'(t_0) = aThen the function F(a) is defined as the difference between y(t1; a) and the specified boundary value y1 such thatF(a) = y(t_1; a) - y_1 \,If F has a root a then obviously the solution y(t; a) of the corresponding initial value problem is also a solution of the boundary value problem. Conversely, if the boundary value problem has a solution y(t), then y(t) is also the unique solution y(t; a) of the initial value problem where a = y'(t0), thus a is a root of F.

Algorithm for shooting methodAlgorithm for shoot procedureStep 1: StartStep 2: Declare the function f with the arguments x, y and z.Step 3: return (z).Step4: Declare the function g with the arguments x, y and z.Step5: return (-y/x).Step6: Declare the function shoot with the arguments x0,y0,z0,xn,h,p.Step 7: Declare the variables x,y,z,k1,l1,k2,l2,k,l,x1,y1,z1.Step 8: Set x=x0, y=y0, z=z0.Step 9: Repeat the following steps while (x