On Thu, Jun 23, 2011 at 10:51:22AM +1000, Aaron Peachey wrote: > On Thu, Jun 23, 2011 at 3:34 AM, Matthew Paul Thomas <[email protected]> > wrote: > > (I would like to be able to include, in the specification, test cases > > with expected numeric results that weren't calculated by the actual USC > > implementation. But I have neither a book of statistical tables to > > calculate it by hand, nor the ability to figure out quickly how to > > install the statistics2 Ruby gem to try the sample code on the above Web > > page. So if anyone would like to help out with that too, that would be > > great.) > > > > I had a look around to see if I could find a python implementation of > pnormaldist but didn't run into any luck. > > So I've used the ruby source to re-write the ruby > statistics2.pnormaldist function in python so we can easily utilise > this instead of having to rely on the ruby version. > > The file pnormaldist.tar.gz available here (http://db.tt/Bx9hmu0) has > two scripts in it. > pnormaldist.py - my python re-write and a main function to print the > output of pnormaldist with values of 0.1 to 0.9 in 0.1 steps > pnormaldist.rb. - the original statistics2.pnormaldist ruby function > and print statements to print the same output [..]
Thanks! Great that you took the time to convert it. I had a quick look at this ruby statistics2 package license, but I could find anything. It would be good to clarify the license. I don't actually think that our version falls strictly under "derived work" as its a implementation of a mathematical algorithm (and its pretty short) so there is something like a obvious way of doing it (which is given by the math). But if the license is something like MIT or even public domain that would make this a total no-problem. > Run like this: > python pnormaldist.py > ruby pnormaldist.rb > > to confirm the function works as expected. Change the values in the > print functions as required to test other arguments. [..] Ideally the ruby package would have a testsuite with some numerical values to test against, but apparently that is not the case, the only thing seems to be http://blade.nagaokaut.ac.jp/~sinara/ruby/math/statistics2/statistics2-0.53/README : Example: require "statistics2" puts Statistics2.normaldist(0.27) #=> 0.606419873198039 Cheers, Michael _______________________________________________ Mailing list: https://launchpad.net/~software-store-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~software-store-developers More help : https://help.launchpad.net/ListHelp

