Watch these five (5) videos in order. The total video time is 29 min. Be sure to test your knowledge with the knowledge checks after each video.
Description: This video introduces ordinary differential equations and their importance in the engineering realm.
Hello. This is video ODE|VL|01 and it is an introduction to solving ordinary differential equations.
Let's do a brief introduction about ordinary differential equations. Many engineering problems are described through differential equations as it is often easiest to describe some function with respect to time, position, etc. There are a small subset of systems that can be simplified and solved analytically. For example, the Ergun or Bernoulli's equations. Let's look at the Ergun equation here that describes how the pressure, P, is changing along a packed tube of length z. The variables on the right-hand side of the equation help describe the fluid and particles in the system. For example, the viscosity µ and the particle diameter DP. If all the variables on the right-hand side can be assumed to be constant, then this equation simplifies considerably to be ∆P is equal to lots of constants times ∆z. However, the majority of systems are more complex and must be solved numerically.
Let's look at a simple differential equation. We have dy/dx, which means how y changes with respect to x is equal to 9x2 +2x+1. In this case, y is the dependent variable and x is the independent variable. The equation given is only dependent of the independent variable x. Here's another example. We have dy/dx is equal to sin(x) +sin(y). In this case, the equation is based off of both the independent and dependent variables. Finally, let's look at this one. We have dz/dt is equal to 4(1-e^(-z2)). In this case here, the equation is only based off of the dependent variable. This module only focuses on ordinary differential equations. Ordinary differential equations or ODEs can be described as a 2D graph and their behavior can be easily visualized, will need boundary conditions, which will be discussed later. And they're relatively easy to solve. In order differential equation has one independent variable. For example, in this one given here, dX/dV, which represents the conversion in the reactor with respect to its volume, is equal to k open bracket one minus X, all divided by FA0, which is the initial flow rate of species A. Notice here there's only one independent variable which is V. A partial differential equation, however, has at least two independent variables. In this case here we have 4(∂u/∂x)-3(∂u/∂y)=-1. So we're looking to see how the variable u changes with respect to x as well as respect to y. The focus for this work and this module will be for ordinary differential equations only.
Let's revisit our equation. dy/dx = 9x2 +2x+1. This is actually relatively easy to solve. This is a polynomial and we can solve it to be equal to y = 3x3 -x2 +x +C. C here is a constant and we need to know initial values to be able to solve this for one specific set. If not, we'd have an infinite number of different solutions, as shown by this graph here. If we had initial values for this problem, if x is equal to 0 and y 0 is equal to one, then what we'll have is one unique solution, or you'll see here is that when x0 = 0 and y0 = 1 for our solution. This is referred to as an initial value problem, or IVP, which needs some kind of initial value. We can also have boundary value problems where instead of being x = 0, we have x is equal to some value, for example L being the length of a reactor.
Finally, for this module, one thing to note is that we will say the function f(x,y) is equal to the slopes that we're looking for, so dy/dx. So if the notation is f(x,y) is representing slopes for this module.
This concludes the video. This project could not have been completed without the support of eCampusOntario and the University of Ottawa.
Description: This video discusses the simple 1st order Euler’s Method for solving ODE problems.
Hello. This is video ODE|VL|02, and it's the theory of Euler's method for solving ordinary differential equations.
Let's first look at the general theory of Euler's method. So as a reminder, our ODE is represented by dy/dx, which is the change in y with respect to x. And the other notation that we use that as equivalent as f(x,y). If dy/dx is our slope. Then we can find our slope between two points, i and i+1 as (yi+1 - yi)/(xi+1 - xi). If we rearrange this relationship to find for yi+1, we get yi+1 = yi +f(xi,yi)h. And this is Euler's equation. h here is the distance between the points xi and xi+1. And this is also called the step size. Another notation that we can use for this function of f(x,y) = k1. This can shorten the equation to yi+1 = yi +hk1. The k here represents the slope. Multiplying k by h will convert it into a y-value and adding it to yi will give you the new yi+1. Once this is calculated, we can take a step of h for the value of x and continue the same process with new values of x and y until we reach some point that we'd like to stop.
Let's look at this graphically. Let's say we have some function represented by the orange line here and we want to go from xi to xi + h. We know the slope at xi, which is equivalent to k1. What we're doing with Euler's method is we're assuming that that slope is constant between xi to xi + h. We can draw a straight line from k1, from xi all the way to xi + h. What you'll notice is that in this case for Euler's method, it's not close to the true answer. And so what you'll have to do is actually take smaller steps of h to be able to get a better answer. Let's look at that step size a bit more. We have our function f(x,y) = (10ex - 3y)/(1 + 3x). That's shown graphically here in the orange line. Let's say we're using Euler's method and we take a step size of h. What you'll notice here, is that the answer is quite off with that step size. Let's say we take twice as many points, so we'll divide h by 2. You'll notice that our answer is going to get closer to the true answer that we need. If we divide those points by two again, to take twice as many, that is equivalent to an h/4, we would get closer to the answer as well but we're not quite there. So Euler's method is a great method, a simple method to use, but it's very susceptible to the steps that you take. And typically you need to take a very small stepsize to get a very accurate answer.
This concludes the video. This project could not have been completed without the support of eCampusOntario and the University of Ottawa.
Description: This video implements the theory of Euler’s Method in a practice problem in a step-by-step approach.
Hello. This is video ODE|VL|03 and it is as a step-by-step example of using Euler's method to solve an ordinary differential equation.
First, let's look at the problem. Solve the following problem with Euler's method and the following conditions. We have our initial conditions, x0 = 0, y0 = 1, h, our stepsize is equal to 0.5 and xf, the final value we want to get to is equal to 1.5. The equation is dy/dx =xcox(x)/(1-ey). So as a reminder, we have f(x,y) is equal to our derivative, which is xcos(x)/(1 - ey). In the bottom left corner, we have a table that we'll use to do our iterations. We have four columns, i for iterations, x, y, and k1, representing our slope. k1 is equal to, of course, f(x,y). To get an estimate of y, we'll have yi+1 = yi +hk1. Then we also can step in our x, which would be xi+1 = xi + h. The initial values are in our iteration 0. So we know that our initial value is 0 and 1 and we can take those two values and plug it into our equation to calculate k1, which in this case is actually equal to 0. Now that we have that value, we can adjust. So we can go to the next iteration. And we will get x = 0.5 and y = 1. We can now calculate our k1 again to get -0.2554. Then we can use these values to calculate our next iteration, so x = 1 and y = 0.8723. We can calculate our k value one more time to get a value of -0.388. And we can get to our last iteration when we stop at x 1.5 and get our final value of y as well, which is 0.6783. If we were to graph this, this is how it will look. So the orange line here is the true answer. And our blue line are our steps that we took from 0 to 0.5 to 1 to 1.5. And what you'll notice is Euler's method was not entirely accurate for where we want it to be. In order to improve this, we'd have to take more steps to get where we wanted to be.
This concludes the video. This project could not have been completed without the support of eCampusOntario and the University of Ottawa.
Description: This video discusses improvements over Euler’s method using predictor-corrector methods such as the second order Midpoint, Heun’s and Ralston methods.
Hello, this is video ODE|VL|04 and it is the theory of second-order methods for solving ordinary differential equations.
Let's first look at the general theory of the second-order methods. In a previous video, we discussed Euler's method. Some instances where there's a large enough step size of h, Euler’s method does not provide an accurate answer the solution. Second order methods operate as a predictor-corrector methods where they estimate the slope at two different points. For example, here, we have k1, which was the estimate of the slope at xi+1. And it gave an answer that was not accurate at all. What if we took the answer to there and it took a slope at that point. So we took a slope there and we average the two together of k1 and k2. We might get a better estimate and that's where that black line comes in and that's where we estimate our next answer. The slope of that black line is equal to k1 + k2 divided by two. That is essentially Heuns method.
Heun’s method uses two estimates of the slope, k1 and k2 to determine an average slope at which to take the step. k1is the slope that is from Euler's method as k1 = f(xi,yi). What you do is you'd find k2 at that step size of h. So k2 is equal to f(xi +h so we're doing that step, yi + k1*h). So as a reminder k1*h will give you a y-value and it'll be where that point is situated in the graph. Then what we do is we take an average of the points. So yi+1 = yi +h(k1/2 + k2/2) or the average. What we can do here is you can see from the long black line, we get a pretty close estimate to the answer with Heun’s method.
Another second-order method is the Midpoint method that also uses 2 k-values. The first value k1, is equal to f(xi,yi), but in this case here, we're going to go only to xi +h/2 to find our k2. k2 = f(xi + h/2, yi + k1h/2) as well. What we do there is we find the slope at that point. Then we're going to assume that that is the best estimate of our slope from yi+1will equal to yi ≠hk2. And so what you'll notice is the slope at k2 is equal to the same slope as the arrow, the long arrow, our shown here to get an estimate at xi + h. And it's pretty close to the true answer.
The final second order method that we'll look at is Ralston’s method that also uses 2 k-values. The first value as before is k1 = f(xi,yi). However, in this case here we're going to go three-quarters of the way of h. So k2 = f(xi + 3h/4, yi+ 3k1h/4), and then we'll take a weighted average between k1 and k2 to find another estimate of our best slope, which will give us yi+1 = yi + h(k1/3 + 2k2/3). So there's twice the weight on the second slope compared to the first.
Let's revisit the same problem from Euler's method. That is, f(x,y) = (10ex – 3y)/(1+3x). The orange line here is the true answer. Using Euler's method with a step size of h, we did not get a very accurate answer if we use the same step size, but in this case here apply Heun’s method, our answer is relatively close for some points at the beginning but starts to veer off. In this case here, if we use Midpoint method with the same stepsize of h, we're actually quite close to the true answer. And Ralston’s method also gives you a more accurate answer, right? From here you can see that the second-order methods perform better with a similar stepsize compared to Euler's method.
This concludes the video. This project could not have been completed without the support of eCampusOntario and the University of Ottawa.
Description: This video implements the 2nd order ODE solvers to solve a problem in a step-by-step procedure.
Hello, this is video ODE|VL|05 and it is a step-by-step example of using second-order methods for solving ordinary differential equations.
First, let us look at the problem. Solve the following problem with Heun’s, Midpoint and Ralston’s method for the following conditions. We have the initial conditions x0 = 0 and y0 = 1. For a step size of h is equal to 0.5 and a final value xf = 1.5. The function is dy/dx = xcos(x)/(1-ey). Let's first start with Heun’s method. We have our function f(x,y) = xcos(x)/(1-ey). At the bottom left corner we have five columns that will represent the iterations that we're doing. The first column is i for iteration the x, y, k1 and k2. K1 and k2 are the estimates of slopes where k1 = f(xi,yi) and k2 = f(xi + h, yi +hk1). And with the slopes, we can get an estimate of yi+1, which is equal to yi + h(k1/2 + k2/2). We can also take our step in the x-direction, which is xi+1 = xi + h. Let's look at our initial conditions of x = 0 and y = 1. We can use our k1 equation to find the value of k1, which in this case here it goes 0. Then we can now apply our k2 equation to find k2is equal to -0.2554. Now we can take a step defined at x = 0.5, y = 0.9362 and we can repeat process again to find k1, which is equal to -0.2831. Then we can find k2, which is - 0.4452. We can find our next value at x = 1, which will give us y = 0.7541. You can calculate another k1 value as -0.48 and a k2 value of -0.1579. And we can take one final step here to find at x = 1.5 or, the stopping point, that y will equal to 0.5946. If we look at the graph of this function, you'll notice that the Heun’s method works well for the first at 0.5 and it deviates slightly as it continues on through its steps.
Let's look at the Midpoint method. Midpoint method again, we'll use the same function f(x,y) and have the same size of integration table as Heun’s method, where we will still calculate a k1 and k2. In this case, k1 will be equal to f(xi,yi), which is the same as Heun’s method, but k2 will be calculated as f(xi + h/2, yi+ k1h/2). We can then estimate our next value for y at yi+1 = yi + hk2 and we can find an x value of xi+1 = xi + h. Let's look at our initial conditions of x = 0 and y = 1. With that, we can calculate our k1 value, which will still be 0. Then we can calculate our k2 value as -0.1410. We can then calculate our next value at x = 0.5, which will give us a y = 0.9295. And we can repeat the process again by calculating the k1 value of -0.2862 and our k2 value of -0.4040. We can go to our next iteration to find our value of x = 1 and y = 0.7275. We can calculate k1 value again, then our k2. And now we can find our final step at x = 1.5, which will give us an answer of y = 0.4885. If we look at this in terms of the graph, you'll notice that the midpoint method in this case to the relatively good job estimating the true answer, which is the orange line.
Let's finish this with Ralston’s method. Ralston’s will use the same function f(x,y) and will also have the same iteration table with k1 and k2 values. k1 in this case will be calculated just as before, which is equal to f(xi,yi), and k2 will equal to (xi + 3h/4, yi+ 3hk1/4). The next value of yi+1 will equal to yi + h(k1/3 +2k2/3). And the next value of x will be xi+1 = xi+h. Let's start with our initial values again of x = 0 and y = 1. So we can calculate our k1 pretty easily, which will still be 0 for the first iteration. Our k2 in this case will be -0.2031. Now we can update our values of x and y and calculate our k1 and k2 again. We can repeat the process another time to get a new value of x and y. That will give us another value of k1, k2. Then we're finally at the last iteration for this case to find our x = 1.5 and our y in this case is equal to 0.5363. If we look at this graphically, we will get an answer like this, which Ralston also gave a relatively good answer to compare to what it was. But in this case here, Midpoint method was the best one. Overall, the second-order methods should perform similarly since they are of the same order.
This concludes the video. This project could have been completed without the support of IIT campus Ontario and the University of Ottawa.