CHAPTER 08.03: RUNGE-KUTTA 2ND ORDER METHOD: Derivation: Part 1 of 2
In this segment, we're going to derive Runge-Kutta second-order method. So Runge-Kutta second-order method, which is the way to solve first-order ordinary differential equations. We're going to look at how Runge and Kutta derived this formula. So again, what does Runge-Kutta second-order method say? It is that if you have the differential equation of this particular form, then you can write down the numerical method to solve for y with respect . . . as a function of x by using this particular general formula, and it'll be second-order accurate, where these, a1 plus a2 is equal to 1, and then a2 p2 is equal to . . . a2 p1 is equal to 1/2, and a2 q11 is equal to 1/2, these are the three equations which they obtained in order to be able to plug them into this particular equation, where k1 is equal to the value of the function at xi, comma, yi, and k2 is equal to the value of the function at xi plus p1 times h, yi plus q11 times k1 times h. So what we have in the Runge-Kutta second-order method is this is the formula which is used, where k1 and k2 in the formula are given by these expressions of calculating the value of the function at certain points, and you are going to satisfy these three equations to find out what the values of a1, a2, p1, and q11 you're going to use. So what we want to do in this segment is to figure out how did they get this? How were they able to obtain these three equations so as to write this as the general form for Runge-Kutta second-order method? So this involves use of Taylor series, so we do need to pay some attention here. So let's go ahead and see that how . . . how this was done. So let's suppose if you look at the Taylor series for y as a function of x will be given by this. So we're writing the Taylor series of one variable, and we're going to write the first three terms of the Taylor series, because that's what is used in the Runge-Kutta second-order method, and that's why it's called the Runge-Kutta second-order method, because you're using the first three terms of the Taylor series, times h squared, and plus the terms which you are leaving are of the order of h cubed, so that's how we've got to look at it. This is the Taylor series for y as a function of x. Give me the value of the function of y at a certain point, its derivative at that particular point, its second derivative at that particular point, and so on and so forth, and if I'm going to forget about the terms after the third term of this Taylor series, then those terms will be the order of h cubed. Now, we already know what h is, h is nothing but the difference between the point where I want to and the point where I am. Now, since we know that the differential equation itself is dy by dx is equal to f, x, comma, y, this is what we are trying to solve, what I'm going to do is I'm going to substitute this back in here, into the Taylor series expression, and this is what I'm going to get, I'm going to get y-sub-i-plus-1 is equal to yi, plus the value of the function at xi, comma, yi, times h, plus 1 by factorial 2, f prime, xi, comma, yi, times h squared, plus the order of the terms of h cubed. So because, since dy by dx is this function, f, I can just substitute it back there at calculated points, these two points, and this one is the derivative of the function, f, because I have the second derivative of y, so if I take the second derivative of y, I get the first derivative of f, and that's why you see only an f prime there. So having said that, in order to be able to calculate f prime, what we need to do is we need to apply the chain rule, and the chain rule goes as follows, the f prime of x, comma, y, the derivative of f with respect to x is given by the chain rule. The reason why it's given by the chain rule is because of the fact that . . . that y is a function of x, so you don't have two independent variables, you have y as a dependent variable . . . y as a dependent variable and x is the independent variable, so the chain rule looks like this, it's the partial derivative of f with respect to x, plus the partial derivative with respect to y, times the dy by dx, that's what you get there. So if I'm going to substitute f prime, xi, comma, yi, it will be nothing but del f by del x being calculated at that point, and del f by del y being calculated at that point, and the dy by dx is nothing but the value of the function, f, being calculated at that particular point. So I'm going to substitute this expression now back into this Taylor series expansion which I had, and see what I get. And this is what I'm going to get, I'm going to get y-sub-i-plus-1 is equal to yi, plus the value of the function at xi, comma, yi, times h, so that's from the second term of the Taylor series, and then the last term which I will get is 1/2 del f by del x, at xi, yi, times h squared, plus 1/2 del f by del y, at xi, comma, yi, times the value of the function at xi, comma, yi, because that's dy by dx at that particular point, times h squared, plus the order of the h cubed terms. So once I have that, what I want to be able to do is that I want to equate it to something so that I can develop those three equations, three unknowns. So this is what I know, that, hey, in order to be able to get second-order accuracy, I need to take the first three terms of the series, of the Taylor series, and now I'm getting four terms here, I'm not adding one more term of the Taylor series, it's just that the second term has now two parts to it, because I used the chain rule for the derivative of the function of f. |