HP Forums
(41C) Biorhythm Calculator - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP-41C Software Library (/forum-11.html)
+--- Thread: (41C) Biorhythm Calculator (/thread-11749.html)



(41C) Biorhythm Calculator - Gamo - 11-05-2018 01:55 PM

This is my first attempt to program on HP 41C
I don't own a real one and used the GO41C for Android emulator.

This Biorhythm Calculator program was adapted from my previous post
that was program on HP-11C

Procedure:

[SIN] "Day Alive?" input your Total Day Alive then "Ready"
[A] "Physical" [R/S] result in percent
[B] " Emotional" [R/S] result in percent
[C] "Intellectual" [R/S] result in percent
[E] "Average" [R/S] result in percent [R/S] Add one more day to previous TDA

Continue start with A B C E and so on.

Example: USER mode

My TDA is 14554 What is the Physical, Emotional, Intellectual and Average?

[SIN] "DAY ALIVE?" --> 14554 [R/S] --> "Ready"

[A] "PHYSICAL" [R/S] 98
[B] "EMOTION" [R/S] 97
[C] "INTELLCTUAL" [R/S] 19
[E] "AVERAGE" [R/S] 59 [R/S] 14555

Continue [A] --> [B] --> [C] --> [E] then [R/S]

For new Total Day Alive Start [SIN] and enter new TDA

Program:
Code:

LBL BIO
DAY ALIVE?
XEQ "PROMPT"
STO 01
360
STO 02
23
STO 03
28
STO 04
33
STO 05
FIX 0
READY
XEQ "PROMPT"
-----------------------------
LBL PHY
PHYSICAL
XEQ "PROMPT"
RCL 01
RCL 02
x
STO 00
RCL 03
÷
SIN
STO 06
EEX 2
x
RTN
-----------------------------
LBL EMO
EMOTIONAL
XEQ "PROMPT"
RCL 00
RCL 04
÷
SIN
STO+06
EEX 2
x
RTN
----------------------------
LBL INT
INTELLECTUAL
XEQ "PROMPT"
RCL 00
RCL 05
÷
SIN
STO+06
EEX 2
x
RTN
---------------------------
LBL AVE
AVERAGE
XEQ "PROMPT"
RCL 06
3
÷
EEX 2
x
R/S
1
STO+01
RCL 01
RTN

Run Mode:
ASN BIO [SIN]
ASN PHY [A]
ASN EMO [B]
ASN INT [C]
ASN AVE [E]
--------------------------------

Gamo


RE: (41C) Biorhythm Calculator - Dieter - 11-05-2018 07:38 PM

(11-05-2018 01:55 PM)Gamo Wrote:  This is my first attempt to program on HP 41C
I don't own a real one and used the GO41C for Android emulator.

Welcome to the '41. :-)
Let me add just a few remarks.

The 41 series can diplay labelled results. So you do not have to display "PHYSICAL" first and then have the user press [R/S] to show the (unlabelled) value afterwards. Try this:

"PHYS: "
ARCL X
PROMPT

This writes "PHYS: " into alpha and then the value in X is appended. So the complete line will display as "PHYS: 25,3" (for instance). I suggest you use FIX 1 or FIX 2 here.

You shouldn't name a label "INT" on the HP41. "INT" is a regular HP-41 command, so you will not be able to use it as long as a label with the same name exists. XEQ"INT" will always call the program and not allow using the INT function. (Well, there is a way, but...).

The program uses trig functions, so be sure to set DEG mode here. Or, even better, replace the 360 by the respective value for the currently set angle mode. For instance with "1 ATAN 8 x" or "–1 ACOS ST+X". This will return 360 in DEG mode, 2·pi in RAD and 200 in GRAD mode.

The program uses quite a lot of data registers – for values that are only recalled once afterwards. So that's not a good idea. Simply code the numbers directly where they are needed.

(11-05-2018 01:55 PM)Gamo Wrote:  This Biorhythm Calculator program was adapted from my previous post
that was program on HP-11C

As mentioned several times, adapting programs for other calculators often is not a good idea. This is especially true for the HP-41. There are so many useful features that were not available on other HPs of its time that I would strongly recommend getting familiar with these new features and write a completely new program from scratch.

Maybe you like to try a HP-41 program based on the following algorithm:

Code:
prompt for age in days
clear sum
call subroutine with x=23 and "PHYS: " in alpha
call subroutine with x=28 and "EMOT: " in alpha
call subroutine with x=33 and "INTL: " in alpha
calculate average = sum/3
display average

subroutine:
calculate 100*sin(age*360/x)
add this to sum
append value to alpha
show alpha
return

Dieter