Rabbit vs. Foxes
|
02-08-2020, 02:26 PM
Post: #1
|
|||
|
|||
Rabbit vs. Foxes
The program presented today is based on the Rabbits vs. Foxes program for the HP 25 (see source below). The program determines the population of rabbits and foxes over time as modeled by the differential equations:
Change in Rabbits: dr/dt = 2 * r - α * r * f Change of Foxes: df/dt = -f + α * r * f where: r = population of rabbits f = population of foxes α = probability of a rabbit encounters a fox h = step This is approximated by Euler's method. The HP Prime program RABBIT25 displays a print screen of results of the desired amount of iterations. The HP 42S program RAB25 displays the results one step at time in the format rrrrr.fffff (rabbits.foxes), like the original HP 25 program. HP Prime Program RABBIT25 Code:
Source: Randall B. Neff and Lynn Tilman "An Example of HP-25 Programming" Hewlett-Packard Journal: November 1975. pg. 6 Blog Post: http://edspi31415.blogspot.com/2020/02/h...foxes.html |
|||
02-08-2020, 07:52 PM
Post: #2
|
|||
|
|||
RE: Rabbit vs. Foxes
Here is another variation on this program from Datafile V36N3P27 as presented at the HPCC Mini-Conference in October 2019. This version dispenses with the dialogue box entry of values, but adds saving the results in a matrix and hence plotting and exploring the results in the graphing environment.
The Prime requires that you have opened the Statistics 2Var before entering the program, otherwise a syntax error is generated. The complete graph of results (1125 iterations), as shown in the original HP magazine article, is drawn in approximately 0.33s on an HP Prime G2. PHP Code: EXPORT Rabbits_vs_Foxes() |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)