‫So to be honest with you, the difference between the oilor and wrong Akutan method is not that big.
‫This is your oilor method, and this X is just a random state, and note that now I didn't put an end
‫here, I don't have an end here.
‫So that means that I'm not chopping this sample time interval into multiple pieces.
‫And so this ex dot sub, kay, that's your state time derivative, that's your Delta X over Tietz.
‫And you know what, this slope here.
‫It's the only difference between the oilor and the cuter method.
‫The only difference.
‫This is the only place where the difference comes in.
‫In the Oilor method, you only have one slope, which is the time derivative of your state when your
‫state is X, OK, so your present state, but in a fourth order, wrong Akutan method, you have four
‫different slopes for different time, derivatives of your states.
‫And the final slope that you will put here is the weighted average of those four slopes.
‫So let's just say that you're for slope's are X dots up, K sub one, then X dot stuff K sub to X.com
‫case sub three and X dots up, case up for these are your four slope's.
‫And don't worry, you will see how to get them.
‫But assuming that, you know, you're for Slope's, you will compute their weighted average like this.
‫So your weighted average slope, let's call it just X dots up K and W A. which stands for a weighted
‫average, and then the formula is like this.
‫One sixth time's the first slope plus.
‫Two times the second slope plus.
‫Two times the third slope and plus.
‫The fourth slope like this.
‫And of course, if you open up your parenthesis, then you will have this equation like this.
‫And so these numbers in front of the slopes, they are the weights.
‫And you can see that the second slope and the third slope, they have bigger weights and that means
‫that they have stronger influence over the final answer that you will get when you compare your weighted
‫average slope and apply it in this formula here.
‫And so the first and the fourth slope, because of their smaller weights, they influence the final
‫result less.
‫And also it makes sense that you have six in the denominator here, because when you add up all the
‫weights, then you have to get one.
‫So it's like one sixth plus two sixth plus two sixth plus one sixth and all that equals one.
‫So your weights, they have to be normalized.
‫They have to be like a percentage.
‫Now, if you're curious about why the weights are exactly like that, I assume that they were deduced
‫through experimentation that two German mathematicians.
‫Carl Runga and Martin Kutta, when they develop these methods, perhaps they tested it with different
‫weights and decided that the weights which you see here, are very good for the four different slopes.
‫However, that's just my opinion.
‫I haven't researched that.
‫Exactly.
‫But what I can tell you is this, again, we have our state time, Grauwe.
‫And our first slope is equivalent to the one that we had when we used the Oiler method at time equals
‫30 seconds.
‫So right here.
‫So, in fact, the first slope that you have here is the same slope that you had in the Oiler method
‫is just wrong.
‫Akutan method, you will have three more slopes.
‫So this first slope is calculated in this point at K. at time equals T. Then the second and third slope
‫they are computed at time T plus T.
‫S over to.
‫So this point here would be t plus tips, and so both the second and the third slope, both of them,
‫they are computed in the middle of your sample time interval here.
‫And then the fourth slope is computed at time T plus two seconds.
‫So if you look at these four weights, then I guess in order to accurately predict the new true state.
‫It's more important to consider what's happening in the middle of your sample time interval than on
‫the edges.
‫So that's why I guess the second and then the third slope have bigger weights in order to assign more
‫importance to them.
‫And so once you have your weighted average slope, this one here, you compute the new state in the
‫same way like in the Euler case, meaning that this thing here, it will go into this thing here.
‫So that's the difference.
‫Now you just use a weighted average slope that consists of four different slopes.
‫And so if you want to, you can also rewrite this method like this and note this red part, that's your
‫weighted average slope.
‫And that's the difference between Guta and the Oiler method, not that I did not divide the time interval
‫into different sub intervals, that means that I can get useful results with less iterations.
‫Also, note that when I write X up K and X up K plus one in our context, the K and K plus one, they
‫do not represent time here.
‫They just represent the state now and the next state.
‫So in the Euler case, the state now was up K and then the next state except K plus one.
‫Was at time T plus T as over nd that's when we chopped the T into several pieces.
‫So let's say if you're T equals zero point one seconds and then you're N equals five, then that means
‫that your true interval after which you're going to compute a new state, you're going to compute a
‫new state after zero point zero two seconds.
‫So when you use this approach, then your subindex K means your state now and your subindex K plus one
‫means your state zero point zero two seconds later.
‫But now in our Runga Kutta scenario, since we are not shopping our teams into multiple pieces.
‫The now ex up K still means the state now, so the present state, but in our wrong Akutan scenario,
‫except K plus one now means a new state at a time plus T.
‫S or zero point one seconds later, not zero point zero two seconds later, zero point one seconds later.
‫So the subindices, Kate and Kate, plus one, they are not for time, they are just to tell you what's
‫now, what's present and what's the next state, no matter what time interval you choose.
‫And so in the wrong Kakuta scenario, we chose our time interval to be zero point one seconds.
‫But since I use the weighted average slope, I still get precise results even by not cutting the ties
‫into several pieces.
‫And now we are going to use our state's basic equations to show you how exactly this slope calculations
‫happen, because this is what the game will be now.
‫The game will be about finding these four slopes.
‫Well, actually, you already know how to get the first slope is the same one that you had in the earlier
‫method case.
‫But now the game will be about finding the rest of the four slopes.
‫We will go through the entire process from the states at K up until we get to the States at K plus one.
‫And by the way, again, I use the same logic in my code, so.
‫Let's get started on that in the next video.
‫Thank you very much.