You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Amey Jadiye (JIRA)" <ji...@apache.org> on 2017/06/05 19:03:04 UTC

[jira] [Comment Edited] (NUMBERS-38) No unit tests for "LanczosApproximation" class

    [ https://issues.apache.org/jira/browse/NUMBERS-38?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16036254#comment-16036254 ] 

Amey Jadiye edited comment on NUMBERS-38 at 6/5/17 7:02 PM:
------------------------------------------------------------

Hi [~erans]

My initial thoughts was the formula given in code itself is the marker to test and is perfectly written (as present in apache's project), your comment forced me to verify everything from roots which ended up me reading lots of papers and watching youtube  on Gamma functions and approximations _(including great interview of [Cornelius Lanczos|https://www.youtube.com/watch?v=avSHHi9QCjA])_ and finally I found our Code is Buggy generating  wrong values for inputs :( _(design bug not code!)_

There are the some references I cross verified the test input/outputs _(both produce same result and our code produce something else)_

- [https://rosettacode.org/wiki/Gamma_function#Java]
- [https://en.wikipedia.org/wiki/Lanczos_approximation] (_this is python but generates same outputs_)
 
I saw coefficient are take from (which are standard anyway), no matter which set you take results are approx same.
- [https://mrob.com/pub/ries/lanczos-gamma.html]

For more cross verification there is online gamma calculator which also gives same result.
- [http://www.efunda.com/math/gamma/findgamma.cfm]

All that I said, our code need to be fixed and it should generate {{gamma(z)=(n-1)!}}  (n minus one factorial) values.

let me know your thoughts.


was (Author: ameyjadiye):
Hi [~erans]

My initial thoughts was the formula given in code itself is the marker to test and is perfectly written (as present in apache's project), your comment forced me to verify everything from roots which ended up me reading lots of papers and watching youtube  on Gamma functions and approximations _(including great interview of [Cornelius Lanczos|https://www.youtube.com/watch?v=avSHHi9QCjA])_ and finally I found our Code is Buggy generating  wrong values for inputs :(

There are the some references I cross verified the test input/outputs _(both produce same result and our code produce something else)_

- [https://rosettacode.org/wiki/Gamma_function#Java]
- [https://en.wikipedia.org/wiki/Lanczos_approximation] (_this is python but generates same outputs_)
 
I saw coefficient are take from (which are standard anyway), no matter which set you take results are approx same.
- [https://mrob.com/pub/ries/lanczos-gamma.html]

For more cross verification there is online gamma calculator which also gives same result.
- [http://www.efunda.com/math/gamma/findgamma.cfm]

All that I said, our code need to be fixed and it should generate {{gamma(z)=(n-1)!}}  (n minus one factorial) values.

let me know your thoughts.

> No unit tests for "LanczosApproximation" class
> ----------------------------------------------
>
>                 Key: NUMBERS-38
>                 URL: https://issues.apache.org/jira/browse/NUMBERS-38
>             Project: Commons Numbers
>          Issue Type: Test
>            Reporter: Gilles
>              Labels: unit-test
>             Fix For: 1.0
>
>         Attachments: NUMBERS-38.patch
>
>
> The computation of the {{LanczosApproximation}} (package {{o.a.c.numbers.gamma}} in module {{commons-numbers-gamma}}) function is not checked by unit tests.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)