CHAPTER 05.03: NM SHOOTING METHOD: Example 1 of 4
In this segment we're going to take an example of Shooting Method. We're going to take a second order differential equation but it's a boundary value problem and try to figure out how we can use Shooting Method to be able to solve this particular problem. So for example, somebody tells us hey, d2y/dx2 - 2y = 8x(9-x) d2y/dx2 - 2y = 8x(9-x) and you are given the boundary values at zero to be 0 and y(9)=0. So what you are given is that these are the two boundaries, x=0 and x=9 are the two boundaries, and the value of y here is 0 and the value of y here is 0. Now what we are asked to do is to simply find out what the values of y are at the point going from 0 to 9. And let's suppose if we are asked to use, since it's a Shooting Method, you will be asked to use some initial value problem method such as Euler's Method or Runge Kutta Second Order Method, Runge Kutta Fourth Order Method to solve it. So in order to keep things simple, we are going to suggest you use Euler's Method because the formula is simple. So let's suppose somebody says, use Euler's Method with, with step size h=3. So what that means is that if h is equal to 3, that means that one step will take you to x equal to 3, the next step will take you to x equal to 6, and then the next step will take you to x equal to 9. So you are to basically conduct 3 steps of Euler's Method to be able to get from x equal to 0 to x equal to 9. Now we said in the theory that we are solving this problem by Euler's Method, the Shooting Method using the Euler's Method to solve this particular problem but the conditions are given at x=0 and x=9, so but that's not going to allow us to solve this by Euler's Method because Euler's Method is an initial value problem method. So what that means is that we have to know, we already know what the value of y at x equal to 0 is but we also need to know what the value of the derivative of y at x equal to 0 is, only then we can solve by using Euler's Method. But since that is not given, we're going to just assume it to be something, so I am going to assume y'(0)=4, let's suppose. So I am going to assume that y'(0)=4 and in conjunction with y(0)=0, I am going to use these two initial conditions to solve the problem. So as we said in theory here, what we are going to do is, we are going to choose y(0)=0 which is already, no we are not choosing this, this is already given to us. We are going to choose y'(0)=4 and see that what do we get for the value of y at x=9. Do we get 0? Most probably we won't get zero, but based on that what we have to do is we have to change what this initial value of y'(0) is which we assumed so that we can get a value of which is close to zero, and that will be the whole point of solving this particular problem. So let's go and see how we are going to go about doing that. So the first thing which I have to write down is that I have to write d2y/dx2 in the form of function of x, y, and dy/dx and that will turn out to be equal to 2y + 8x(9-x) And also, since this is a second order differential equation, as we know that, all these initial value methods such as Euler's Method, Runge Kutta Second Order Method, and Runge Kutta Fourth Order Method, they all fall under the category that you can always solve first order differential equations. So we have to reduce this second order differential equation, so we have to reduce this second order differential equation which is subject to y(0) equal to 0 and y'(0) equal to 4, although it is an assumed condition, but still we have to say, ok, I am going to solve this particular problem but it is a second order differential equation, so it does need to be reduced to simultaneous first order differential equations so that you can solve it. So if I want to say ok, dy/dx=z, so I am going to assume dy/dx=z so what that means is that I am introducing another variable called z in here. What that will do is that will change this to dz/dx = 2y + 8x(9-x) so that's what it is going to get reduced to. So, what that means is that this is the first function of x which is the independent variable and the two dependent variables which I have y and z, which I introduced, and this will be a different function, f2, but still functions of the independent variable x, and the two dependent variables y and z. This particular differential equation will be subject to y(0)=0 which is right here and this one will be equal to what? z(0) is nothing but dy/dx at 0 which is nothing but 4 itself. So that's how you setting up these conditions and now we got to apply, this is 1 and this is 2, we want to apply Euler's Method approximations on these two first order simultaneous differential equations. So let's see what, what those are. So from the first one, I will get is y_i+1=yi + f1(xi, yi, zi)*h, where h is the step size. And here, in this case here, I will get z_i+1 = zi + f2(xi, yi, zi)*h. So what we have to do is we have to use these step by step like because we will know what the initial values are of x, y, and z and we know what the step size is, we know what these individual functions, f1 and f2, are because we just wrote those down. We will be able to calculate the value of y and z at a step ahead and we will continue to do this til we reach x=9. So we are, as you can see here, that we have x=0 which corresponds to i=0 and then we will get to, we need to get to x=9, right? So that will be x=3, i will be equal to 1 there because this first step size and I'll let x=6 and i will be equal to 2 and this will be i=3. That's how the i's are going to work. We are going to start with i=0, end up with at i=1 which corresponds to the value of x equal to 3, then i=2 that corresponds to x=6, then i=3 which corresponds to x=9 there. |