[MUSIC] Welcome again to this third week of the course on simulation and modeling of natural processes. In this module, I will talk to you about how to, we really use to compute solutions of our dynamical systems. So let's imagine you have a dynamical system which is given in a continuous form. So we have our state variable which is the time derivative of s, which is equal to f(s,t). First, a small remark, we saw in the first module that this is a bit redundant notation. I keep here the explicit dependence on t to simplify a bit the concepts that I will introduce. So we have our dynamical system that is given by this differential equation, and we want to compute St of t for t ranging from t zero to tf. And we also have to impose some initial condition which is that when t is equal to t zero, s is equal to s zero. Okay, so usually there differential equations are difficult to solve analytically. So we need a way to solve them numerically, and one of the ways you can do this is on a computer. So as an example, I will pick probably a not very difficult example because it is an example where there exists an analytical solution so we don't need actually to compute this solution numerically. But it is a good way to introduce the concept. So the idea is that what we want to do is to take the growth of a population example with a target capacity C. And what we want to do is that given an initial condition s is zero we will be able to reproduce one of the curves here. Either the red one or the blue one. It's depending on the initial condition we'll try to reproduce any of these curves. How should we proceed? So, first, the idea is to say, okay, we have an initial solution which is S zero, initial condition. What will be the value of S close to these t0? So we do a Taylor expansion of s. And so s(t0 + delta t), where delta t is small, is equal to s(t0) + delta t times the derivative of s at Position t0, plus an error return. Keep in mind this error return, cuz we'll talk about it later. For now, let's just drop it. And basically we can evaluate our function close to t0, to a position t1, which is equal to t0 plus delta t. Which is equal to s of t zero, plus delta t times f. So, what you see here is that we replaced the time derivative of s with f of s and t0. Why is that? Actually, it stems from the definition of our differential equation. You remember that s dot is equal to f(s,t), so it is perfectly normal assumption to simply replace the time derivative of s at position t0 by f(s,t0). So we can iteratively, now construct a scheme to get S of T at any discrete time TN. So here, as we see on the formula we've simply generalized the last formula and we get a S(tn+1) = s(tn) + delta t times f(s,tn). And the notation adopted here is that tn+1 is simply tn + delta t. So the first remark here is that, remarkably not this is simply the definition of discrete dynamical system more or less. That we saw in the first slide, the first module, sorry, of the course. The second remark is that s of tn only depends on the state of the system the previous time step. So s of tn plus one only depends on the state at tn. So, this is called an explicit scheme. We will saw a different kind of scheme in later modules. So finally, this is a formula that is very easy to implement on a computer. Okay, so what is the result? Now we just used the scheme and took a particular initial condition and we tried to recover the growth of our population. So the black line here Is the analytical solution for the logistic function. In blue you have the approximation of this black line with a delta t which is equal to one. The green is with a delta t which is twice smaller, which is 0.5, and in red you have an even smaller delta t which is 0.2. So what you see is that as you decrease delta t, so delta t goes to 0, we are really approaching the black curve. So this is really what you want with a when you decrease the time increment you want to go closer and closer to the real solution of your differential equation. With this I end this first module on integration of ordinary differential equations. And in the next module, as promised, I will talk to you about what is the error you are doing when you numerically integrate these equations. Thank you for your attention. [MUSIC]