Gamma Functions

Gamma Functions - rapid speed with precision - Mensajes

#21 Publicado: 11/6/2021 14:49:26
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Sanity checked vs Mathcad 11.
Cuts the mustard a bit finer than first version.
Γ(1,0)="Uncertainty" unsolved.
#22 Publicado: 11/6/2021 14:56:09
overlord

overlord

600 me gusta en 1.381 mensajes.

Grupo: Moderator

Wrote

Sanity checked vs Mathcad 11.
Cuts the mustard a bit finer than first version.
Γ(1,0)="Uncertainty" unsolved.


There is no uncertainty in gamma_r6.
Everything look correct with those numbers.

Γ(1)=1
γ(1,0)=0
Γ(1,0)=1

2021-06-11_20-54.png
#23 Publicado: 11/6/2021 16:33:56
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

1. Example 3 ... added
2. Uncertainty solved for version not having 0 defined.

Gamma [overlord sr.6].sm (39,32 KiB) descargado 1203 vez(es).
#24 Publicado: 12/6/2021 2:20:08
Alvaro

Alvaro

1.139 me gusta en 1.805 mensajes.

Grupo: User

Wrote

...
3. don't want to disrespect, Alvaro's is a single line awesome code.
4. mine has same algorithm with more features, with faster calculation.
...



Hi overlord, of course you don't. My codes are mostly pedagogical, not for optimized for speed nor accuracy or something else. It's good to have codes with that.

Best regards.
Alvaro.
#25 Publicado: 12/6/2021 10:15:48
overlord

overlord

600 me gusta en 1.381 mensajes.

Grupo: Moderator

Wrote

Hi overlord, of course you don't. My codes are mostly pedagogical, not for optimized for speed nor accuracy or something else. It's good to have codes with that.

Best regards.
Alvaro.


Thanks, inspired by your code using sum(), and eliminating some useless variable definitions;
I have managed to speed up 30% percent under linux. And should be more precise now.
Only the 15th decimal digit may differs, and this is only sometimes.

Regards.

gamma_r7.sm (28,8 KiB) descargado 1506 vez(es).

2021-06-12_18-31.png
#26 Publicado: 12/6/2021 14:58:22
overlord

overlord

600 me gusta en 1.381 mensajes.

Grupo: Moderator

Apparently solve() can't read product() too.
Had to change algorithm style for incomplete function.
Hopefully this is the last version.
Well, I have my doubts... (swh)

Regards

PS: solvers may not found an answer just because variable names, Razonar's idea implemented.

gamma_r8.sm (29,61 KiB) descargado 1506 vez(es).
gamma_r8.sm (31,51 KiB) descargado 1530 vez(es). <---gamma_r8-2 (function variable revision)

2021-06-13_01-47.png
#27 Publicado: 12/6/2021 20:03:48
Alvaro

Alvaro

1.139 me gusta en 1.805 mensajes.

Grupo: User

Wrote

Wrote

Hi overlord, of course you don't. My codes are mostly pedagogical, not for optimized for speed nor accuracy or something else. It's good to have codes with that.

Best regards.
Alvaro.


Thanks, inspired by your code using sum(), and eliminating some useless variable definitions;
I have managed to speed up 30% percent under linux. And should be more precise now.
Only the 15th decimal digit may differs, and this is only sometimes.

Regards.



The algorithm is valid for Re(z) > 0. See this notes please.

gamma.sm (27,93 KiB) descargado 1965 vez(es).

Best regards.
Alvaro.

#28 Publicado: 12/6/2021 20:20:04
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Wrote

Hopefully this is the last version.
Well, I have my doubts... (swh)


Can't be more right !
1. Smath Lanczos Davide code is 1/1 Keisan, Mathcad 11.
2. It supports imaginary argument.
3. It supports RootSecant.
4. Confirmed, your last Lanczos does not support RootSecant.
I haven't checked Alvaro suggestion.

Lanczos.PNG
#29 Publicado: 12/6/2021 20:23:36
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

... just a remark:
Mathsoft suggested use exp(,) instead of e^.
exp(,) more accurate/faster at kernel level.
#30 Publicado: 13/6/2021 1:26:31
overlord

overlord

600 me gusta en 1.381 mensajes.

Grupo: Moderator

Imaginary numbers supplicated.
Root Secant better than HT Davis. (last digit)
Graphing works for all functions.
Usually all solve methods works.

Regards

gamma_r9.sm (36,93 KiB) descargado 1913 vez(es).

2021-06-13_07-19.png
#31 Publicado: 13/6/2021 11:18:41
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Your latest sr.9 is mostly red in SS 6179, takes Eternity.
Who cares ^308 ?
On the other hand, could be damned slow in practical applications.
Because not being built-in in native Smath ... proof:
Lanczos plots Hypergeometric but takes 1 min versus resident Gamma(x).
Why not use Lanczos as given by Davide ?
#32 Publicado: 13/6/2021 15:26:22
overlord

overlord

600 me gusta en 1.381 mensajes.

Grupo: Moderator

Wrote

Your latest sr.9 is mostly red in SS 6179, takes Eternity.
Who cares ^308 ?
On the other hand, could be damned slow in practical applications.
Because not being built-in in native Smath ... proof:
Lanczos plots Hypergeometric but takes 1 min versus resident Gamma(x).
Why not use Lanczos as given by Davide ?


- Who cares SMath 6179?
- My algorithm is faster than your examples.
- My Γ(x) prints hypergeom in less than a second, don't need integrated Gamma().
- Because my function has more features, and faster.

Your PC is slow, your SMath_6179 is slow and broken, your examples are slow.

Gamma [H.T. Davis, Lanczos_overlord].sm (62,36 KiB) descargado 1385 vez(es).
Gamma [H.T. Davis, Lanczos_overlord].pdf (155,73 KiB) descargado 809 vez(es).

Gamma [H.T. Davis, Lanczos_overlord].png
  • Nuevos mensajes
  • Sin mensajes nuevos