using factorial in probability question

09272017, 02:31 AM
Post: #1




using factorial in probability question
software version 10024
hardware version C I will update later  calculator just purchased a few days ago Problem: what is the probability of 2 people having the same birthday amongst 30 people??? Solution: 1  365! / ((36530)!*365^30) = 0.706316 my answer on the HP Prime is +inf  not good in HOME the highest factorial I can get is 253! before it max out in CAS the highest factorial I can get is 170! before I get +inft in HOME 365! / 253! i get 0 365! / 252! i get 489.03 In CAS 365! / 252! i get a huge number several 100 digits long how can I solve this problem on the HP Prime???? 

09272017, 03:25 AM
(This post was last modified: 09272017 03:36 AM by chromos.)
Post: #2




RE: using factorial in probability question
1PERM(365,30)/365^30
btw. in your example, you'll get 0.706... in CAS after pushing ab/c button, [or you can type any number with decimal point to force CAS to "decimal" answer  see dot after first digit: 1.  365! / ((36530)!*365^30)] Geocaching Coords Solver, Number of triangles Puzzle 

09272017, 04:32 AM
Post: #3




RE: using factorial in probability question
why would the maximum factorials top out differently between HOME and CAS mode??


09272017, 04:39 AM
Post: #4




RE: using factorial in probability question
Thanks chromes,
I tried your solution in HOME mode and got the correct solution I tried your solution in CAS mode and the answer was undef ???? why does this solution only work in the one mode???? Sad that the Prime can not handle the raw numbers.....the TI85 can, the Prime's failure has cost me three hours of frustration trying to figure out what I was doing wrong... 

09272017, 04:49 AM
Post: #5




RE: using factorial in probability question
(09272017 03:25 AM)chromos Wrote: btw. in your example, you'll get 0.706... in CAS after pushing ab/c button, [or you can type any number with decimal point to force CAS to "decimal" answer  see dot after first digit: 1.  365! / ((36530)!*365^30)] Just press ShiftEnter to do an approximate evaluation. That is why it is the shifted enter operation. The the original poster, you aren't getting a "number" several hundred numbers long, you are getting a fraction of two very, very, very large numbers. Please take some time to understand the responses from people *WHY* the answers you posted are actually correct (each of them reall is!) and what actually is the difference between home/cas or approximate/exact. These are very important concepts in mathematical understanding and understanding them is critical in being able to understand math in general. If nobody else posts on these topics, I'll try to get you a response tomorrow. TW Although I work for the HP calculator group, the views and opinions I post here are my own. 

09272017, 04:50 AM
Post: #6




RE: using factorial in probability question
(09272017 04:39 AM)resolved Wrote: Sad that the Prime can not handle the raw numbers.....the TI85 can, the Prime's failure has cost me three hours of frustration trying to figure out what I was doing wrong... It can and is doing so perfectly. It is doing exactly what you are asking it to do. The problem is you don't know that what you are asking is different then what you think you are asking! TW Although I work for the HP calculator group, the views and opinions I post here are my own. 

09272017, 05:26 AM
Post: #7




RE: using factorial in probability question
"The problem is you don't know that what you are asking is different then what you think you are asking!"
No doubt that is very true.... but in the mean time 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 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??? In the CAS settings, Number Format is set to Scientific, yet the result is a string of numbers??? 

09272017, 07:28 AM
Post: #8




RE: using factorial in probability question
If I remember correctly things like that have been discussed before, CAS evaluates each part of your entry before it calculates the fraction, set to Approx this results in a too big number, so you do calculations like that in Exact mode and use Shift Enter directly to evaluate the command line.
Arno 

09272017, 07:28 AM
Post: #9




RE: using factorial in probability question
(09272017 05:26 AM)resolved Wrote: ... please explain why in HOME mode 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,AB). So 365!/252! would be PERM(365,365252) = approx 1.23E281, and 365!/253! would be PERM(365,365253) = 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 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. <0ɸ0> Joe 

09272017, 09:16 AM
Post: #10




RE: using factorial in probability question
I don't know if the prime has the function, but the WP 34S uses LnGamma for its permutations, combinations and other related functions.
Pauli 

09272017, 05:21 PM
Post: #11




RE: using factorial in probability question
(09272017 07:28 AM)Joe Horn Wrote:(09272017 05:26 AM)resolved Wrote: ... please explain why in HOME mode 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 

09272017, 05:57 PM
Post: #12




RE: using factorial in probability question
(09272017 05:21 PM)lost2 Wrote:Interested in the whole digits try: Gamma(n+1)==n! Prime max at Gamma(1007)(09272017 07:28 AM)Joe Horn Wrote: 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. 1Gamma(366)/(Gamma(336)*365^30) 

09292017, 06:36 PM
Post: #13




RE: using factorial in probability question
Hi,
But in CAS 1000! up to 1006! give all digits. May be it is not the subject of this thread. Gérard. 

10022017, 04:13 AM
(This post was last modified: 10022017 04:35 AM by resolved.)
Post: #14




RE: using factorial in probability question
Okay I up graded to soft version 2017 07 10 (12066)
big difference. in CAS 1PERM(365,30) / 365^30 and 1 365! / (335! * 365^30) gave me the same correct answer... great but when in HOME 1PERM(365,30) / 365^30 gave me the correct answer, same as in CAS BUT 1 365! / (335! * 365^30) gave me "0" zero  so I think there still is a bug that needs to be fixed??? or "0" needs to be better defined as "overflow error" or whatever the secret meaning that 0 is suppose to mean 365! / (335! * 365^30) = 1 not sure what "1" secret message is suppose to mean either, but 1  1 would equal 0, so the above equation makes more sense...just not the correct answer.... Joe  thanks very much for taking the time and giving me a better insight into the HP Prime 

10022017, 05:48 AM
Post: #15




RE: using factorial in probability question
As explained above, you can't use 365! in Home AT ALL, because it overflows. When Home overflows, it returns the "overflow" value of 9.99999999999E499. That's why 365!/364! returns 365 in CAS but 1 in Home (because 9.9999999999E499/9.9999999999E499 = 1). That's not a bug; it's behaving precisely according to design.
In brief, you can't rely on factorials in Home for any input > 253.119055437 because they ALL return the same overflow value of 9.99999999999E499, just as do 4444^4444 and 7777777^7777777 and 1E456^2 and so on. <0ɸ0> Joe 

10022017, 08:49 AM
Post: #16




RE: using factorial in probability question
(10022017 05:48 AM)Joe Horn Wrote: ... That's not a bug; it's behaving precisely according to design. Dear Joe, I really appreciate your knowledge, and please, I don't want my post to sound like an attack to you. Every reputable software gives a message to user about overflow, be it an audio processing software which informs you about 0dB clipping, or a photo/video processing software which informs you about highlight clipping. HP Prime calculator, in this case calculator for students, doesn't give you just message. Even basic calculator gives you at least something like "E" on display. Students have many important things to learn and I think deep knowledge of calculator internal processing doesn't fit into it. It's clear that something like 7777^7777 gives you overflow, but something similar can happen in the middle of expression. If you have some complex expression which gives you for example number four as result, you cannot know if there was overflow somewhere, because hp prime doesn't tell you. So, "it's behaving precisely according to design" as you wrote, but I think it is bad design, especially if hp prime is targeted to students.  My knowledge of english is quite limited, but I hope there isn't much lost in translation. :) Geocaching Coords Solver, Number of triangles Puzzle 

10022017, 11:45 AM
Post: #17




RE: using factorial in probability question
(10022017 05:48 AM)Joe Horn Wrote: As explained above, you can't use 365! in Home AT ALL, because it overflows. When Home overflows, it returns the "overflow" value of 9.99999999999E499. That's why 365!/364! returns 365 in CAS but 1 in Home (because 9.9999999999E499/9.9999999999E499 = 1). That's not a bug; it's behaving precisely according to design. I agree that the calculator should give an error message on overflow. Maybe this could be a flag in setup. Either Notify on overflow or Don't notify on overflow. Tom L If you buy a drink for someone in order to congratulate them, is it a Mazel Tov cocktail? 

10022017, 12:07 PM
Post: #18




RE: using factorial in probability question
(10022017 08:49 AM)chromos Wrote:(10022017 05:48 AM)Joe Horn Wrote: ... That's not a bug; it's behaving precisely according to design. We actually agree that Prime's failure to give any sort of warning that an overflow occurred is a Bad Thing. My only point was a linguistic one: this cannot be called a "bug" per se, because a "bug" is a behavior that is contrary to the intentions of the designers. (That's different from a misfeature, and different from an anomaly). I do not know why HP intended to design Prime that way, but they did, so it's not a bug. Perhaps "It's not a bug; it's a misfeature" would be appropriate in this case. I also agree with toml_12953: Prime should give an overflow message of SOME sort, or at least offer options related to it (like the RPL models do). Meanwhile, being aware of how the machine works internally should help avoid unexpected results. <0ɸ0> Joe 

10022017, 02:42 PM
Post: #19




RE: using factorial in probability question
(10022017 12:07 PM)Joe Horn Wrote: I also agree with toml_12953: Prime should give an overflow message of SOME sort, or at least offer options related to it (like the RPL models do). Meanwhile, being aware of how the machine works internally should help avoid unexpected results. Which RPL models are you referring to and which options? I'm not aware of any that don't just overflow silently. TW Although I work for the HP calculator group, the views and opinions I post here are my own. 

10022017, 08:48 PM
Post: #20




RE: using factorial in probability question
(10022017 02:42 PM)Tim Wessman Wrote:(10022017 12:07 PM)Joe Horn Wrote: I also agree with toml_12953: Prime should give an overflow message of SOME sort, or at least offer options related to it (like the RPL models do). Meanwhile, being aware of how the machine works internally should help avoid unexpected results. Actually, all the RPL models (28/48/49/50) have a flag that lets overflows generate an error. IIRC, it's flag 58 in the HP 28, and flag 21 in the HP 48/49/50. That flag is clear by default, which is why overflows normally generate MAXR silently. But when that flag is set, the calculator beeps and says "Overflow" and stops execution (MAXR is not returned). Needless to say, I keep that flag set. <0ɸ0> Joe 

« Next Oldest  Next Newest »

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