(11C) Rabbits VS Foxes Simulation

07292018, 06:46 AM
(This post was last modified: 07292018 02:23 PM by Gamo.)
Post: #1




(11C) Rabbits VS Foxes Simulation
This program was modify from the promotional ad for the
HP25 Scientific Programmable calculator. A simple ecological model of interacting populations consists of rabbits with an infinite food supply and foxes that prey on them. The system can be approximated by a pair of nonlinear, firstorder differential equations. This program simulate the population between the rabbit and fox given the number of rabbits and the number of foxes. Example: α = 0.01 // STO 0 // Frequency (how often rabbits and foxes meet) h = 0.02 // STO 1 // Step size r = 300 // Rabbits f = 150 // Foxes In Run mode: Clear REG ,01 STO 0 ,02 STO 1 300 [ENTER] 150 f [A] Display keep going: 303,00156 // 303 are Rabbits and 156 are Foxes 305,00162 307,00169 309,00176 311,00183 312,00191 312,00199 . . . Simulation keep going for observation........ Press any keys except [ON] to stop. Press [R/S] to continue. User can turn off the calculator and keep continue from where you stop the last time simply press [R/S] assuming that the storage registers haven't been change. Program: Rabbits VS Foxes Populations Code:
Gamo 

07292018, 08:42 AM
Post: #2




RE: (11C) Rabbits VS Foxes Simulation
There was a beautiful colour version of this, complete with Pi Charts on cassette that came with the ZX Spectrum in 1982
Denny 

07292018, 12:07 PM
Post: #3




RE: (11C) Rabbits VS Foxes Simulation
(07292018 06:46 AM)Gamo Wrote: The system can be approximated by a pair of nonlinear, firstorder differential equations. From the code I assume they are: \[ \begin{eqnarray} \dot{r}&=2r\alpha fr \\ \dot{f}&=\alpha frf \end{eqnarray} \] This looks very much like the Lotka–Volterra equations: \[ \begin{aligned} \frac {dx}{dt}&=\alpha x\beta xy\\ \frac {dy}{dt}&=\delta xy\gamma y \end{aligned} \] What is reason for the peculiar factor 2 in \(\dot{r}=2r\alpha fr\)? At a stationary point the derivative vanishes: \(\dot{r}=\dot{f}=0\). This leads to: \begin{aligned} r(2\alpha f)=0&\Rightarrow &f=\frac{2}{\alpha}\\ f(\alpha r1)=0&\Rightarrow &r=\frac{1}{\alpha} \end{aligned} Thus for the value given \(\alpha=0.01\) we end up with: \begin{aligned} r=100\\ f=200 \end{aligned} This looks like a lot of foxes compared to the rabbits. Cheers Thomas 

07292018, 02:03 PM
Post: #4




RE: (11C) Rabbits VS Foxes Simulation
Thanks Thomas Klemm
I was adapting this program to work for 11C and I don't know why that factor of 2 is for but I guess is that the rabbit reproduce faster than a fox? Thank You for the link to get more details about this equation. Gamo 

07292018, 10:51 PM
(This post was last modified: 07292018 10:51 PM by SlideRule.)
Post: #5




RE: (11C) Rabbits VS Foxes Simulation
The source document?
[attachment=6168] BEST! SlideRule 

07302018, 05:58 AM
Post: #6




RE: (11C) Rabbits VS Foxes Simulation
Thanks a lot for providing the original source.
It's a bit disturbing that the phasespace plot doesn't show closed curves. But that might be due to using a simple Euler method. I wonder if using Runge–Kutta methods would even fit the 49 steps available. Cheers Thomas 

07302018, 09:47 AM
(This post was last modified: 07302018 10:43 AM by SlideRule.)
Post: #7




RE: (11C) Rabbits VS Foxes Simulation
(07302018 05:58 AM)Thomas Klemm Wrote: Thanks a lot for providing the original source. My apologies ALL for providing an unreferenced extract: An Example of HP25 Programming: HewlettPackard Journal, Vol. 27 No. 3, 197511, page 6 [attachment=6172] with some additional (pertinent?) references: The PredatorPrey Model: Science and Engineering for the Commodore 64, pages 261271 [attachment=6169] Rabbits and Foxes: Biological Population Cycles: Creative Computing 198306, pages 280 & 282 [attachment=6170] Introduction to Mathematical Control Theory: Clarendon Press, pages 10, 1920, 102, 117 & 145 [attachment=6171] BEST! SlideRule 

07302018, 01:03 PM
Post: #8




RE: (11C) Rabbits VS Foxes Simulation
It gets better and better …


07302018, 01:13 PM
Post: #9




RE: (11C) Rabbits VS Foxes Simulation
Thanks SlideRule
Thank You for the extra detail information on this topic, very interesting. Gamo 

07302018, 11:43 PM
(This post was last modified: 07302018 11:45 PM by SlideRule.)
Post: #10




RE: (11C) Rabbits VS Foxes Simulation
(07292018 08:42 AM)Leviset Wrote: There was a beautiful colour version of this, complete with Pi Charts on cassette that came with the ZX Spectrum in 1982 Alas, my old ZX tape system is defunct, so if you have equivalent but functional technology [attachment=6173] Foxes & Rabbites screen shot [attachment=6174] z80 program file ps: change zip extension to z80 BEST! SlideRule 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)