[ 
https://issues.apache.org/jira/browse/MATH-178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul Cowan updated MATH-178:
----------------------------

    Attachment: ZipfDistribution2.patch

Attached is a version which addresses the test failure (note to self: rerun the 
tests after that 'one last tidy-up before submitting the patch, that's what 
they're FOR!)

1) No real opinion as to whether this is 1.2-worthy or should wait for 2.0. We 
have no pressing need for it to be included; if it's ready + everyone's happy 
with it in time for 1.2, well and good, if not, then 2.0 is fine.

2) I will move the harmonic stuff into its own class. Should this just live in 
o.a.commons.math.special, or is there a more suitable place?

3) I'll admit I don't know a better algorithm. I'm working on it, but the math 
is WAY over my head. Wikipedia gives a generating function 
http://upload.wikimedia.org/math/4/2/b/42bbc9c32faf3beee2f6920de77fb770.png at 
("where Lim(z) is the polylogarithm, and | z | < 1. ") but my math skills are 
so atrophied that working out whether that can be converted into an easy 
generating algorithm (and if so, how) is a little beyond me. There's some 
interesting info at http://www.research.att.com/~njas/sequences/A001008 -- it 
looks like Knuth covers harmonic numbers in SOME way in TAOCP, volume 1, but I 
don't have a copy to hand.

I'll keep looking at this; if no such number can be found precomputing a lookup 
table may be the best bet (perhaps multiple implementations of ZipfDistribution 
could exist; one which does it 'naively' but slowly, one which caches an array 
of size [numberOfElements] on first access (speed at the cost of memory)

> Implement Zipf distribution
> ---------------------------
>
>                 Key: MATH-178
>                 URL: https://issues.apache.org/jira/browse/MATH-178
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Paul Cowan
>            Priority: Minor
>         Attachments: ZipfDistribution.patch, ZipfDistribution2.patch
>
>
> Per my post to commons-dev -- 
> http://mail-archives.apache.org/mod_mbox/commons-dev/200801.mbox/[EMAIL 
> PROTECTED] -- I'd like to propose adding a Zipf distribution to commons-math.
> I have a patch, but it's incomplete and somewhat inefficient; I'd like to 
> throw it up for discussion though. To follow.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to