Post Reply 
using factorial in probability question
09-27-2017, 05:21 PM
Post: #11
RE: using factorial in probability question
(09-27-2017 07:28 AM)Joe Horn Wrote:  
(09-27-2017 05:26 AM)resolved Wrote:  ... please explain why in HOME mode

365! / 252! I get 489.03... but
365! / 253! I get 0

I thought it might have to do with the calculator reaching it's limits, that is why searched for them

Home's upper limit for reals is 9.99999999999E499. Try 365! by itself in Home. You'll see that it overflows and returns 9.99999999999E499, so dividing it by anything will return a meaningless result. The result you saw for 365!/252! is therefore meaningless (namely, 9.99999999999E499/252!). The ACTUAL value for 365! is approx 2.51E778 which is too big for Home to handle, so it simply returns the overflow value.

If you want to calculate A!/B! for large values of A, use PERM(A,A-B). So 365!/252! would be PERM(365,365-252) = approx 1.23E281, and 365!/253! would be PERM(365,365-253) = approx 4.85E278. This lets you calculate the ratios of very large factorials IF the final result is not greater than Home's maximum.

Quote:In CAS mode

365! / 252! I get undef
365! / 170! I get a huge number, I press a b/c and get +inf

In the CAS settings, the "Exact" is NOT checked --- by not checking the Exact option, doesn't this take the answer out of exact and put in decimal form???

CAS's upper limit for reals is approx 1.8E308, which is less than Home's limit, so don't use CAS for number crunching on reals, but only for exact integers and/or exact symbolic math. So turn Exact back on in CAS Settings and leave it that way.

However, there's a nifty way of viewing very large integers as reals in CAS even when they are much larger than CAS's usual maximum. For example, 1000! is clearly too large even for Home to display, but in CAS you can do this:

format(1000!,"d17") --> "4.0238726007709377e+2567"

which means 1000! is approximately 4 times 10^2567. Cool, huh?

That's how I knew above that 365! is approx 2.51E778. Try it in CAS: format(365!,"d17").

"d17" means "give me 17 digits". 17 is the most that format() will give accurately, so I always use 17.

Both of the factorial divisions you gave above are calculated and displayed correctly if you use this format() method in Exact mode.

Quote:In the CAS settings, Number Format is set to Scientific, yet the result is a string of numbers???

The "Number Format" in the CAS Settings is only used by the string() command in CAS, not ordinary calculations, because (again) CAS is not intended for ordinary number crunching on reals. Use Home for that. The "Number Format" in Home Settings does control the way Home displays real numbers.

Knowing when to use Home and when to use CAS takes some getting used to. Keeping their respective limitations in mind helps, but in general use Home for real number crunching and only use CAS for exact integers and/or symbolic math. And use format() to display large integers in CAS as reals.


Great post!
I always appreciate Joe's concise explanations.
It's a joy to follow these posts and see that after so many years (for me, since
late 80's at university) people still review, hack and share their findings on the subject.
Thank you all.
MC
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: using factorial in probability question - lost2 - 09-27-2017 05:21 PM



User(s) browsing this thread: 1 Guest(s)