CHAPTER 05.06: NM SHOOTING METHOD: Example 4 of 4 

 

So I'm going to write a table here, so I had y'(0) for example and what did I get for y3 which is approximately equal to the value of y(9). This is what I got; when I chose y'(0) equal to 4 I got 1548, that's what I got as the value of y3 which is far away from 0. But then when I chose it to be -24 I got -216. So can I somehow be able to figure out what should I choose for y'(0) so that this thing turns out to be 0, or close to 0 as I should say. So If I use an interpolation technique to be able to figure out hey, what value of y'(0) should I choose so that I get 0 for y3. So the way I am going to do it, I'm going to, let's suppose, call this to be p0, I'm going to call this p1, I'm going to call this q0, I'm going to call this q1. I'm just writing this down just for interpolation purposes, so this function I'm going to call p and this function I am going to call q. So, if p and q, so that means is that p is equal to p0 plus p1-p0 divided by q1-q0 times q-q0. This is just the equation of a straight line between, q being between q0 and q1. So this is just the equation of a straight line and if I am going to write p in terms of q, what I am going to get, p is p0, which is 4, plus p1-p0, which is 24-4, divided by, -24 divided by 4, p1 is -24, and then q1 is -216 and q0 is 1548, times q-q0, which is 1548. And what am I looking for? I am looking for a value where q becomes 0, right? I'm looking for a value q becomes, my y3 becomes 0, so I am just going to put q equal to 0 and this value [4 +(-24-4)*(0-1548)/(-216-1548)] turns out to be -20.57. So what I'm trying to say is that rather than choosing another guess between 4 and -24, let's suppose, because you can very well see that, hey, somewhere between 4 and -24 most probably, this y3 is going to become 0. We use interpolation, linear interpolation technique to be able to come up with a guess which will maybe bring us closer to the value of y3 being equal to 0. So based on this, this is what happens. Now I'm going to choose, I'm going to choose y'(0), I'm going to choose y'(0), so again I am going to say choose. I'm going to choose y'(0) to be equal to to 20.57. So whan I do that, this is what I get, again you are going to use Euler's Method. So go through the steps of Euler's Method, so you're going to go through the steps of Euler's Method and this is what you are going to obtain for different values of x, different values of y and z. So it's i, this is x, this is y, this is z. So when i is 0, of course x is 0, y is 0 and z is -20.57 which is the initial slope. Then, when I choose i=1 I get x equal to 3, and I get this to be -61.7, and this one turns out to be -20.57. Then at 2, the value of x is 6, I get -123.42 and here I get 41.17. And when I choose i=3 I get x equal to 9, and I get 0.09. So you can very well see that now y3, which you are getting here, the y3 you getting it as -0.09 which is this number which is approximately equal to y(9), approximately y(9). So you are finding out that this number is now getting close to 0. Now, if you would have choosen more significant digits you will get a much, much smaller number here, alomost close to 0. So, the reason why you are getting not exactly zero is because I didn't choose, I chose only 4 or 5 significant digits while I was doing these calculations, but you will find out that hey, you will get almost close to zero. So that becomes the solution then, so basically, this is your solution to the boundary value problem that at x=0 the value of y is 0, at x=3 this is the value of y, at x=6 this is the value of y, and at x=9 the value is approximately 0 because that's the boundary condition which is given to you. So you have used the initial value problem to solve a boundary value problem and if you are interested in finding out the slopes of y, you also have those numbers which you can find also. So that's how this Shooting Method works and what I would like you to do as homework is the following: Does the value of y3 get close to zero on the first try? So on the first try of using the linear interpolation we don't have to do any more hit and trial. Does the value os y3 get close to zero on the first try because the example is a linear ordinary differential equation? So, go ahead and see if you can answer that question. What you can do is you can try to solve, or try to use this method with a non-linear ODE. The reason why I am saying that try this method with a non-linear ODE example is because then you can appreciate that hey, are you going to get the value of y3 or the value of the end boundary condition to be the same as what the applied boundary condition is if you are going to solve a non-linear ordinary differential equation. The third one is compare the values with exact solution. So because we are taking h=3, that means that the kind of answer which you are getting are not exact but using the Shooting Method to be able to solve a boundary value problem would still, it's a numerical skill so I would like you to compare the values with the exact solution. And number 4 is repeat the example, repeat the example using Runge Kutta Second Order Method and the reason why I am asking you to repeat the example using Runge Kutta Second Order Method with the same step size as h=3 is you see that whether you are getting better solutions using the Runge Kutta Second Order Method as opposed to using the Euler's Method which is shown in this example. And that is the end of this segment.