 So, we have been looking at multi step methods, yesterday I derived a specific result for fitting a local quadratic interpolation polynomial and I showed that it could be done in different ways to. So, continuing our introduction with multi step methods, I am going to derive today a general formulation for multi step methods for fitting any polynomial, but before that I want to derive or point at one pattern. I am going to change the notation a little bit. So, I will upload my notes to the changed notation just to emphasize the fact that we are fitting a polynomial at each time instant. I am going to well I already had that notation I am going to just shift the index n to slightly. So, time index is going to be emphasized now with a new notation, otherwise the there is not much difference between the notation that we have used earlier, it is only the placement of this particular point. So, we have been looking at this multi step methods, we have this differential equation d x by d t is equal to f of x t where x belongs to R. We are looking at a scalar differential equation and our problem is to move from this is my initial condition, I want to integrate over time. I want to integrate this initial value problem from t n to t n plus h, where h is the integration step size, the fixed integration step size. So, we are looking at this polynomial interpolations and now let me yesterday we looked at a specific polynomial interpolation. We looked at x t or x n t was a naught n plus I am just moving this subscript n to time index n, just to emphasize that these are time varying coefficients. This is not one polynomial at each time point we are fitting or we are having a different interpolation polynomial. It is a polynomial with time varying coefficients that is another way of looking at it, we are not fitting one polynomial. Why quadratic? Well I can choose to fit an interpolation polynomial of higher order it is not trouble. I can instead of doing this I can choose x n t is equal to a naught n plus a 1 n t plus a 2 n t square plus well I can fit a higher order or I can develop a higher order interpolation polynomial and then either extrapolate or estimate x n plus 1. Ultimately what I want to do is move to x n plus 1. Now to do this how many unknowns are there in this polynomial? There are 5 unknowns 1 2 3 4 and 5. There are 5 unknowns and then I need to get interpolation polynomial coefficient I need to have 5 equations. If I write 5 equations in 5 unknowns then we made one modification yesterday we just shifted the time scale. So, if you define a new time scale tau which is t minus t n. If I define a new time scale tau which is t minus t n then this becomes a polynomial in the shifted time scale tau. This will be tau this will be tau square this will be tau cube and this will be tau to the power 4. If I use a shifted time scale ok. Now to generate 5 equations in 5 unknowns I can do it in many ways. For example, I can do this using say x n x n minus 1 x n minus 2 f n and I can decide to do this. I can decide to do x n I can decide to use 4 derivatives 1 x n. It is up to me how to how to fit how to generate the interpolation coefficients. I could use derivative terms I could use ok. I can use x n x n minus 1 f n f n plus 1 I could use any of these sets ok. Any one of them will give me a valid way of constructing coefficients of the interpolation polynomial. If I use this set or if I use this set or if I use this set I am not going to get identical polynomial interpolation polynomials polynomials will be different ok. What I want to indicate here is that there is no unique choice by which you develop this ok. It is up to you which way you want to go ok. Suppose I decide to do using this set ok. I decide to do using this set then well I have 2 equations or I have 5 equations. Now we have this we can differentiate this with respect to tau and then you know that will give us equation which is one more equation ok. And then using f and using x ok I can write phi equations in phi unknowns ok. If I happen to do it for this set let us see what are those equations and I will just write down the final solution which you get after that ok. Algebraic manipulations algebraic manipulations are fairly simple and you can do them by just doing elimination of variables. So, if I actually go ahead and then at tau equal to 0 setting tau equal to 0 I get this x a naught n comes out to be x n and a 1 n comes out to be f n by following the same method which we have used earlier. So, I substitute for tau. So, what I do here is that at tau equal to 0 is nothing but t equal to t n. At t equal to t n is same as tau equal to 0 ok. At tau equal to h or t equal to t n plus h we get f n plus 1 is equal to a 1 n plus 2 h a 2 n plus 3 h square a 3 n plus 4 h cube a 4 n ok. I am just writing f n plus 1 by setting tau is equal to h which is same as t is equal to t n plus h ok. This is the first derivative ok I am just taken the derivative and substituted see if I take derivative of this you can write f tau is equal to this is my expression for f tau is my expression for f. Now, it should be f n plus 1 I am just taking f n plus 1 I want to I want to use f n plus 1 f n minus 1 f n I have already used I have used f n if I see for f n ok f n that is tau 0 ok tau 0 is f n. So, this is this is 0 oh sorry this should not be tau this this is. So, this is 0 this is 0 this is 0 only a 1 n will remain. So, you will get f n is equal to tau 0 is equal to f n is equal to a 1 n. So, I have already used f n I am now using f n plus 1 ok. So, this is this is my equation number 1 will give me this 2 is this my equation 3 is this I need 2 more equations. So, 2 more equations can be. So, I am going to generate 2 more equations that is t is equal to t n minus h or tau is equal to minus h for this point I get f n minus 1 is equal to a 1 n minus 2 this is my equation number 4 f n minus 1 ok and the last equation I am going to write is x n minus 1. So, this is my 4 fifth equation x n minus 1 f n minus 1 f n plus 1 x n and f n I am using 5 equations ok and I can solve them simultaneously actually a naught n and a 1 n we got directly from the first 2 equations. Then what remains is finding remaining 3 that is a 2 a 3 and a 4 which you can find out by simple elimination ok. If you do an elimination with these as unknowns and h square h cube or 3 h square minus 4 h cube these as coefficients then you can arrive at the 4 you can arrive at a solution I will directly write the solution the solution looks little more complicated ok. So, my a 0 n a 1 n I already got here my if I do the algebra then my a 2 n a 2 n this turns out to be 1 by 2 h f n plus 1 by 6 ok this is my a 2 and my a 3 n it turns out to be f n. So, this is a naught a 1 a 2 a 3 just eliminate just eliminate and then you have 5 equations in 5 unknowns out of which 2 are directly the coefficients. So, what remains is 3 equations in 3 unknowns if you do elimination you will get this simple elimination and then find out ok and my last coefficient my last coefficient here that is a 4 n this turns out ok. So, finally, this is my polynomial a 1 n a 0 n a 1 n a 2 n a 3 n a 4 n and if I substitute that here that is my polynomial ok I have found out the local interpolation polynomial using 5 equations in 5 unknowns this is one way of obtaining the coefficients ok. After having found this polynomial see where I want to reach I want to reach x n plus 1. So, x n plus 1 is t is equal to t n plus h. So, which corresponds to tau is equal to h if I substitute tau is equal to h I will get value at t n plus 1 t n plus 1 this is nothing but t n plus 1 this is my next point ok. So, what I can do now is I can substitute all these I can substitute all these coefficients into this polynomial then substitute for tau is equal to h ok and then I can regroup all the terms ok they will collapse into a very simple equation. If you look here what all things are appearing in my expression on the right hand side if I substitute for a 0 a 1 a 2 a 3 a 4 if I substitute I will get f n plus 1 f n minus 1 f n x n and x n minus 1 these 5 things I will get ok. So, let me let me write after substituting and regrouping ok I can write a very convenient form which is good for computations this particular form which I have written is not very computation friendly ok. I am going to arrive at a simpler form. So, I am going to I am going to transform this I am going to transform this into a simple formula x n plus 1 is equal to alpha 0 x n plus alpha 1 x n minus 1 ok plus h times beta minus 1 this is just a notation beta minus 1 is just a notation f n plus 1 plus beta 0 f n plus beta 1 f n minus 1 I can rearrange this like this ok I can rearrange that polynomial after substituting for tau is equal to h I can rearrange it into this nice form ok. If I actually do substitutions do all very arrangement take coefficients of the similar terms together ok then it collapses to a very simple formula alpha not equal to 0 alpha 1 is equal to 1 beta minus 1 is equal to one third beta not is equal to one third and beta 1 is equal to minus half. If I substitute and rearrange ok I get this I would call this computable form is everyone with me on this what I am doing see I am fitting a local interpolation polynomial local interpolation polynomial has been constructed using these values x n x n minus 1 f n f n minus 1 f n plus 1 ok. I found the polynomial I substituted tau is equal to h which gives me x n plus 1 ok and I am just rearranging and writing in a form which is more convenient for programming ok which is more convenient for programming there is nothing wrong if you maintain this complex form ok nothing wrong fundamentally nothing wrong if you maintain this complex form and every time substitute and find out what you are going to get ultimately is same as this ok. In fact all this time varying coefficients seems to do not show up when we write it like this it appears that x n plus 1 is some linear combination of x n and past x values f n plus 1 f n and past derivative values all that is appearing is current past and future derivative value and current and past x values ok. So my final form is going to always whichever you know if I fit a seventh order polynomial eighth order polynomial tenth order polynomial my final form will look something like this x n x n minus 1 may be I have to take x n minus 2 x n minus 3 f n minus 1 f n minus 2 because I need to estimate all those coefficients. So I need so many other equations. So my final form is going to look always like this ok can I work with this form directly instead of doing this complex interpolation polynomial derivations ok that simplifies the derivation unfortunately when you do it that way it sometimes you know the polynomial form does not become visible you just see this but when you derive the formula what you are actually doing is fitting an interpolation polynomial locally using either derivatives or x values ok. Now let us derive a generic expression for fitting any mth order polynomial ok and then we will look at what is this just before we go ahead what is this particular equation is this an explicit or implicit formulation it is an implicit formulation because f n plus 1 appears on the right hand side which is function of x n plus 1. So to solve this you have to do iterations and solve it iteratively ok ok let us move on to more general formulations ok. So I can generalize what we have got I can say that whenever I am going to derive a multi step method in fact if you write it in this form the word multi step becomes more clear why we are calling it multi step method. I can write a general formula for a multi step method which is alpha not x n plus alpha 1 x n minus 1 alpha p x n minus p plus h times beta minus 1 f n plus 1 plus beta 0 f n I can write a general formula for multi step method ok which is linear combination of linear combination of x n x n minus 1 x n minus 2 x n minus 3 whatever up to p steps in the past and f n plus 1 f n f n f n minus 1 up to p derivatives in the past ok. So we are finding out the new value not just using local derivative we are basing our information based on past derivatives we are basing our information on past x values ok. So the new value is constructed using some kind of local past information ok how much you want to go in past how many steps in the past ok we will decide well the accuracy of the method and so on ok. Now how do you come up with a formula that will how do you estimate how do you estimate these coefficients what are the unknowns here let us list the unknowns unknowns are alpha 0 alpha 1 to alpha p beta minus 1 beta 0 beta p how many unknowns are there 2 p plus 2 p plus 3 unknowns are there right 2 p plus 3 unknowns are there. So we need to solve this we somehow have to construct 2 p plus 3 equations and ok. Now in a more compact form I am going to write x n plus 1 is equal to summation i going from 0 to p alpha i x n minus i plus summation i going from minus 1 to p beta i f n minus i. In fact when I write it like this this minus 1 beta minus 1 unusual notation will become clear why I am using beta minus 1 this is the compact way of expressing the same thing. What I need to do is of course I am going to fit a local polynomial ok my polynomial is going to be x n t let us work with shifted time scale such that tau is 0 and the same idea which we have done earlier ok. So my local polynomial is going to be a naught n plus let us consider mth order polynomial in general ok let me consider mth order polynomial and p step method ok I want to generalize this which I can write as summation j going from 0 to 0 to m a j n t to the power j right this is a j n n is only for the local coefficient and this is my what is f tau what is f tau f tau will be summation j going from j going from 1 because initial term will be 0 d by dt of this will be 0. So j going from 1 to m ok it will be j times a j n t to the power j minus 1 t to the power j minus 1 is everyone with me on this or tau yes this should be tau yeah it should be the shifted time scale tau. So where our tau is just to remind you tau is t minus tn ok. So these are my this is my f tau this is my x tau ok. Now using our notation ok let us write general expression what is xn plus 1 xn plus 1 this will be a naught n plus a 1 n times h up to a this is xn plus 1 what is xn minus i i times in the past how will you write this it will be i h time will be i h rather minus i h time will be minus i h ok. So I am going to write this as j going from 0 to n j going from 0 to n ok a j n minus i h raise to j fine I am just substituting for I am just substituting for ith instant in the past j going to 0 to m j going to 0 to m not to n j going to 0 to m ok. Now this I can do for i is equal to 0 1 up to p I can write this equation for each I can write this equation for each you know xn xn minus 1 xn minus 2 xn minus 3 up to xn minus p. So how many such equations are there p plus 1 equations are there ok. Then what about f fn minus i we just use that expression summation j going from minus 1 to minus 1 to m summation j going from minus 1 to m ok j times j equal to sorry j is equal to 1 to m p is minus 1 to p goes from sorry i goes from minus 1 to i goes from minus 1 means f n plus 1 ok fn plus 1 if I put i is equal to minus 1 I get fn plus 1 I put i is equal to 0 I will get fn I get i is equal to 1 I will get fn minus 1 ok because we are taking derivative at current point next point and previous point and so on. How many of these equations are there p plus 2 ok I have p plus 2 equations and yeah ok. So what I am going to do now is I am just going to substitute these expressions I am going to substitute these expressions xn minus i fn minus i these summation expressions ok I am going to substitute them here ok I am going to substitute them here ok and then I am going to substitute this expression here first one on the right side this will be on the right side these expressions will be substituted here xn minus i fn minus i ok there is one small correction this expression here has h times is an h which I forgot to write when I wrote the generic expression there is a iteration interval h will come here. So this is h times summation i going from minus 1 to p beta i ok I am just substituting this here after that what I am going to do is on the right hand side we just now this looks very complex expression right. But we way we are going to simplify this is like this see look on the left hand side you have h x square h cube up to h to the power m I have h to the power m ok on the right hand side also you will get if you look carefully you will get maximum power of h will be h to the power m ok you will have h to the power 0 h to power 1 h to power 2 h to the power 3 ok. So what I am going to do now ok I am going to arrange this rearrange this in between step I am just leaving it for you to do the algebra I will just explain this qualitatively I am going to explain I am going to rewrite this complex right hand side as something plus something into h plus something into h square up to ok I can do this because there are terms on the left hand side and right hand side which do not exceed h to power h to power m ok. So I can take all the terms together ok and then then if I want to get this equation for any h what should happen I should match the coefficients ok. So the first 0th coefficient should be matched with the 0th coefficient here and so on ok if I do that business of matching the coefficients ok I get following set of equations if I just equate the coefficients ok one by one I get this how many equations I am expected to get m plus 1 equations because how many see we have put mth order polynomial ok. So I have m plus 1 I have m plus 1 how many equations I get here these are m plus 1 equations right how many variables I have 2p plus 3 ok number of constraints I got is m plus 1 ok number of constraints number of constraints is m plus 1 ok and 2p plus 3 corresponds to number of 2p plus 3 2p plus 3 corresponds to the number of total number of variables what are the variables alpha 0 alpha 1 alpha p and beta minus 1 beta 0 beta 1 to beta p these are the variables and these are the equations that relate them ok by taking a general multi step method these are the equations that relate them. So this is these are called as exactness constraints. So well what you can guess is that you should have number of equations at least equal to number of unknowns if number of unknowns is more not a problem you can fix some of them arbitrarily ok if the number of unknowns are more than the number of equations you have to choose some arbitrarily ok and but at least to get some tangible solution you should have this equal to this ok. So I can generally give a condition to get a solution we should have m plus 1 should be less than or equal to 2p plus 3 if number of unknowns is more we can fix some of them arbitrarily can set something to 0 or whatever ok otherwise they should be equal this can be greater or this can be equal and what is the condition for equality to hold ok if you want equality to hold then m plus 1 should be 2p plus 3 ok or order should be the polynomial order should be chosen ok if you want a p step method ok and if you want to get exact number of constraints the polynomial order should be chosen suppose I want one step method if p is equal to 1 ok then m should be m should be 4 and so on. So this gives you a way of calculating what is the order of polynomial that you need to fit ok. So this is a generic derivation of multi step methods now there are different classes of multi step methods which are popular in the literature ok. We will just have a look at them one class of algorithms are called as Adams Bashforth multi step algorithms ok. So this is a class of algorithms ok. You choose parameters in a particular way ok and together with the exactness constraints we arrive at the polynomial coefficients and then get one method of integration ok. First of all you should realize that what we have derived now is not one integration method ok what we have derived is a way of arriving at integration methods choosing different number of different p ok will give you one particular method ok. If you choose 5 steps in the past you will get one particular method there is no unique way of getting those coefficients ok. So there are enough number of enough degrees of freedom so that you can have one method by each one can have one method by his own name if you choose to have that ok. So some of these are popular methods which are used in the literature I will just list them but it is not that this is the only way to come up with the multi step methods. So in this Adams Bashforth explicit methods in this methods we only use derivatives we do not use x except one particular x. So we choose alpha 0 is equal to 1, alpha 1 is equal to alpha 2 equal to alpha p is equal to 0 ok. In Adams Bashforth method we are not going to use past x values we are going to use past only function values ok. And these are this is an explicit method which means beta minus 1 is equal to 0 ok I am not going to use the future derivative ok. So if you put these constraints together with the earlier constraints how many constraints are here now p plus this will fall out we can we can right now we can right now because the first equation will give you this alpha 0 is equal to 1 because your summation you know first equation is summation alpha I from 0 to p is 1. So the constraints that you have here are p plus 1 additional constraints. So total number of constraints m plus 1 original constraints we have which I wrote right for j going from 0 to m plus these additional p plus 1 constraints. So this is m plus p plus 2 and total number of variables is. So we also impose one more constraint here that p is equal to m minus 1 this will fall out actually p is equal to m minus 1. If you put p is equal to m minus 1 ok you will get total number of equations and total number of constraints. And then you know you can set up those equations for Adams Bashforth and then finally the algorithm will look like this x n plus 1 is equal to x n plus h times beta 0 f n plus ok. Finally you will get beta 0 beta 1 beta 2 beta 3 for a p th order method if you if you some of the books will list these coefficients ok or you can derive them by setting up the constraints I have given here the equation you get a linear algebraic equation ok in 2 plus m variables in 2 plus m 2 m 2 m plus 1 variables in 2 m plus 1 unknowns you can solve them together and then you can get the these coefficients. These coefficients will be listed in any one of the books. Likewise we will talk about implicit methods those implicit methods are called Adams molten methods those are implicit methods ok. And then implicit method will be one which requires x n plus 1 in the future to be estimated. So, what you do is you know you tie them up when you are solving the implicit method you use an explicit method to get the initial guess and then solve the implicit method iterative ok. So, that is why it is called prediction correction methods also. You do a prediction using explicit method use the prediction in the implicit method as initial guess and do a correction ok we will come to this idea next class. There is another class of methods called Gears method Gears method are the one in which you do not use past function values you use past x values and only one function value. Those class of methods are called as Gears method these class of methods are called as Adams molten Adams Bashforth and so on ok. So, we will look at these classes which are popular classes and then we will move on to the next method.