I. So this is a quick video to show you how to use psi pies solve IVP to solve a first-order ordinary differential equation. Ivp in this SWOT stands for Initial value problem. So these are classes of problem where we know all of the boundary conditions at 1 in time or space and we want to integrate away from that. So as usual, import matplotlib PLT function so that we can plot the results of this integration. We're going to import NumPy because we are going to be using arrays. And the function what we are going to be working with Stay solve IVP lives inside pies integrate package. We can have a quick look at this. We look at the help page, which comes up at the bottom here. And so we can see we've got survive VPs, the name. There are three functions that you must give it, which don't have default values, which are fun. T span and y is 0. Fun is a function which gives you the derivatives that you're wanting. Great, we'll look at that a bit more in a minute. T span is the start and end values for the integration with the start times of the end times are the start position and the end position. And y is 0 is the initial condition that we want to integrate waveform. And because we're looking at solving a first-order ODE, we only one initial condition to integrate away from all of these other arguments have default values, like the method. Our k 45 is the standard method for integrating first-order fringe bracing ODE's. And if you scroll down the other methods in here which you could choose to use this, okay, 23, the PDF, various things, but we don't need to worry about them or look at a couple of these are the outcomes a bit later on. The problem we're going to look at is how to solve the ODE where the derivative of y with respect to time is minus half y. And hopefully analytically you will quickly see that this is just exponential decay. Wherever boundary condition will calibrate, this value of a is going to decay form. We don't want to solve this analytically, we want so this computationally Today, we're going to use this using solve IVP, which we've got here. So we're going to just to be explicit, our function that we're going to integrate is going to be called exponential decay. T span. The initial and final values we've got here, and y is 0, the initial condition got here. You might wonder why when I've just said that we, we only need one initial condition to integrate away from first order ODE y. We have three different values here. When we solve this, we're actually going to integrate from three different initial conditions simultaneously and get the results for those three calves at the same time. We'll see what that looks like. For our first job is to define this function, exponential decay. So I'm gonna put death. If I differentiate it. And international decay. And this is a function of two things as a function of time variable and why it matters. The order that you put these four solve IVP, You have to put the thing that you're integrating over time first and the values that are kind of the results and things that are being updated the wise. Second, if you are looking at the surprise of the function, which is ODE, and these go the other way around. So it's important that you know what you're going to use solve IVP ODE. And because you put the time in the way, the opposite way round in this brackets here. Okay? And as I said, this has got to return the values of the derivatives of the derivatives are just minus half y. So in here we can just put minus 0.5 times y. We need to put the times m because this is now computer speech rather than math. Okay? So we've defined that and I'm going to run that memory and let's solve it and see what we get. So I've printed out the solution. I've saved the results as soul and I've printed out here. You can see it gives us a reasonably informative message. It says the solver has successfully reached the end of the integration. So that's good. We can see on this row here the values of t, This is chosen to evaluate y at the solver is intelligent so it can choose to. What's a sensible steps to output out. And you can see when we look at the values of y here, that we've got three different rows now array where each one corresponds to a different initial condition. We can see this one starts at two, which was the initial condition here. This one starts at four, which was the initial condition here. And this one starts at eight, which was the initial condition here. We've actually got three results in this solution. So let's have a look at these without plt.plot. So t can, so why? Let's look at the first, first. Well, and you can see we've got this curve, which is a bit like exponential decay, but we've only got one and maybe it'll be nice to share all of our results. We can do that by modifying this to include an iterator. So we can just do for Y in sold or wise. This is going to iterate over each of these rows in here and call them y. So here we now get three cubes which I need to indent. We can see we've got our three solution starting at 248. But the other thing you'll notice that this is exponential decay, which we know is smooth and we can see that this is quite jerky. The reason it's jerky is because it's only saving the solutions at these integration points. So maybe we don't want it to be a jerk. Remember we want to have some finer resolution in here. So to do that, I'm just going to copy function again. And if we look back at the help page, we can see we've got this, this argument here, T eval. And if we scroll down and look at what T eval is, sativa is the times at which to store the computed solution. It must lie within the range of T spans. That's fine. And if it is known, which is the default, it will use the point selected by the solver. But we want to change this. We don't want it to use the point selected by the solver. So we need to add an array-like object in here. So we're just going to add a row in here, which gives us T equals np dot. It's gotta be ray-like chairman to a range. Then we're gonna go from 0 to ten in steps of 0.1 when that gene C. Now we've got the values output is at each of those steps. And we can see that we've got a lot more values of y in here. So this is looking hopeful, solutions look smoother. If I just take this down here. Can now see that we've got three smooth curves rather than those jerky cows and we've integrated this and this looks like exponential decay. So that's it for this video. Thanks.