I have defined the following function in Mathematica,
f[n_,q_] = Log[(n+q-1)!/(q!*(n-1)!)];
When putting in a large number, say f[650,110]
, the result is
Log[10408292...]
when I want the output to give me the evaluation of the natural logarithm (which ends up being about 310 in this case). I have made several attempts including changing the display precision in the settings - didn't work, setting the precision in the function,
f[n_,q_] = SetPrecision[Log[(n+q-1)!/(q!*(n-1)!)],15];
which gives this output
Log[1.040829240901916×10^135]
as well as specifically telling it to display in scientific notation,
f[n_,q_] = ScientificForm[Log[(n+q-1)!/(q!*(n-1)!)]];
which gives the same display as setting the precision. Could anyone help me with this display problem, please?
Binomial[]
is built-in, so you can useLog[Binomial[n + q - 1, q]]
. Nevertheless, that can still overflow, so consider using the expression in terms ofLogGamma[]
. $\endgroup$