Kummer

# Kummer's Function for the HP-41

Overview

1°) Real Variable
2°) Complex Variable

-Kummer's function  M(a,b,x) is defined by

M(a;b;x) = 1 +  (a)1/(b)1. x1/1! + ............. +  (a)n/(b)n . xn/n! + ..........  where (a)n = a(a+1)(a+2) ...... (a+n-1)

1°) Real Variable

Data Registers:             R00 = x                        ( Registers R01 R02 are to be initialized before executing "KUM" )

•   R01 = a
•   R02 = b
Flags: /
Subroutines:  /

 01  LBL "KUM" 02  STO 00 03  CLST 04  SIGN 05  ENTER^ 06  STO T 07  LBL 01 08  X<> T 09  RCL 01        10  R^ 11  ST+ Y 12  RDN 13  * 14  RCL 02        15  R^ 16  ST+ Y 17  ISG X 18  CLX 19  ST* Y 20  RDN 21  / 22  RCL 00        23  * 24  STO T 25  X<>Y 26  ST+ Y 27  X#Y? 28  GTO 01        29  END

( 46 bytes / SIZE 002 )

 STACK INPUTS OUTPUTS X x M(a;b;x) L / x

Example:     Compute  M(2;3;-Pi)

2  STO 01
3  STO 02
PI   CHS   XEQ "KUM"  yields  0.166374562   ( in 13 seconds )

Notes:

a)   2x (Pi)-1/2 M(1/2;3/2;-x2) = erf(x) = error function
b)        (x/2)n  M(n+1/2;2n+1;2x) = Gamma(1+n) ex In(x)        where     In  = a modified Bessel function
c)       (xa/a)   M(a;a+1;-x)  =  incgam(a;x)  = §0x e-t ta-1 dt                ( incgam = incomplete gamma function )

and many other functions are related to Kummer's functions.

2°) Complex Variable

-The parameters  a & b are still real, but the variable  z = x + i.y  is complex

Data Registers:        R00 and R03 thru R08: temp                  ( Registers R01 R02 are to be initialized before executing "KUMZ" )

•   R01 = a
•   R02 = b
Flags: /
Subroutines:  /

 01  LBL "KUMZ" 02  R-P 03  STO 00 04  X<>Y 05  STO 03 06  CLX 07  STO 05 08  STO 06 09  STO 08 10  SIGN 11  STO 04 12  STO 07 13  LBL 01           14  RCL 03 15  RCL 08 16  + 17  STO 08 18  RCL 01 19  RCL 02 20  RCL 06 21  ST+ Z 22  + 23  ISG 06 24  CLX 25  RCL 06           26  * 27  / 28  RCL 00 29  * 30  RCL 07 31  * 32  STO 07 33  P-R 34  RCL 04 35  + 36  STO 04           37  LASTX 38  - 39  X^2 40  X<>Y 41  RCL 05 42  + 43  STO 05 44  LASTX 45  - 46  X^2 47  + 48  X#0? 49  GTO 01           50  RCL 05 51  RCL 04 52  END

( 64 bytes / SIZE 009 )

 STACK INPUTS OUTPUTS Y y y' X x x'

with  Kum ( a ; b ; x+i.y ) = x' + i.y'

Example:     If  a = 4 ;  b = 3     4  STO 01   3  STO 02

2  ENTER^
1  XEQ "KUMZ  >>>>   -3.156090293   X<>Y   2.541499313

Whence    Kum ( 4 ; 3 ; 1 + 2.i ) =  -3.156090293 + i. 2.541499313

Reference:

[1]  Abramowitz and Stegun , "Handbook of Mathematical Functions" -  Dover Publications -  ISBN  0-486-61272-4