[racket] Math library kudos

From: Luke Vilnis (lvilnis at gmail.com)
Date: Wed Feb 20 10:45:50 EST 2013

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 <neil.toronto at gmail.com>wrote:

> 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 (fllog-gamma (+ 1.0 n)) - (fllog-gamma (+ 1.0 r)) - (fllog-gamma (+
>> 1.0 (- n r))))
>>
>> fllog-gamma should also be faster than bflog-gamma or log-gamma if you
>> don't need arbitrary precision. You're also right that this won't always
>> give completely exact results - the Racket manual says that the only
>> exact values are for log gamma of 1 and 2, but this usually is not a
>> problem.
>>
>> PS. It looks like Racket's math collection has a built-in log-factorial
>> function too, to avoid all the +1's, so you could try that.
>>
>
> There's also `fllog-binomial', which computes the log number of
> combinations directly. IIRC, its maximum observed error is 2 ulps.
>
> Neil ⊥
>
>
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/**users <http://lists.racket-lang.org/users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130220/dcf66b64/attachment.html>

Posted on the users mailing list.