Large numbers multiplied by small numbers
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi, I'm trying to compute at multinomial distribution as described here but my numbers are very large, so for example I have
(factorial(10201))/(factorial(1779)*factorial(8048)*factorial(374))*(0.1754515^1779)*(0.794171^8048)*(0.030847^374)
I could probably get round the large factorials without much difficulty by cancelling before computing, but I'm stuck with the very small multipliers which always evaluate to zero. I've considered splitting the indices up, so they can be multiplied separately. However as this case demonstrates, I still run into problems with large primes. i.e.
0.1754515^1779 = (0.1754515^593)^3
but 0.1754515^593 still evaluates to zero and 593 is prime. Is there any way to do this?
Thanks,
James
댓글 수: 0
채택된 답변
James Tursa
2013년 10월 8일
편집: James Tursa
2013년 10월 8일
Some options:
1) Use the symbolic toolbox
2) Work with the log of the expression
If I have done the math correctly,
exp(gammaln(10201+1) + 1779*log(0.1754515) + 8084*log(0.794171) + 374*log(0.030847) - gammaln(1779+1) - gammaln(8084+1) - gammaln(374+1))
= 6.280311697766785e-149
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!