You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2010/07/01 19:12:12 UTC

DO NOT REPLY [Bug 49538] New: [PATCH] Implementing a excel predefined function POISSON

https://issues.apache.org/bugzilla/show_bug.cgi?id=49538

           Summary: [PATCH] Implementing a excel predefined function
                    POISSON
           Product: POI
           Version: 3.7-dev
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: kparmar1@hotmail.com


Created an attachment (id=25678)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25678)
This is the zip of the patch file and the junit test.

I have implemented the Poisson function ( within the NumericFunctions ).  This
also had the implication that I needed to use another library ( common-math -
as I need not want to reinvent ) but I have updated the ant build.xml
appropriately. 

I have also supplied a unit test for this function.  I have only done this very
quickly therefore ( although it does work - with validation and a unit test) it
would be good for someone to verify that my changes are ok within your
framework.

I have attached the addition file (unit test) but it seems that when I created
the patch it has included this new file in it (I have used tortoiseSVN to
create the patch).

The zip poi-hssf-poisson-patch.zip is attached.


Hope this is helpful.  If not please ask for any other info.

Regards,

Kalpesh

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 49538] [PATCH] Implementing a excel predefined function POISSON

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49538

--- Comment #4 from Kalpesh Parmar <kp...@hotmail.com> 2010-07-07 04:51:23 EDT ---
Created an attachment (id=25725)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25725)
[Patch] The re-corrected Poisson implementation function

Current version for the Poisson implemented fuinction.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 49538] [PATCH] Implementing a excel predefined function POISSON

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49538

Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #6 from Yegor Kozlov <ye...@dinom.ru> 2010-07-26 08:24:56 EDT ---
Thanks for the patch, applied in r979255

We had a debate whether to depend on commons-math or not and we think in the
case of POISSON  we can do without third party libraries, the implementation of
Poisson distribution is really a few lines of code: 

        private double probability(int k, double lambda) {
            return Math.pow(lambda, k) * Math.exp(-lambda) / factorial(k);
        }

        private double cumulativeProbability(int x, double lambda) {
            double result = 0;
            for(int k = 0; k <= x; k++){
                result += probability(k, lambda);
            }
            return result;
        }


Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 49538] [PATCH] Implementing a excel predefined function POISSON

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49538

Kalpesh Parmar <kp...@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kparmar1@hotmail.com

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 49538] [PATCH] Implementing a excel predefined function POISSON

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49538

Kalpesh Parmar <kp...@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #25678|0                           |1
        is obsolete|                            |

--- Comment #2 from Kalpesh Parmar <kp...@hotmail.com> 2010-07-06 06:03:07 EDT ---
Created an attachment (id=25712)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25712)
[Patch] The corrected Poisson implementation function

Update of the first patch I posted.  I have added additional details below.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 49538] [PATCH] Implementing a excel predefined function POISSON

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49538

--- Comment #1 from Kalpesh Parmar <kp...@hotmail.com> 2010-07-06 06:00:46 EDT ---
I have updated the patch as I missed out the case where if x is a decimal excel
will automatically truncate it (now it is compliant with the excel definition
of the Poisson function)

Regards,

I have (as before) attached the zip file which contains the patch ( created as
before ) and the updated junit test.

poi-hssf-poisson-patch2.zip is now the one to use.

Thanks

Kalpesh

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 49538] [PATCH] Implementing a excel predefined function POISSON

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49538

Kalpesh Parmar <kp...@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #25712|0                           |1
        is obsolete|                            |

--- Comment #3 from Kalpesh Parmar <kp...@hotmail.com> 2010-07-07 04:43:47 EDT ---
(From update of attachment 25712)
There is an updated patch that should be used.  See details for the next
attachment.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 49538] [PATCH] Implementing a excel predefined function POISSON

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49538

--- Comment #5 from Kalpesh Parmar <kp...@hotmail.com> 2010-07-07 04:52:20 EDT ---
Hi,

I have provided yet another update for the patch I posted.  The reason is that
excel implementation for Poisson for x - 0 and mean - 0 is 1.  This is
different to that of commons implementation ( it errors which actually is what
should happen ).  
I have followed the result that excel gives and now return a 1 in this case (
this I do not believe is right but its what excel does so I am being consistent
with excel).

The zip poi-hssf-poisson-patch3.zip is attached above ( contains the patch and
updated junit test).

Regards,

Kalpesh

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org