Post Reply 
Digamma Function for the free42
04-23-2022, 05:56 PM
Post: #4
RE: Digamma Function for the free42
Previous Psi code seems unable to cope with complex argument.
Storing complex numbers in memory 11 cause a "Invalid Type" error. (why ?)

This version do it all in the stack.
Code:
00 { 60-Byte Prgm }
01▸LBL "Psi"
02 32.5
03 +            @ X2 = X - .5 + 33
04 ENTER
05 ENTER
06 1/X
07 .3986        @ .3986 1/X2 X2 X2
08 ×
09 +
10 3.7
11 X<>Y
12 ÷
13 X<>Y
14 24
15 ×
16 +
17 1/X
18 +
19 LN
20 33.5         @ N+.5  Y   X2  X2
21 STO- ST Z
22 IP  
23 X<>Y         @ Y     N   X-1 X2
24▸LBL 00
25 RCL ST Z     @ X-1   Y   N   X-1
26 RCL+ ST Z    @ X-1+N Y   N   X-1
27 1/X
28 -
29 DSE ST Y     @ Y'    N'  X-1 X-1
30 GTO 00
31 END

Example, Ψ(1+i)

1+i XEQ "Psi"      → 0.094650320622476991469435654672848+1.076674047468581096181134287806413i

Argument with negative real part, we can use reflection formula

\( ψ(z) = ψ(1-z) - \pi \cot(\pi\,z) \)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Digamma Function for the free42 - Juan14 - 04-22-2022, 02:20 PM
RE: Digamma Function for the free42 - Albert Chan - 04-23-2022 05:56 PM



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