CHAPTER 08.03: RUNGE-KUTTA 2ND ORDER METHOD: Ralston's Method: Part 2 of 2
So we've got to take one more step here. We've got to take one more step here to be able to go to i equal 1. So let me start it on here. So we'll say i equal to 1. Now, in this case, x1 is 1.5, y1 I just calculated, which is 4.024, and I'm going to use this to now calculate my k1 and k2 values, and once I calculate k1 and k2, I will be able to calculate y2. So what is k1? k1 is the value of the function at xi, yi. Since i is equal to 1, it'll be x1, comma, y1, so that's the value of the function at 1.5 and 4.024, and that's same as 3 e to the power the value of x, minus 0.4, the value of y, and that turns out to be equal to -0.9402. So that is the value of k1, the slope at x1. Now I'm going to find the value of k2, which is nothing but f of x1 plus 3 by 4 h, comma, y1 plus 3 by 4 k1 times h, so I have to calculate these arguments now. Now I know the value of the function is 1.5, h is 1.5, y1 is 4.024, which I calculated before, so y1 is 4.024, plus 3 by 4, k1 I just calculated, -0.9402, times h, which is 1.5. So all the arguments for the function, f, to be calculated for k2 are known, so what do these arguments turn out to be? They turn out to be 2.625, and 2.966. So this is the point where we want to calculate the slope, and this is the corresponding approximate value of y which we are getting here, and when we substitute this into our function, f, which will be 3 e to the power minus the value of x, minus 0.4, the value of y, and this k2 value turns out to be -0.9692. So now we have the value of k1 and k2, and we're going to use the value of k1 and k2 to be able to calculate our y2. So y2 is y1, plus 1/3 k1 plus 2/3 k2, times h. y1 we have calculated from the previous step, which is 4.024, plus 1/3 the k1 value, which we calculated as -0.9402, plus 2/3 times the value of k2, which we calculated as -0.9692, and h, of course, is 1.5, and this value here turns out to be 2.5847. And this is the approximate value of y at x2, which is same as the value of y at 3, that's what we are trying to find, because x2 is nothing but x1 plus h, and x1 is 1.5, h is 1.5, so that gives me 3.0. Now, as an exercise at homework which I would like to do is the exact value of y at 3 is 2.763, and this is the value which you get for, up to four significant digits, the exact value by using your ordinary differential equation course knowledge, and the corresponding relative true error in this case turns out to be 6.453 percent. So that's part of your homework, to find the exact value, and then find what the absolute relative true error between the number 2.763, which is the exact value, and the number 2.5847, which is the approximate value by using Ralston's method. And that's the end of this segment.