Post Reply 
(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
R01 = alpha
R02 = beta
R03 = gamma_var
R04 = toler
R05 = sum - > fx value
R06 = k (loop control variable).
R11 = gamma(alpha)
R12 = gamma(beta)
R13 = gamma(gamma_var)

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"
02 A^B^C^
03 PROMPT
04 STO 00
05 RDN
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
25 1
26 STO+ 0
27 RCL 01
28 RCL+ 0
29 GAMMA
30 RCL 11
31 ÷
32 RCL 03
33 RCL+ 0
34 GAMMA
35 RCL 13
36 ÷
37 ÷
38 RCL 02
39 RCL+ 0
40 GAMMA
41 RCL 12
42 ÷
43 ×
44 RCL 05
45 N!
46 ÷
47 RCL 00
48 RCL 05
49 Y^X
50 ×
51 STO+ 0
52 ABS
53 RCL 04
54 X=Y?
55 GTO 00
56 RCL 06
57 RTN

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.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(42s) Hypergeometric function for HP-42s (UPDATED) - Namir - 10-30-2023 05:29 PM



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