Re: [racket] Math library kudos

2013-02-20 Thread Joe Gilray
Hi Jens, You are probably right (no pun intended!), but I was only looking at the docs and since prime-strong-pseudo-single? is unexported and not in the docs, I didn't see it. I may not fully understand your code, but where do you put in the number of trials (it is not in the signature of prime-

Re: [racket] Math library kudos

2013-02-20 Thread Jens Axel Søgaard
Hi Joe, 2013/2/20 Joe Gilray : > Racketeers, > > Thanks for putting together the fantastic math library. It will be a > wonderful resource. Here are some quick impressions (after playing mostly > with math/number-theory) > > 1) The functions passed all my tests and were very fast. If you need e

Re: [racket] Math library kudos

2013-02-20 Thread Luke Vilnis
I did a google search for log-gamma and then browsed around the documentation. I think the issue is I was poking through the "Special Functions" and statistics functions sections, but the binomial stuff is under the "flonum" section, even though fllog-gamma can be found in "Special Functions." May

Re: [racket] Math library kudos

2013-02-20 Thread Neil Toronto
You're welcome! A user not finding a documented function is excellent feedback. It means we need to communicate better. Do you remember how you searched for a combinations function? Neil ⊥ On 02/20/2013 08:45 AM, Luke Vilnis wrote: Ha! Sorry for not reading the documentation more thoroughly

Re: [racket] Math library kudos

2013-02-20 Thread Luke Vilnis
Ha! Sorry for not reading the documentation more thoroughly - I hope this was at least a bit educational to someone besides me :) Fantastic library and docs, by the way. On Wed, Feb 20, 2013 at 10:38 AM, Neil Toronto wrote: > On 02/20/2013 06:42 AM, Luke Vilnis wrote: > >> No problem. They should

Re: [racket] Math library kudos

2013-02-20 Thread Neil Toronto
On 02/20/2013 06:42 AM, Luke Vilnis wrote: No problem. They should be faster even for fairly small numbers since they usually require the evaluation of a polynomial (an approximation of (log)gamma) versus repeated multiplication/division. From memory the code should be something like: (exp (fllo

Re: [racket] Math library kudos

2013-02-20 Thread Neil Toronto
On 02/19/2013 05:28 PM, Joe Gilray wrote: Racketeers, Thanks for putting together the fantastic math library. It will be a wonderful resource. Here are some quick impressions (after playing mostly with math/number-theory) The thanks in this case goes to Jens Axel, who wrote almost all of the

Re: [racket] Math library kudos

2013-02-20 Thread Haiwei Zhou
Hi Joe, There is a straight way to calculate product. (define (combinations n r) (/ (for/product ([i (in-range n (- n r) -1)]) i) (for/product ([i (in-range r 1 -1 )]) i))) Regards, haiwei On 20 February 2013 14:44, Joe Gilray wrote: > Hi Luke, > > Thanks for the knowledge. Do you ha

Re: [racket] Math library kudos

2013-02-20 Thread Luke Vilnis
No problem. They should be faster even for fairly small numbers since they usually require the evaluation of a polynomial (an approximation of (log)gamma) versus repeated multiplication/division. From memory the code should be something like: (exp (fllog-gamma (+ 1.0 n)) - (fllog-gamma (+ 1.0 r))

Re: [racket] Math library kudos

2013-02-19 Thread Joe Gilray
Hi Luke, Thanks for the knowledge. Do you have some code that I could try out. I found gamma and bflog-gamma, but they work with floats and so I can't imagine they are faster for exact answers... maybe for estimating nCr for large numbers? -Joe On Tue, Feb 19, 2013 at 8:26 PM, Luke Vilnis wr

Re: [racket] Math library kudos

2013-02-19 Thread Luke Vilnis
FYI, log gamma is another fast way to calculate the number of combinations if you want to deal with really big numbers. On Tue, Feb 19, 2013 at 7:28 PM, Joe Gilray wrote: > Racketeers, > > Thanks for putting together the fantastic math library. It will be a > wonderful resource. Here are some

[racket] Math library kudos

2013-02-19 Thread Joe Gilray
Racketeers, Thanks for putting together the fantastic math library. It will be a wonderful resource. Here are some quick impressions (after playing mostly with math/number-theory) 1) The functions passed all my tests and were very fast. If you need even more speed you can keep a list of primes