The Computational Beauty of Nature
Source code

lotka

integrate the Lotka-Volterra system

predprey -help
  or
predprey
       [-seed integer] [-points integer] [-f0 double] [-s0
       double] [-a double] [-b  double]  [-c  double]  [-d
       double] [-dt double]

Simulates the two-species Lotka-Volterra predator-prey system with a second-order Euler's method. This program serves as a simple introduction to differential equations.

Integrates the two-species Lotka-Volterra predator-prey system,

dF/dt = F(a - bS), dS/dt = S(cF - d),

according to the specified parameters.

Miscellany

The program uses a second-order Euler's method to perform the numerical integration, which is sufficient for simple tasks such as this.

Bugs

No sanity checks are performed to make sure that any of

the options make sense.

Options

-seedSeed for random parameters.-1
-pointsNumber of points to produce.2500
-f0Initial fish population.1.0
-s0Initial shark population.0.2
-aFish growth rate.1.5
-bShark consumption rate.1.5
-cFish nutritional value.0.5
-dShark death rate.1.5
-dtTime step increment.0.1

lotka.c on GitHub