18IMPLEMENTING THE MINIMAL MODEL

image

The previous chapter presented the minimal model of the glucose–insulin system and introduced a tool we need to implement it: interpolation.

In this chapter, we’ll implement the model in two ways:

  • We’ll start by rewriting the differential equations as difference equations; then we’ll solve the difference equations using a version of run_simulation similar to what we have used in previous chapters.
  • Then we’ll use a new SciPy function, called solve_ivp, to solve the differential equation using a better algorithm.

We’ll see that solve_ivp is faster and more accurate than run_simulation. As a result, we will use ...

Get Modeling and Simulation in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.