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 - 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 <[email protected]
<mailto:[email protected]>> 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>



____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to