Helen The Human


Headshot

I am Helen and I’m a human.

blog email github Linkedin


Modeling Bunnies

This is a little app I built a few years ago, and I figured I'd share it here. It's at the bottom, after all the words. It is inspired by a predator-prey model, represented by the Lotka-Volterra equations, a very simple set of differential equations which model how a predator species and prey species interact, resulting in a cyclical population pattern (when there are lots of predators, prey species population goes down, until they cannot sustain the predators anymore, at which point predator population goes down and prey goes up, so that they can sustain more predators, whose population increases again...). I simulate this system here, using stochastic instead of deterministic interactions. Red dots are predators, and green dots are prey. They could be foxes and rabbits, or rabbits and grass, or whatever you want. They move around randomly, die and reproduce sometimes (randomly), and when they run into each other the prey may get eaten. You can see the populations plotted over time below the habitat.

There is another variable in play here not modeled in the Lotka-Volterra equations: space. This results in some interesting patterns appearing. Play around with the initial conditions and see what happens.

It's a bit buggy and not super pretty. I might come back and update it now that I have superiour coding skills. It would be cool to allow you to mess around with parameters (how fast predators/prey die, get eaten, move, etc).

The Thing

Prey:
Predators: