Coding Education STEM

BACTERIAL GROWTH SIMULATION (Binary Fission)

Here, I present a quick simulation application (runs in the browser) of population growth of bacteria that mutiplies following binary fission reproduction. Basically, it’s the division of a single cell into two or more cell and the regeneration of those parts to separate cells resembling the original.

To play the simulation, just navigate to the page here: https://flyingsalmon.net/demos/BAC/

If your browser complains that the site or connection is not secure, it is OKAY. Just click on Advance button on the warning page and proceed to the site. (It’s because my server uses HTTP protocol (not HTTPS) as we don’t do any confidential transaction. The app just runs in the brower and is perfectly safe.)

I’m making the complete source code (HTML5) of this completely FREE. You can download the zip file containing everything in the app from here.

Let’s do a quick overview of the app. On the main page, you can input the starting population, frequency of division (how many minutes it takes to divide each cell), and how long you want the simulation to run…meaning, if you want to know the total number of cells after 2 hours (120 minutes) of such division, you will enter 120 minutes there.

The higher the starting population, frequency of division, and length of simulation, the more memory your computer will need (and your electric bill may be affected by it). So, you should use nominal numbers 🙂

After your inputs, press START button to start the simulation. The next screen looks like this:

For memory management, I only put one bacteria animation per generation…this is to protect your memory and power consumption.

The simulation calculation continues until you see “Simulation Complete!” message on screen. At that point, you can click/touch “Final View!” button, which recreates the total number of bacteria animations. It’ll depend on your machine’s memory and CPU power as to how soon they will render (or even time out). Within reasonable limits, you will see the actual number of bacteria that grew within that period you specified to simulate. For example, for a type of bacteria that divides its cells every 20 minutes, starting with with just 1 cell, after 3 hours (=180 minutes), you will have 9 new generations with a final 512 bacteria cells.

NOTE: The simulation is set so that each second is equivalent to 1 minute. So, if you want to run a simulation for 1 hour (60 mins), you will only need to wait for 60 seconds to see the results.

PRO TIP: You can actually drag each bacteria around with Touch or Mouse if you wish (the actual count will still stay true).

A final output may look something like this (it’s showing the exact number of animated cells produced after a simulation):

Final population after a simulation

Using binary fission algorithm, we can determine the future population (this can be used in many scenarios, not just for biological cells, including money/investment/human population etc.) at any given point. For example, below is a chart I created in Excel using the same algorithm at different intervals that shows progression over time.

Excel chart showing growth over time

Hope you enjoyed this!

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top