Skip to content

how to calculate this natural logarithm

2 messages · cgw at witthoft.com, Mike Marchywka

#
You could re-do part of your code to run with mpfr-class variables, and  use
   this function:
   # mpfr choose(n,k)
    rmpfac<-function(n,k,prec=50)
   factorial(mpfr(n,prec))/factorial(mpfr(k,prec))/factorial(mpfr(n-k,prec))
   Converting into and out of mpfr may not be worth it, but you will get all
   the precision you want without any nasty "Inf" results
   :-)
   Carl
1 day later
#
Is the OP still here? I was curious what end result you were
after and if you tried any of these approaches. Apparently the quantity
here is something like 5000 which could probably itself
be an intermediate. If you took the approach of using algebra, as suggested
by earlier posters, and your
end result was supposed to be between 0 and 1, there would probably be
more simplifications to make. IIRC, you had terms like 
n!(2n!)
---------------------------
k!(n-k)!(600-k)!(2n-600+k)!
and you could cancel a lot ahead of time. You'd think
somewhere, like in statistical mechanics, this would be a well known
issue.