commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amey Jadiye <>
Subject [NUMBERS] Proposal for refactoring and extension of Gamma functions.
Date Mon, 05 Jun 2017 19:44:38 GMT
Hi All,

Coming from discussion happened here

As Gamma is nothing but advanced factorial function gamma(n)=(n-1)! with
advantages like we can have factorial of whole numbers as well as
factional. Now as [Gamma functions ( ) which is having general
formula {{Gamma( x ) = integral( t^(x-1) e^(-t), t = 0 .. infinity)}} is a
plane old base function however Lanczos approximation / Stirling's
approximation /Spouge's Approximation  *is a* gamma function so they should
be extend Gamma.

Exact algorithm and formulas here :
 - Lanczo's Approximation -
 - Stirling's Approximation  -
 - Spouge's Approximation -

Why to refactor code is because basic gamma function computes not so
accurate/precision values so someone who need quick computation without
precision can choose it, while someone who need precision overs cost of
performance (Lanczos approximation is accurate so its slow takes more cpu
cycle) can choose which algorithm they want.

for some scientific application all values should be computed with great
precision, with out Gamma class no choice is given for choosing which
algorithm user want.

I'm proposing to create something like:

Gamma gammaFun = new Gamma(); gammaFun.value( x );
Gamma gammaFun = new LanczosGamma(); gammaFun.value( x );
Gamma gammaFun = new StirlingsGamma(); gammaFun.value( x );
Gamma gammaFun = new SpougesGamma(); gammaFun.value( x );

Also as the class name suggestion {{LanczosApproximation}} it should
execute/implement full *Lanczos Algoritham* but we are just computing
coefficients in that class which is incorrect, so just refactoring is
needed which wont break any dependency of this class anywhere. (will modify
code such way).

let me know your thoughts?

To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message