hp41programs

Srivastava

Srivastava's Functions of Three Variables for the HP-41


Overview
 

-Srivastava's Functions generalize the hypergeometric functions of 3 variables  x , y , z.

-Given 14 non-negative integers  A  B  C  D  E  F  G  H  I  J  K  L  M  N   and

 A numbers  a1 ..... aA   B  numbers  b1 ..... bB  C  numbers  c1 ... cC  D  numbers  d1 .... dD  E numbers  e1 .... eE  F numbers  f1 ....  fF    G numbers g1....gG
 H numbers  h1 ..... hH    I  numbers   i1  .....  iI   J   numbers   j1 ...  jJ   K numbers   k1 .... kK  L numbers  l1 ....  lL  M numbers m1 ... mM N numbers n1 ... nN

 the following program computes

      F AHBICJDKELFMGN(a1 ... aA ;h1 ... hH ; b1 ... bB ;i1 ... iI ; c1 ... cC ;j1 ... jJ ; d1 ... dD ;k1 ... kK ; e1 ... eE ;l1 ...lL ; f1 ... fF ;m1 ... mM ; g1... gG ;n1 ... nN  ;  x , y , z  )

      =  SUMp,q,r=0 to infinity    up,q,r  xp yq zr / ( p! q! r! )

where   up,q,r  = [ (a1)p+q+r ...... (aA)p+q+r (b1)p+q ...... (bB)p+q (c1)q+r ...... (cC)q+r (d1)p+r ...... (dD)p+r (e1)p ...... (eE)p (f1)q ......   (fF)q  (g1)r ...... (gG)r ] /
                         [ (h1)p+q+r ...... (hH)p+q+r  (i1)p+q ......  (iI)p+q   (j1)q+r ......  (jJ)q+r  (k1)p+r ...... (kK)p+r  (l1)p ......  (lL)p (m1)q ...... (mM)q (n1)r ...... (nN)r ]

   and    (t)n = Pochhammer's symbol:

                      (t)0 = 1
                      (t)n = t(t+1)(t+2) ...... (t+n-1)    if  n > 0
 

Program Listing
 

Data Registers:              R00: temp                     ( Registers R01 thru R14 & R37 thru .... are to be initialized before executing "SRI" )

                                      •  R01 = A    •  R02 = B    •  R03 = C    •  R04 = D    •  R05 = E    •  R06 = F    •  R07 = G
                                      •  R08 = H    •  R09 = I     •  R10 =  J    •  R11 = K    •  R12 = L    •  R13 = M   •  R14 = N

                                         R15 = x   R16 = y   R17 = z      R18 = p   R19 = q   R20 = r       R21 to R36: temp

                                      •  R37 = a1    ...........................................................................   •  R36+A = aA
                                      •  R37+A =  b1 ........................................................................   •  R36+A+B = bB
                                      •  R37+A+B =  c1 .....................................................................  •  R36+A+B+C = cC
                                      •  R37+A+B+C =  d1 ................................................................  •  R36+A+B+C+D = dD
                                      •  R37+A+B+C+D =  e1 ............................................................  •  R36+A+B+C+D+E = eE
                                      •  R37+A+B+C+D+E = f1 .........................................................  •  R36+A+B+C+D+E+F = fF
                                      •  R37+A+B+C+D+E+F = g1 ....................................................  •  R36+A+B+C+D+E+F+G = gG
                                      •  R37+A+B+C+D+E+F+G = h1 ...............................................  •  R36+A+B+C+D+E+F+G+H = hH
                                      •  R37+A+B+C+D+E+F+G+H = i1 ...........................................  •  R36+A+B+C+D+E+F+G+H+I = iI
                                      •  R37+A+B+C+D+E+F+G+H+I = j1 .......................................  •  R36+A+B+C+D+E+F+G+H+I+J = jJ
                                      •  R37+A+B+C+D+E+F+G+H+I+J = k1 ..................................  •  R36+A+B+C+D+E+F+G+H+I+J+K = kK
                                      •  R37+A+B+C+D+E+F+G+H+I+J+K = l1 ..............................  •  R36+A+B+C+D+E+F+G+H+I+J+K+L = lL
                                      •  R37+A+B+C+D+E+F+G+H+I+J+K+L = m1 ........................  •  R36+A+B+C+D+E+F+G+H+I+J+K+L+M = mM
                                      •  R37+A+B+C+D+E+F+G+H+I+J+K+L+M = n1 ...................  •  R36+A+B+C+D+E+F+G+H+I+J+K+L+M+N = nN

Flag:  F10 is cleared at the end
Subroutines: /
 

-I've used an M-Code function   X+1  to add 1 to register X
-It may be replaced by  ISG X  CLX

-Lines 02-03 are only useful to remind that the cefficients are to be stored into R37 , R38 , ... etc ...
-Otherwise, they may be deleted.

-Lines 35-222-279  are three-byte  GTOs
 
 

  01  LBL "SRI"
  02  FS? 30 
  03  "COEF=R37"
  04  STO 15
  05  RDN
  06  STO 16
  07  X<>Y
  08  STO 17
  09  CLX
  10  STO 18
  11  STO 19
  12  STO 20
  13  1.014
  14  STO 00
  15  36
  16  23
  17  STO 21
  18  LBL 00
  19  RCL IND 00
  20  RCL Z
  21  +
  22  STO Y
  23   E3
  24  /
  25  R^
  26  +
  27  STO IND 21
  28  SIGN
  29  ST+ 21
  30  ISG 00
  31  GTO 00
  32  STO 21
  33  STO 22
  34  SIGN
  35  GTO 10
  36  LBL 01
  37  RCL 18
  38  RCL 19
  39  +
  40  RCL 20
  41  +
  42  RCL IND 00
  43  +
  44  FC? 10
  45  1/X
  46  *
  47  ISG 00
  48  GTO 01
  49  RTN
  50  LBL 02
  51  RCL 18
  52  RCL 19
  53  +
  54  RCL IND 00
  55  +
  56  FC? 10
  57  1/X
  58  *
  59  ISG 00
  60  GTO 02
  61  RTN
  62  LBL 03
  63  RCL 19
  64  RCL 20
  65  +
  66  RCL IND 00
  67  +
  68  FC? 10
  69  1/X
  70  *
  71  ISG 00
  72  GTO 03
  73  RTN
  74  LBL 04
  75  RCL 18
  76  RCL 20
  77  +
  78  RCL IND 00
  79  +
  80  FC? 10
  81  1/X
  82  *
  83  ISG 00
  84  GTO 04
  85  RTN
  86  LBL 05
  87  RCL 18
  88  RCL IND 00
  89  +
  90  FC? 10
  91  1/X
  92  *
  93  ISG 00
  94  GTO 05
  95  RTN
  96  LBL 06
  97  RCL 19
  98  RCL IND 00
  99  +
100  FC? 10
101  1/X
102  *
103  ISG 00
104  GTO 06
105  RTN
106  LBL 07
107  RCL 20
108  RCL IND 00
109  +
110  FC? 10
111  1/X
112  *
113  ISG 00
114  GTO 07
115  RTN
116  LBL 10
117  RCL 23
118  STO 00
119  X<> L
120  SF 10
121  ISG 00
122  XEQ 01
123  RCL 24
124  STO 00
125  RDN
126  ISG 00
127  XEQ 02
128  RCL 26
129  STO 00
130  RDN
131  ISG 00
132  XEQ 04
133  RCL 27
134  STO 00
135  RDN
136  ISG 00
137  XEQ 05
138  RCL 30
139  STO 00
140  RDN
141  CF 10
142  ISG 00
143  XEQ 01
144  RCL 31
145  STO 00        
146  RDN
147  ISG 00
148  XEQ 02
149  RCL 33
150  STO 00
151  RDN
152  ISG 00
153  XEQ 04
154  RCL 34
155  STO 00
156  RDN
157  ISG 00
158  XEQ 05
159  RCL 15
160  RCL 18
161  X+1 
162  STO 18
163  /
164  *
165  +
166  X#Y?
167  GTO 10
168  CLX
169  STO 18
170  X<> 21
171  RCL 23
172  STO 00
173  RDN
174  SF 10
175  ISG 00
176  XEQ 03
177  RCL 24
178  STO 00
179  RDN
180  ISG 00
181  XEQ 06
182  RCL 25
183  STO 00
184  RDN
185  ISG 00
186  XEQ 03
187  RCL 28
188  STO 00
189  RDN
190  ISG 00
191  XEQ 06
192  RCL 30        
193  STO 00
194  RDN
195  CF 10
196  ISG 00
197  XEQ 03
198  RCL 31
199  STO 00
200  RDN
201  ISG 00
202  XEQ 06
203  RCL 32
204  STO 00
205  RDN
206  ISG 00
207  XEQ 03
208  RCL 35
209  STO 00
210  RDN
211  ISG 00
212  XEQ 06
213  RCL 16
214  RCL 19
215  X+1 
216  STO 19
217  /
218  *
219  STO 21
220  +
221  X#Y?
222  GTO 10
223  CLX
224  STO 18
225  STO 19
226  X<> 22
227  RCL 23
228  STO 00
229  RDN
230  SF 10
231  ISG 00
232  XEQ 07
233  RCL 25
234  STO 00
235  RDN
236  ISG 00
237  XEQ 07
238  RCL 26        
239  STO 00
240  RDN
241  ISG 00
242  XEQ 07
243  RCL 29
244  STO 00
245  RDN
246  ISG 00
247  XEQ 07
248  RCL 30
249  STO 00
250  RDN
251  CF 10
252  ISG 00
253  XEQ 07
254  RCL 32
255  STO 00
256  RDN
257  ISG 00
258  XEQ 07
259  RCL 33
260  STO 00
261  RDN
262  ISG 00
263  XEQ 07
264  RCL 36
265  STO 00
266  RDN
267  ISG 00
268  XEQ 07
269  RCL 17
270  RCL 20
271  X+1 
272  STO 20
273  /
274  *
275  STO 21
276  STO 22
277  +
278  X#Y?
279  GTO 10
280  END

 
   ( 489 bytes / SIZE 037+A+B+C+D+E+F+G+H+I+J+K+L+M+N )
 
 

      STACK        INPUTS      OUTPUTS
           Z             z       F(x,y,z)
           Y             y       F(x,y,z)
           X             x       F(x,y,z)

 
Example:      With  A = B = ........................... = N = 1   ( to be stored into R01 thru R14 )

          a1 = sqrt(2)   b1 = sqrt(3)   c1 = sqrt(5)   d1 = sqrt(6)    e1 = sqrt(7)    f1  = sqrt(8)    g1 = sqrt(10)                ( to be stored into
          h1 = sqrt(11)  i1 = sqrt(12)  j1 = sqrt(13)  k1 = sqrt(14)  l1 = sqrt(15)  m1 = sqrt(17)  n1 = sqrt(18)                  R37 thru R50 )

  and   x = 0.1   y = 0.2   z = 0.3

  0.3   ENTER^
  0.2   ENTER^
  0.1   XEQ "SRI"  >>>>>   F( 0.1 , 0.2 , 0.3 ) = 1.070158801            ---Execution time = 7m18s---
 

Notes:

-The routine is obviously very slow and a good emulator like V41 is probably preferable.
-Execution time may be saved if you add 7 other subroutines similar to  LBL 01 .....  LBL 07  with  /  instead of  FC? 10  1/X  *

-This program does not check if the series is convergent or not.
-If A = B = ..... = N = 0 , "SRI"  returns  exp(x+y+z)

-The termination criterion may be doubtful for certain values of the parameters:
-Press  XEQ 10  without changing the stack to check.