(41C/CV/CX) Epidemiologic Programs for Computers & Calculators
|
04-26-2024, 02:40 PM
(This post was last modified: 04-27-2024 03:09 PM by SlideRule.)
Post: #1
|
|||
|
|||
(41C/CV/CX) Epidemiologic Programs for Computers & Calculators
An extract from Epidemiologic Programs for Computers and Calculators, SIMPLE ALGORITHMS FOR THE REPRESENTATION OF DETERMINISTIC AND STOCHASTIC VERSIONS OF THE REEDFROST EPIDEMIC MODEL USING A PROGRAMMABLE CALCULATOR, AMERICAN JOURNAL OF EPIDEMIOLOGY, Vol. 123 No. 5, 1986, pages 905-915
Two programs are described for the emulation of the dynamics of Reed-Frost progressive epidemics in a handheld programmable calculator (HP-41C series). The programs provide a complete record of cases, susceptibles, and immunes at each epidemic period using either the deterministic formulation or the trough analogue of the mechanical model for the stochastic version. Both programs can compute epidemics that include a constant rate of influx or outflux of susceptibles and single or double infectivity time periods. … … MATERIALS AND METHODS Equipment Programs were written for an HP-41CV programmable calculator (Hewlett-Packard Co., Corvallis, OR). The minimal system configurations enabling execution of the two programs are 1) the basic HP-41C calculator equipped with two HP-82106A memory modules or one HP-82170A Quad memory module, or 2) an HP-41CV or an HP-41CX calculator. Use of the HP-82182A time module enables generation of automatic time-dependent random number seeds. Although this would have represented a desirable feature for the stochastic version, we resorted to a keyboard-entered, user-chosen seed to reset the generator. The programs contain several instructions to allow printing of the output. We used an HP-82143A printer (Hewlett-Packard Co.) to obtain a permanent record of the results, i.e., frequencies of cases, susceptibles, and immunes at each epidemic period and a pictorial representation of the aligned balls in the trough. However, use of a printer is not mandatory since all results, except the trough picture, will be displayed in the calculator also. Unattended program execution is possible only with the printer present in the system. Use of the HP-82104A card reader is optional. … … Description of the algorithms The two programs, REED and FROST, although totally independent with respect to register usage, flag control, and execution, share the same basic structure. Both programs are divided into two major routines: input and data processing. … … TABLE 1 Operating instructions for programs REED and FROST in user mode … … APPENDIX: PROGRAM LISTINGS … … BEST! SlideRule |
|||
04-27-2024, 11:53 AM
(This post was last modified: 04-28-2024 09:45 AM by Thomas Klemm.)
Post: #2
|
|||
|
|||
RE: (41C/CV/CX) Epidemiologic Programs for Computers & Calculators
REED
This is the program REED for the HP-41C: Code: 01*LBL "REED" And here the same program for the HP-42S: Code: 00 { 302-Byte Prgm } This allows us to reproduce FIGURE 3: Quote:Three examples of printed output from program "REED" which is based on the deterministic formulation. The three epidemics displayed differed in the magnitude of the p values: 0.02, 0.03, and 0.04, respectively. REED-FROST EPIDEMICS <DETERMINISTIC> P? =0.020 C0? =1 S0? =100 S. INFLUX? =0 INF. TIME? =1 T=1 C=2 S=98 I=1 T=2 C=4 S=94 I=3 T=3 C=7 S=87 I=7 T=4 C=11 S=76 I=14 T=5 C=15 S=61 I=25 T=6 C=16 S=45 I=40 T=7 C=12 S=33 I=56 T=8 C=7 S=26 I=68 T=9 C=3 S=23 I=75 T=10 C=1 S=22 I=78 T=11 C=0 S=22 I=79 END OF EPIDEMIC REED-FROST EPIDEMICS <DETERMINISTIC> P? =0.030 C0? =1 S0? =100 S. INFLUX? =0 INF. TIME? =1 T=1 C=3 S=97 I=1 T=2 C=8 S=89 I=4 T=3 C=19 S=70 I=12 T=4 C=31 S=39 I=31 T=5 C=24 S=15 I=62 T=6 C=8 S=7 I=86 T=7 C=2 S=5 I=94 T=8 C=0 S=5 I=96 END OF EPIDEMIC REED-FROST EPIDEMICS <DETERMINISTIC> P? =0.040 C0? =1 S0? =100 S. INFLUX? =0 INF. TIME? =1 T=1 C=4 S=96 I=1 T=2 C=14 S=82 I=5 T=3 C=36 S=46 I=19 T=4 C=35 S=11 I=55 T=5 C=8 S=3 I=90 T=6 C=1 S=2 I=98 T=7 C=0 S=2 I=99 END OF EPIDEMIC FROST This is the program FROST for the HP-41C: Code: 01*LBL "FROST" It uses the printer's ACA and PRBUF commands, which are not supported by the HP-42S. I haven't tested it yet, but I hope I didn't make any typos when transcribing from the original PDF. These programs might have been useful four years ago. We now also have other tools for modeling epidemics: As always, thank you for your contributions. |
|||
04-27-2024, 05:01 PM
(This post was last modified: 04-27-2024 05:35 PM by Ángel Martin.)
Post: #3
|
|||
|
|||
RE: (41C/CV/CX) Epidemiologic Programs for Computers & Calculators
I believe these programs were included in the EPIDEMICS module,
see the manual here and the original thread on the SIR model subject. This is the original posting of this article, also from SlideRule "To live or die by your own sword one must first learn to wield it aptly." |
|||
04-28-2024, 02:52 AM
Post: #4
|
|||
|
|||
RE: (41C/CV/CX) Epidemiologic Programs for Computers & Calculators
Sorry for the repost; I did a quick SERACH but missed the original post, somehow - great catch (very nice 41 & 42 listings) !
BEST! SlideRule |
|||
04-28-2024, 10:24 AM
Post: #5
|
|||
|
|||
RE: (41C/CV/CX) Epidemiologic Programs for Computers & Calculators
(04-28-2024 02:52 AM)SlideRule Wrote: Sorry for the repost No worries about that. I probably missed your initial post. (04-27-2024 05:01 PM)Ángel Martin Wrote: I believe these programs were included in the EPIDEMICS module, I downloaded the attachment in Post #6 but was not able to find the programs REED and FROST. Then I downloaded the rom_files_240325.zip from the File Area of 41CL Calculator. Finally I used rom2raw to extract the programs: rom2raw -l EPIDEMIC.ROM > EPIDEMIC.txt From this I extracted the files reed.txt and frost.txt in the attachment of this post. This helped me to fix some bugs in my listings. Meanwhile I've updated them in my previous post. However, I also noticed some changes to the code in the EPIDEMIC module compared to the original programs. Some of these are optimisations. I think they're fine. Others are mostly cosmetic in the printed text. Here I propose to consider them. But I think the word TROUGH should stay as it is. That's not a typo. And then there are clearly two bugs:
REED Code: 42 "S. INFLUX? =" FROST Code: 06 ├"<TROUGH>" |
|||
04-28-2024, 04:34 PM
(This post was last modified: 04-28-2024 08:25 PM by Ángel Martin.)
Post: #6
|
|||
|
|||
RE: (41C/CV/CX) Epidemiologic Programs for Computers & Calculators
Thomas, thanks for the thorough scrub - sorry you had to do all that conversion, I could have sent you the ROM files had I known you were doing this exercise.
You're right these two programs are not described in the manual I posted. I thought I had included the original pdf in the manual, will do that and send the updated copy for posting.. BTW in the module I have the correct GTO 08 in line 98... Of all other glitches you report I believe the only one with more than cosmetic impact is the constant in the RNG routine, which is missing a digit. I should fix it in a forthcoming revision, thanks again. Best, ÁM PS.- Updated manual and ROM blueprint included for your reference. "To live or die by your own sword one must first learn to wield it aptly." |
|||
04-28-2024, 05:20 PM
Post: #7
|
|||
|
|||
RE: (41C/CV/CX) Epidemiologic Programs for Computers & Calculators
This is a nice picture of a trough:
This could even be in Switzerland. Also it appears to be related to the German word Trog. The paper Epidemiologic Programs for Computers and Calculators is included at the end of your excellent Epidemics ROM manual. And the programs REED and FROST are part of the EPIDEMIC.ROM that I downloaded from Monte's site. (04-28-2024 04:34 PM)Ángel Martin Wrote: BTW in the module I have the correct GTO 08 in line 98... I have the md5-sum 1d3812cb3d7b654125003cd438e5e1b8 for the EPIDEMIC.ROM. Should I have used a different tool than rom2raw to extract the programs? |
|||
04-28-2024, 05:39 PM
(This post was last modified: 04-28-2024 08:32 PM by Ángel Martin.)
Post: #8
|
|||
|
|||
RE: (41C/CV/CX) Epidemiologic Programs for Computers & Calculators
(04-28-2024 05:20 PM)Thomas Klemm Wrote: This is a nice picture of a trough: Really?? I thought that was a COW :-) (04-28-2024 05:20 PM)Thomas Klemm Wrote: The paper Epidemiologic Programs for Computers and Calculators is included at the end of your excellent Epidemics ROM manual. Hmmm... not sure I sent the updated ROM to Monte yet, will make sure I do it next. Here is the latest attached just in case "To live or die by your own sword one must first learn to wield it aptly." |
|||
04-28-2024, 06:14 PM
Post: #9
|
|||
|
|||
RE: (41C/CV/CX) Epidemiologic Programs for Computers & Calculators
I still get these lines in the FROST program:
Code: 97 ISG 13 But the trough is fixed: Code: 04 ├"<TROUGH>" |
|||
04-28-2024, 08:30 PM
(This post was last modified: 04-28-2024 08:31 PM by Ángel Martin.)
Post: #10
|
|||
|
|||
RE: (41C/CV/CX) Epidemiologic Programs for Computers & Calculators
alright Thomas, you're correct... and so am I because if you single-step the code on the GTO 00 step you'll see it goes to LBL 08 (2 bytes ahead). Indeed there was a glitch in the source file, it had the correct jump distance but the wrong description - obviously that was a mistake that needs correcting in case somebody uses the program listing (or modifies it breaking the pre-compiled distances).
Thanks again - see attached "To live or die by your own sword one must first learn to wield it aptly." |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)