Odd results using the COMBIN function

大兔子大兔子 提交于 2019-12-13 02:10:09

问题


I am a mathematics student and was given a proof detailed in this link.

Out of curiosity I tried setting that up in a an Excel table with columns as N and rows as K, so that:

=COMBIN(R$6,$B16)-COMBIN(R$6-1,$B16)-COMBIN(R$6-1,$B16-1)

should equal 0. For the most part it does but sometimes I get odd results. For example:

=COMBIN(110,35)-COMBIN(110-1,35)-COMBIN(110-1,35-1)=0

and

=COMBIN(110,45)-COMBIN(110-1,45)-COMBIN(110-1,45-1)=0

but

=COMBIN(110,40)-COMBIN(110-1,40)-COMBIN(110-1,40-1)=633318697598976

Can somebody tell me why this is happening?


回答1:


I’m afraid the answer has to be the lack of precision in Excel (15 digits max) but maybe that is not really a good enough answer.

Excel’s =COMBIN() function for A2 (say 110) and B2 (say 35) can be broken down as:

=FACT(A2)/(FACT(A2-B2)*FACT(B2))

The top part of the image below shows this (and confirms your results!):

The bottom part breaks that formula down into its components, showing that the largest element has a value 1.5882E+178. That is well within Excel’s limit for formulae of +/-1.7976931348623158e+308 but presumably is actually something between:

15882455415227300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

and

15882455415227500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

which I guess is the problem.

What puzzles me is that sticking with 110, the discrepancies arise only 29 times in the B2 range 1-109 – but for any explanation of that it may be best to revert to Mathematics!



来源:https://stackoverflow.com/questions/18746815/odd-results-using-the-combin-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!