Physics 212, 2019: Lecture 7

From Ilya Nemenman: Theoretical Biophysics @ Emory
Revision as of 07:56, 6 February 2019 by Ilya (talk | contribs) (Created page with "{{PHYS212-2019}} In this module, we further expand on our toolkit of computational methods and Python coding and learn how to solve dynamical (ordinary differential equations...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Emory Logo

Back to the main Teaching page.

Back to Physics 212, 2019: Computational Modeling.

In this module, we further expand on our toolkit of computational methods and Python coding and learn how to solve dynamical (ordinary differential equations) models.

The simplest dynamical model: Malthusian growth

A few bacteria are placed in a Petri dish. With time, each bacterium grows with a certain rate and then divides into two daughter cells. How many bacteria are there in the dish a certain while later?

Analysis
How should we model this? The model we need is definitely dynamic. However, almost all other aspects of the model are for you to decide. I encourage you to consider different modeling assumptions. We can have discrete number of bacteria vs. continuous (explain what it means to have a continuous number here -- after all, the number of bacteria is natural). We can have discrete time (bacteria divide synchronously) or continuous time -- bacteria divide at different times. Which (if any) is a better choice and why? We can have a stochastic model (the number of dividing bacteria is random) or a deterministic model, where in a certain interval a certain fraction of bacteria divides that is proportional to the duration of the interval. In what follows, I choose to assume that each bacterium divides at the same rate. But they divide in different time, so that the time is continuous. We will assume that the number of bacteria is large, so that a large number of new bacteria gets created during any, even very short, period of time. Thus the total number of bacteria dividing per unit time is proportional to the current population, with a certain coefficient of proportionality, which we call the rate.
Model building
The following variables are needed to initialize the model: initial number of bacteria (constant), growth rate (constant), total duration of the experiment (constant), the number of bacteria -- a variable that will be updated with time. The considerations above suggest that we can write the model using a differential equation for the population size , with the initial condition . This assumes that the number of bacteria is always much larger than 1. This model is easy to solve analytically. We rewrite the equation as , and integrate both sides. This gives . However, our focus here is on solving similar equations numerically, and so we will implement numerical solution of the equation, and the analytical solution will be a useful check of accuracy of our numerical code.
Model implementation
We rewrite the differential equation as a finite difference equation . This tells us that two more variables will be needed for implementation of the problem: -- a dependent variable that will store the change of the number of bacteria on a dish at a given time, and , which is a constant determining the step size for the solution of the differential equation. The following script implements the solution: Simple Malthusian growth.
Model verification
We can solve this whole problem analytically and compare to the output of the experiment. Or we can verify the code by comparing to special cases, such as growth rate or initial bacterial number being zeros (what are the solutions for both of these cases?).
Discussion
We have modeled the exponential bacterial growth, and the findings agree with the analytics. While it seems that there is not much to discuss here, one could still describe what will happen to the solution if any of our assumptions (large number of bacteria, deterministic growth, continuous time, etc.) are violated. Please think of answers to these questions. For example, how would this code change if we assumed the model to be a discrete time model? In fact, only the steps would probably get larger -- but the structure of the code would remain the same, with the same stepping through time intervals of . There are no, in fact, continuous models on digital computers!
Your work
explore how the solution depends on . Change the code to output the results only when is an integer.