CHAPTER 08.05: HIGHER ORDER AND COUPLED DIFF Eq EULER METHOD: Part 1 of 2      In this segment we are going to talk about higher order ordinary differential equations and we're going to take an example and see that how can we use Euler's Method to be able to solve this higher order ordinary differential equation. As you know, Euler's Method is used for, only for solving first order ordinary differential equations. So if somebody gives you a higher order ordinary differential equation or a coupled ordinary differential equation, you do have to reduce them to simultaneous first order ordinary differential equations to be able to solve them. So we will go through that process here also. So let's suppose somebody says hey, go ahead and solve this differential equation which is a second order differential equation and wants you to solve it so they can find y as a function of x. You are given the initial conditions that the value of y at zero is 7 and the value of the first derivative of y at 0 is 13. And you are asked to find out, hey, go ahead and find out what y at 0.5 is when you are given that the value of the step size is 0.25. So what that means is that we do need to conduct two steps to be able to find out what the approximate value of y at 0.5 is because the first step will take us from 0 to 0.25 and the next step will take us from 0.25 to 0.5. But still, we have a second order differential equation so it's not in the form which we would be able to use Euler's Method. So what we have to do is, we have to do the substitution of dy/dx equal to, let's suppose, z. So let, dy/dx=z. Then I know that the second derivative of y with respect to x can be defined as dz/dx. And what we are going to do is, we are going to use that to be able to reduce this to coupled first order differential equations, then be able to use Euler's Method to be able to solve the problem. So what that becomes is 2(dz/dx) + 3z + 5y = 11e^-x 2(dz/dx) + 3z + 5y = 11e^-x So that turns out to be the first order ordinary differential equation and I can just rewrite this: dz/dx=(11e^-x - 3z -5y)/2 dz/dx=(11e^-x - 3z -5y)/2 And of course there should be a corresponding initial condition to that and that will be z(0)=13. The way I get this is because the first derivative of y with respect to x at 0 is 13. So since we defined our dy/dx to be z, so that means that z(0) is 13. And the second differential equation which is coupled with this one would be dy/dx=z. dy/dx=z, and this would be y(0)=7. That's what we have. So if I consider that hey this is the, this is the first differential equation, this is the second differential equation, then I need to go ahead and use now the Euler's Method to be able to solve this problem. So what that means is that this is f1(x,y,z) because now your right hand side is not just a function of x and y but x, y and z, where x is the independent variable and y and z are the dependent variables. z is introduced by us which is related to y by, z is the derivative of y and this one will be the second function, f2. So you have to be sure that you do make this demarcation between the two that, these are two seperate functions. They are not the same f as you would use when you are solving one single first order differential equation. And this will be also, this is also a function of x, y and z and what that particular function is, is right here. So what I'm going to do is I am going to use Euler's Method now. So if I use Euler's Method on the first differential equation that will be written as this: y_(i+1)=y_(i) + f1(xi, yi, zi)*h and then the second one will turn out to be hey, z_(i+1)=z_(i) + f2(xi, yi, zi)*h So what that means is that we'll have to go ahead and find out our y, then our z, then we keep on going back, keep on going through this process to be able to go from one step to another. You cannot solve one with the other because you need the corresponding value of z from here. So if you are using, if you just say hey, I am going to just use this equation to calculate y because that is what I am interested in, you won't be able to go too far because you will need the next value of z to be able to calculate the value of y. So let's go and see that, we take two steps, which we said that hey, we need in order to go from, we need to go from 0 to 0.25 to 0.5 on the x domain, that's what we need to do. So we need to take the two steps of Euler's Method to be able to do this. So if i=0, I will get y1=y0 + f1(x0, y0, z0)*h What is y0? y0 is, so let me write this down. If i=0, I know that x0=0 because that is the initial value of x. The initial value of y, which is y0=7, and the initial value of z, which is z(0) or dy/dx(0)=13. So this gives us all the information which we need and then of course we have to know what those functions f1 and f2 are. So, f0 is 7, plus f1 times the value of the function at x0 is 0, y0 is 7, z0 is 13 times h which is 0.25. So this gives you 7 plus, what is f1? f1 is nothing but z, so f1 is z so that is just 13 because f1 is just equal to z, so 13(0.25) and this value here [7 + 13*0.25] turns out to be equal to 10.25. That's what I get as the value of y1. Now before I start calculating y2 I need to calculate z1 because that's what I will need in the next step. z1=z0 + f2(x0, y0, z0), so it is f2, not f1 because that's the corresponding function which you have to use for the slope and the arguments are the same, of course. So z0, the initial value of z0 is 13 and then we have to calculate the value of the funtion f2 at x=0,y=7, z=13 and h is 0.25. So that's 13, and what is the value of the function f2 at the values of x=0, y=7, z=13? It is [(11^e-x - 3z -5y)/2]*0.25 [(11^e-x - 3z -5y)/2]*0.25. And this value turns [13 + (11e^(-0) - 3*13 - 5*7)/2]*0.25 out to be 13 + (-31.5)*0.25. And this value here turns out to be then equal to 5.125. So we should understand what the intermediate numbers are now. y1 which is 10.25 is nothing but the approximate value of y at 0.25 because it is at a step ahead and this nothing but the approximate value of z at 0.25 which is the value of dy/dx at 0.25. So, but these are intermediate value of y and z which you are getting so we do need to understand even what these f1 and f2 are. So if you look at the f1 value which is 13 here, it is simply the value of dy/dx=z, that is the approximate value of the slope at x=0 and f2, which is -31.5 here is actually the second derivative of y with respect to x at x=0 becaue that is f2. f2 is nothing but dz/dx and dz/dx is nothing but the second derivative of y with respect to x. So all these intermediate values do need to be known, do need to be known to see that hey, how can we find out what the values are and what they really mean. But this is not where we want to stop because we want to find the value of y at 0.5.