May 15th, 2013, 07:03 AM
A Predator-Prey Simulation
Let there be two fishes named Kernighans and Ritchies. The only fish know to prey on Ritchies and to be able to digest them is the colour-blind Kernighan. The Kernighan has adapted to a diet of Ritchies, and won't prey on any other species. No other fish or sea animal could prey on the Ritchies.
So with he above information, could a simulation be created to calculate the two population at different time intervals. I have done something but i belive that i could be on the wrong track.
Some other information to follow would be:
The population of Kernighans and Ritchies can be fully determined by the population size of Kernighans and Ritchies. Suppose that in a given month the number of Kernighan is pop_k, and the population of Ritchies is pop_r. The population of Kernighans and Ritchies is measured in multiples of 1000. This means a population size of 1.0 corresponds to 1000 fish. For the number of Kernighans in the next month we have:
The population pop_k decreases by alpha_k pop_k. This is the number of Kernighans that would starve if there were no Ritchies to eat.
The population pop_k increases by beta_k pop_k pop_r. This is the number of new Kernighans because they can feed on Ritchies.
The population pop_k decreases by gamma_k pop_k2. This decrease in the number of Kernighans is due to competition between Kernighans.
Hence, given a population pop_k, the population in the next month is
pop_k - alpha_k pop_k + beta_k pop_k pop_r - gamma_k.pop_k2
If the result of this computation is smaller than 0.001, then there are no Kernighan fish left
For the number of Ritchies in the next month we have
The population pop_r increases by alpha_r pop_r. This is the number of new Ritchies, if there were no Kernighan to eat them..
The population pop_r decreases by beta_r pop_k pop_r. This is the number of Ritcchies eaten by Kernighans.
The population pop_r decreases by gamma_r pop_r2. This decrease in the number of Ritcchies tis due to competition between Ritchies.
Hence, given a population pop_r the population in the next month is
pop_r + alpha_r.pop_r - beta_r.pop_k.pop_r - gamma_r.pop_r 2
If the result of this computation is smaller than 0.001, then there are no Ritchie fish left.
Measurements have shown that the constants have the following values:
alpha_k = 0.4;
beta_k = 0.4
alpha_r = 0.2;
beta_r = 0.2
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!