(42s) Hypergeometric function for HP-42s (UPDATED)
|
10-30-2023, 05:29 PM
(This post was last modified: 11-02-2023 11:04 AM by Namir.)
Post: #1
|
|||
|
|||
(42s) Hypergeometric function for HP-42s (UPDATED)
Hypergeometric function for HP-42s
================================= Code calculates values for the hypergeometric function F(alpha, beta, gamma, x). The code uses the gamma function to help calculate the value of the hypergeometric function. Memory Map ========= Code: R00 = x HP-42S Listing ========= NOTE: The following code was updated per suggestions of Velentin Alibillo to shorten the code by a few statements. Code: 01 LBL "HGFX" Usage ===== 1) Press [XEQ] HGFX. The program displays the prompt "A^B^C^X?" 2) Enter the value for parameter alpha and press ENTER. 3) Enter the value for parameter beta and press ENTER. 4) Enter the value for parameter gamma and press ENTER. 5) Enter the value for x and press R/S. The program displays the prompt "TOLER?" 6) Enter a small value for the tolerance and press R/S. 7) The program displays the value of the hypergeometric function. Example ======= To calculate F(1.5, 1.5, 2.5, 0.3), perform the following steps: 1) Press [XEQ] HGFX. The program displays the prompt "A^B^C^X?" 2) Enter the value 1.5 for parameter alpha and press ENTER. 3) Enter the value 1.5 for parameter beta and press ENTER. 4) Enter the value 2.5 for parameter gamma and press ENTER. 5) Enter the value 0.3 for x and press R/S. The program displays the prompt "TOLER?" 6) Enter a small value 1E-15 for the tolerance and press R/S. 7) The program displays 1.36956073 as the value of the hypergeometric function. |
|||
11-01-2023, 02:35 AM
Post: #2
|
|||
|
|||
RE: Hypergeometric function for HP-42s
.
Hi, Namir, (10-30-2023 05:29 PM)Namir Wrote: HP-42S Listing Some hopefully useful comments:
2. I've seen that this program for the 42S is essentially the same as the one you recently posted to the 41C Library, essentially just replacing the calls to your GAM4 program by the 42S built-in GAMMA function. However, the 42S also has RCL arithmetic (which the 41C lacks) and it can be put to good use in several places, for instance:
31 RCL 05 32 + can be replaced by:
31 RCL+ 05 saving one line (32 + is no longer necessary). You can do this with lines 30-32, 34-35 (RCL÷ 11), 36-38, 40-41, 43-45 and 47-48, saving 6 lines in all. 3. You can also save further lines replacing this code:
06 STO 03 07 RDN 08 STO 02 09 RDN 10 STO 01 11 TOLER? 12 PROMPT 13 STO 04 14 1 15 STO 06 16 0 17 STO 05 18 RCL 01 19 GAMMA 20 STO 11 21 RCL 02 22 GAMMA 23 STO 12 24 RCL 03 25 GAMMA 26 STO 13 27 LBL 00 by this code:
06 STO 03 07 GAMMA 08 STO 13 09 RDN 10 STO 02 11 GAMMA 12 STO 12 13 RDN 14 STO 01 15 GAMMA 16 STO 11 17 TOLER? 18 PROMPT 19 STO 04 20 1 21 STO 06 22 0 23 STO 05 24 LBL 00 ... saving an additional 3 lines with no change in functionality (just very slightly faster.) V. All My Articles & other Materials here: Valentin Albillo's HP Collection |
|||
11-01-2023, 06:13 PM
Post: #3
|
|||
|
|||
RE: Hypergeometric function for HP-42s
Yes, but RCL+ nn always takes 3 bytes, while RCL nn + only takes 2, for n=00 to 15 included.
Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
11-02-2023, 02:45 AM
Post: #4
|
|||
|
|||
RE: (42s) Hypergeometric function https://www.hpmuseum.org/forum/index.phpfor HP-42s
Thanks Valentine for your tips and comments. Will update the code!
Namir |
|||
11-02-2023, 11:05 AM
Post: #5
|
|||
|
|||
RE: (42s) Hypergeometric function for HP-42s (UPDATED)
HP-42S listing in first posting of this thread has been updated.
Namir |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)