(DM42) Gamma function for complex values
|
04-03-2023, 08:57 AM
(This post was last modified: 04-03-2023 04:12 PM by Gjermund Skailand.)
Post: #1
|
|||
|
|||
(DM42) Gamma function for complex values
Gamma function for complex values s = x +iy for DM42, Free 42
Motivation: The GAMMA function only accept real values. Uses Bernoulli coefficients, requires the program B2n, see earlier post. and reflection formula for x< 0.5 Accurate to 30 digits, (32 for "small" imaginary values). For significant speed increase, pre-calculate and recall the Bernoulli coefficients (line 35). If, say only 10-12 digits is needed, then reduce N from 42 to 15 (line 42),. Compare accuracy with e.g. gamma function at http://www.wolframalpha.com raw file included Code:
inspired by JM Baillard, https://hp41programs.yolasite.com Thanks to Joe Horn for small correction. best regards Gjermund |
|||
04-10-2023, 11:12 AM
Post: #2
|
|||
|
|||
RE: (DM42) Gamma function for complex values
Updated with new version.
Some speed and and accuracy improvement. Gamma function for complex values s = x +iy for DM42, Free42 Motivation: The GAMMA function only accept real values. Uses Bernoulli coefficients, requires the program B2n, see earlier post for details. and reflection formula for x< 0.5 Accurate to 30 digits, (32 for "small" imaginary values). Requires the function B2n, included below. Alternatively , for speed increase, temporarily insert a STOP at line 52, run with e.g (1 i1) then do a manual STO "B34", remove the STOP and change line 52 XEQ "B2N" to 52 RCL "B34" raw file, included in Zetaz.raw With USB power calculation time is approx 0.16s (0.08s with precomputed table) Compare accuracy with e.g. gamma function at http://www.wolframalpha.com DM42: 0.5 i0.5 gamma --> 0.8181639995417473940777488735553224 - 0.7633138287139826166702967877608994 i WolframAlpha: gamma(0.5 + i*0.5) 0.8181639995417473940777488735553249 - 0.7633138287139826166702967877609006 i 2023-04-10 skai new version Code:
brgds Gjermund |
|||
04-10-2023, 03:52 PM
Post: #3
|
|||
|
|||
RE: (DM42) Gamma function for complex values
Minor update, correct files attachef
Gamma function for complex values s = x +iy for DM42, Free42 Motivation: The GAMMA function only accept real values. Uses Bernoulli coefficients, requires the program B2n, see earlier post for details. and reflection formula for x< 0.5 Accurate to 30 digits, (32 for "small" imaginary values). Requires the function B2n, included below. Alternatively , for speed increase, temporarily insert a STOP at line 52, run with e.g (1 i1) then do a manual STO "B34", remove the STOP and change line 52 XEQ "B2N" to 52 RCL "B34" If somewhat reduced accuracy , say 16 digis, change line 41 from 34 to 18 raw file included With USB power calculation time is approx 0.16s (0.08s with precomputed table) Compare accuracy with e.g. gamma function at http://www.wolframalpha.com DM42: 0.5 i0.5 gamma --> 0.8181639995417473940777488735553224 - 0.7633138287139826166702967877608994 i WolframAlpha: gamma(0.5 + i*0.5) 0.8181639995417473940777488735553249 - 0.7633138287139826166702967877609006 i 2023-04-10 skai Code:
brgds Gjermund |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)