[BLANK_AUDIO]. Welcome back. We are now onto the third and final lecture on mathematical modeling, with partial differential equations or PDEs. What we're going to discuss in this last lecture is some practical issues that are involved in, in solving PDEs. This was mentioned early on when, when PDEs were first introduced the Huxley Model for propagating action potential, but as is true with solving ODEs, it is also true that with solving PDEs you have to convert the derivatives into discrete form. But there's going to be a, a twist here, there's going to be a, a, an important conceptual point that we need to make, which is the difference between explicit solutions versus implicit solutions. And we're not going to get into all the, all the details of, of the algorithms. I feel like the algorithms that are involved in solving partial differential equations are, are more appropriate for, for another class. But, I do think, conceptually it's important to understand what, what an explicit solution is and how that is fundamentally different from implicit solutions and so this lecturer is going to focus on this last part here. The difference between that the two, which relates to the previous point, what you do when you convert whatever it is into its discrete form. Here, once again, is a one dimensional cable equation that we've encountered several times now. Membrane capacitance times partial derivative of a voltage with respect to time, is equal to some constants times the second derivative of voltage with respect to location, minus the ionic current. And what we want to address in this last lecture, is. What do you need to take into consideration and you want to solve this a type of differential equation practice. And we need to solve a partial differential equations such as this partial differential equation that we see here. As we've discussed the first thing we need to do is we need to convert the derivatives into discrete forms. Converting the time derivative into discrete forms we've already discussed. Partial derivative of voltage with respect to time evaluated at node j and evaluated at time t is approximately equal to voltage j at future time t plus delta t minus voltage at node j the current time t divided by the time step delta t. And then what about for the second derivative of voltage with respect to x, with respect to the location? If we evaluate that at node j, we've all, also discussed this approximation here. So it's approximately equal to voltage of j plus 1, minus 2 times voltage at j plus voltage j minus 1 divided by delta x squared. But you notice here that we didn't specify what kind that we are evaluation this second derivative of that, we have two types we can choose from [UNKNOWN] choose time t or t plus delta t and so that's what we have to address next. Next what we have to address is when do we evaluate this spatial derivative. I wrote this in a very generate form here I purposefully left off. With time we are evaluating the second derivative at, and depending on when we evaluate the second derivative, that's going to dictate what kind of solution to our partial differential equations that we're going to try to obtain. And this is how we end up with this distinction between explicit solutions versus implicit solutions to partial differential equations. It's this issue of when do we evaluate. Of the derivative with respect to location. So, for explicit solutions, what you do is you solve for the future value of voltage based on the current values of all your variables. So when you evaluate the second derivative with respect to location over here on the right-hand side of the equation, you see that this approximation is implemented at time t. So, these are all the current values of variables. Similarly, we have to compute the ionic current. We want to solve the cable equation. And we compute the ionic current at time t. So if with an explicit solution, what you do is evaluate your second derivative with respect to location at the current time, at time t. If we make the other choice in terms of when we evaluate the second derivative with respect to location. If we evaluate this at the future time, then we end up with an implicit solution. So, the difference between an explicit solution and an implicit solution, can be seen on this slide here, with an implicit we solve for the future values of voltage, based on future values of a variables. So what we've done in this case is we've evaluated a second derivative with respect to location at time t plus delta t. Similarly, we've calculated the ionic current at time t plus delta t, at the future value of time. So this is the fundamental difference between an explicit solution, like we see here, and an implicit solution, like we see here. What we're going to discuss next are some of the advantages and disadvantages, of one category of solution versus the other category of solution. There's a big advantage to explicit solutions, and that is that explicit solutions of PDEs are very simple to implement. We could take the equation that we had on a previous side for our explicit. When we explicitly looked at our approximations to our derivatives. And we can rearrange this with, you know, very simple algebra. So that everything that's in the future is on the left-hand side and everything that's in the present is on the right-hand side. And when we look in the future, we only have one variable that we need to calculate. What's the voltage at node J? At time t plus delta t. And we can calculate what this is. It's a function of all the stuff on the right-hand side, that's all at the current time, so these are all things that we know. And this gives us a relatively simple formula for how we compute how the voltage evolves. So in this case, we, you know, it's not just a voltage at node j, we also have similar equations for the voltage at node j plus 1,. Will J minus one ect. But conceptually this is not very complicated. This is just like an oilers message solution here. What we've basically done with this particular explicit solution is we've take our partial differential equation and we've converted this into a large system of ordinary differential equations. So when you. Take this approximation here for the second derivative of voltage with respect to location. What you're basically doing is simply saying, okay, instead of just solving, you know, one ODE for a single value of voltage, now if I have 50 nodes, I'm going to solve for 50 voltages, and now I'm going to convert that into 50 ODEs. So we just convert our PDE. Into a large system of ODEs. So this explicit solution has the advantage that it's very simple. Conceptually, this is really no different from what we looked at several lectures ago when we introduced Euler's method. But there's a big disadvantage with these explicit solutions, is that people who have done, you know, advanced numerical mathematics. And analyze these types of algorithms very rigorously. They've demonstrated, they've proven that for these sorts of solutions to be stable, your time step has to scale with your your voltage step squared. So let's say that you had a, a solution where you said okay, how much how much spatial discretization do I need? Do I need, is it okay to, to look at how things vary in space over like a, a millimeter scale? Well if you say a millimeter scale's okay, then you, you say well okay, actually a millimeter's not enough. I need to actually get a finer spacial resolution. I need to look at like a micrometer. Well a micrometer is a thousand times smaller than a millimeter. And so, your time step. If you went from a millimeter resolution to a micrometer resolution. Your time step would have to get 1000 times 1000, Or, in other words, a million times smaller. And this is the biggest disadvantage with explicit solutions of partial differential equations. Is that, in a lot of, cases of biological interest, where your spatial discretization has to be relatively relatively fine in order for you to see the details that you want to see, then you are, your time step has to get smaller and smaller and smaller. And therefore the explicit solutions can take a very long time to run. And the reason that explicit solutions of partial differential equations can take so long to run. It's because of this property here because the, the time step has to scale with, the spatial discrimination raised to the second power. So, every time, you know, when you write a partial differential equation, you might get a solution with a, with a very coarse spacial discrimination and you say to yourself, okay, I want that to be better. I want to have a more resolution, and when you get more resolution it comes at a great cost in terms of the computation time. And that's the biggest disadvantage of explicit solutions. Implicit solutions of PDEs, when we contrast them with explicit solutions of PDEs, have basically opposite strengths and weaknesses. One of the challenges of implicit solutions of PDEs is that they're conceptually more difficult to wrap your head around. Here we have a, a pure or complete implicit discreditation of our cable equation. Where we've evaluated our second derivative of voltage with respect to location at t plus delta t. And we are also computing the ionic current at t plus delta t. And if we think about this last part here, computing the ionic current, at t plus delta t. We can see how, how challenging this would be, because if you want to compute the ionic current at t plus delta t, then you need to know not just what the voltage is going to be in the future, but you also need to know what the m gate is going to be in the future, and the h gate. And the n gate, and sort of figuring out what those values are going to be at the next time stop.ho isn't easy, because those in turn are going to depend on voltage, so, everything depends on one another. Computing the ionic current in the future is, is a tremendous challenge. So, it's usually done in practice, is that the reaction term, this ionic current over here, this reaction current is created explicitly. What were evaluating the ionic current at time t. And then the diffusion term is often treated implicitly. So this shows you how implicit solutions of a P.D. is generally done in practice. From the diffusion term is evaluated in the future but then the reaction term over here or the ionic current is, is treated explicitly. But even if we make the simplification where we have, where we treat part of this implicitly and we treat part of this explicitly, this, we still have three unknowns in this equation here. We want to rearrange this particular equation here where we put all, everything that's in the future on the left-hand side and everything that's in the present on the right-hand side. We end up with this equation here. Where we have a bunch of consonants times the voltage and j plus 1. If no j plus 1, then times t plus delta t. Some other consonants here times the voltage and no j at t plus delta t. And then here we have voltage at j minus 1 and time t plus delta t. So we still have this voltage. And this voltage and this voltage that that are all unknowns, and we only have these two terms over here on the right hand side. So, we need to solve for this voltage and this voltage and this voltage simultaneously. We can't just make a very simple equation like we did for the explicit solution where we said. Future voltage depends on a lot of things that we know. We have to solve for all three, voltages at the same time. So to solve for the three unknown simultaneously, we're going to have to invert a matrix, and in the next slide i'll show you what we mean by that. If we wanted to to an implicit solution of the Hodgkin Huxley equation. We'd end up with a matrix equation that looks something like this. Where we have a vector here of all of our voltages from the first node up to the last node. We're only focusing on the ones that are in the middle, j minus 1, j plus1, and we would have. These terms here that are multiplying each of our voltages. So, the way that we do a matrix multiplication in which we discussed before, is you take this coefficient times this voltage plus this coefficient times this one, plus this one times this one. And then we would do a matrix multiplication here and then we would say that, or the result of this matrix multiplication. Would be capacitance over delta t times our vector of all of our cur, current times minus the i in a current, all evaluated at, at the current time. So our implicit solution of the Hodgkin Huxley equations would look like this. And this is a matrix equation, we're saying, so mars matrix a, that we've defined here, times some vector ax, which is our unknown is equal to some other vector B over here, which, which we're computing, based on what we know and this can be solved by saying x is equal the inverse of a, times the vector b. But implicit solutions therefore involve inverting a matrix, which can be a very complicated procedure. So, this is the challenge of the implicit solutions, is the fact that you have to solve for all of your future variables at the same time, and that converts it into a, into a very complex sort of matrix -. Equation format, rather than a relatively simple format where you can say, I can compute my current voltage at this particular node, in the future, just based on a bunch things I already know. This is again, just to reiterate the point that we've made, which is that implicit solutions are conceptually challenging even if they're, they can be a lot faster than, than explicit solutions. They involve solving for a lot of the variables at the next time step, all at the same time. Therefore, to summarize this lecture on some practical considerations, in solving partial differential equations, one thing we've seen is that solving PDEs, just like solving ODEs, requires converting derivatives into a discrete form. And we have also seen that a spatial derivatives are evaluated at the current time, this implies an explicit solution of the PDE. These are evaluated at a future time, this is what will give us an implicit solution of the PDE. And finally we see that explicit solutions are conceptually rather straight forward, but these can be very slow to run. Implicit solutions can be faster than explicit solutions, but they are a lot more challenging, to implement. [BLANK_AUDIO]