probability  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: probability (/thread64299.html) 
probability  kc  10132004 Sorry for posting a maths question here rather than calculator question. Some day ago someone ask me the following question: Suppose you enter a sugar shop and there are 10 different types of sugars. You're going to pick out 10 sugars. For each type of sugar you can pick from none to all 10. How many possibilities do you have? Is there a general theorum or equation for such type of question? Also, can such kind of question be programmed? I obtained the answer, and my friend thought I was clever. The thing I didn't tell him is that I obtained the answer by COUNTING!
Re: probability  hugh steers  10132004 2^10 = 1024 ?
Re: probability  Dave Shaffer (Arizona)  10132004 KC, I think you need to restate your problem. Please confirm if this is the correct statement: "There are 10 different kinds of sugar. You are going to make 10 individual choices of what kind of sugar to buy. (i.e. you are first going to buy one kind of sugar, choosing from the 10 varieties; after that you are going to buy your second kind of sugar, again choosing from all 10 varieties, and so on, for 10 times) You can buy the same type of sugar as many times as you want (up to 10, of course!). How many different combinations of sugar buys can you make?" If that is the problem, then the answer is pretty big: 10^10. In other words, at each purchasing decision, you can choose from 10 different products, and you get to choose 10 times.
Another way to look at it: give each sugar type a number value from 0 to 9. Your first overall purchasing decision might be to make 10 purchases of sugar type 0, and you purchase listing would be 0000000000. Then you might say, "hey this is kind of boring, I'd like to try type 1 at least once." Then, if you choose type 1 last, your purchase list would be 0000000001. Since you could choose any type at any point in your sequence, you would ultimately cover all the numbers between 0000000000 and 9999999999.
Re: probability  Thibaut.be  10132004 I agree with your understanding of the statement, which at first was not clear to me. But I think we want to go into deeper in the analysis. As a matter of fact, you can choose out of 10 candies, any one you like, and this 10 times. So the logical answer would be : 10*10*10...*10 = 10^10. But this is the amount of possibilities of arranging the candies, whare place of the candies is important. To tka your example of numbers, 8181800081 does count as well as 1118888000, which is, to my understanding, the same possibility. My understanding of the statement is how many different possibilities do you have to pick out 10 candies out of 10 different boxes. Hence no matter the place.
In this sense, we are facing to a situation where you can choose 10 * (101) * (102) *...* (108) * (109) = 10 Re: probability  Mike H  10132004 Imagine a coffee shop with 10 flavors of coffee; you are to purchase 10 cups of coffee. You can choose 10 cups of the same flavor, one cup of each of the 10 flavors, or a combination of flavors. How many combinations are there. 10 possible choices for each cup 10*10*10*10*10*10*10*10*10*10 = 10^10 = 10,000,000,000
If there is to be no duplicates, that is you can only choose each flavor once, but the order in which the flavors are selected is counted then Pr,n = n!/(nr)! = 10!/(1010)! = 10! = 3,628,800
Re: Probability  Andrés C. Rodríguez (Argentina)  10132004 Some of the answers given before, based on 10^10 are right as far as order is considered important. (i.e.: 12 and 21 are considered different combinations).
The case in which order is disregarded (i.e.: 12 and 21 are deemed the same) is more complex, and my first trials at it were unsuccessful... I am sure there is a better answer, but I have not found it yet...
Re: probability  kc  10132004 First of all thanks for all of your responses. Let me make things simpler and clearer. Suppose the sugar shop has only 3 different types of sugars and I had to pick 3 only. I can list all the possibilites out. Let's label each type of sugar to be 1, 2 and 3 respectively: 111 112 113 122 123 133 222 223 233 333 I have 10 possibilities. Order is not important, so 321 and 213 is the same as 123, and that's why it cannot be 3^3. From the above listing, one can see that the tenth digit can never be larger than the unit digit, and the hundredth digit can never be larger than the tenth digit, and so on. Therefore I think somehow I can programmed that in my HP calculator according to the above rule, but I haven't figure it out.
Re: probability  Hugh Evans  10142004 Sounds like an nPr nCr (permutations or combinations) depending on whether or not you are paying attention to repeats.
Re: probability  Karl Schneider  10142004 The problem can be approached as a "nested recursive summation" that is not too difficult to program on an RPLbased HP calc (28/48/49 series). For the 3variable example (let's call it red, green, and blue marbles), the 10 ways to choose three marbles is as follows:
R G B arrangements There are (R+G+B)!/(R!G!B!) number of each arrangement The RPL expression (Sig = Greek letter sigma)
'Sig(R=0,3,Sig(G=0,3R,1))' can quickly be evaluated as 10. (NOTE: Knowing the number of red and green marbles, there is only one possible value for the number of blue ones. So, it is not necessary to include it in the summation.)
 KS
Re: probability  Thibaut.be  10142004 Agreed
Re: probability  Raul L  10142004 CR(3,3)=C(5,3)=10 CR(m,n)=C(m+n1,n)
Is this ok?
Re: probability  Mike H  10142004 C(m+n1,n)= C(19,10)= 92,378. Re: probability  Raul L  10142004 Quote: No: I'm not a genious :( but I know this expresion since I was 14... and I teach it to my students. Combinations with repetition (as explained by KC in his example): we have m diferent elements for doing groups of m elements, don't worry about order (123=321=231=...) and we can repeat elements (111 or 112, etc)
so for the 10 sugar problem:
Edited: 14 Oct 2004, 12:30 p.m.
Re: probability  kc  10142004 Excellent Raul! It was such a beautiful and elegant expression! I apologize for my early claim that I was able to count m=10 and n=10 case. It was in fact a case where m=n=7, and I spent 2 hours or so to work out the answer. For the case where m=n=10, I don't think I have the gut to count overnight! Once again, thanks very much,
KC
Re: probability  kc  10142004 Hi Raul, I'm so impressed you told me you learned this expression at the age of 14. At my age of 14, I learned something like "what's the probability of getting two heads by flipping two coins?" Nevertheless, I love probability very much.
KC
Combinations with Repetition in RPL  Raul L  10152004 Perhaps someone could be interested in this "new command": COMBR « DUP ROT + 1  SWAP COMB »
« DUP ROT + 1  SWAP
so, you will obtain exact results (all digits) or approximated results (scientific notation) depending on user flag 15. (This is not necessary with the 49)
An equivalent in RPN  Karl Schneider  10192004 Raul provided the following RPL routines: « DUP ROT + 1  SWAP COMB » The first of which does indeed work on a 48G and 49G, but can't work on a 28C or any 41 (no statistical combination function "COMB"). Here are the RPN versions of the first program:
(others) (HP42) No real difference in understandability, but that second RPL routine sure looks like jibberish to me. The first routine is quickest and easiest to program and invoke on any nonalphanumeric RPN programmable. Fie upon RPL! :^)  KS
Re: An equivalent in RPN  tony h  10202004 Karl, Instead of your "ENTER RDN + 1  RUP" I did "X<>Y 1  X<>Y + LASTX" here. Any reason to prefer one over the other? Version for the 41 (edited)  Raul Lion  10202004 This is COMB for the 41. I wrote it the last summer,
Edited: 20 Oct 2004, 3:55 p.m.
A better 42S program  Karl Schneider  10212004 Tony posted,
Quote: No preference; you program is just as good as mine  six steps to set up the inputs to the C(y,x), using one extra stack level. Now, here's a better RPN program for the 42S, using only three steps and no extra stack levels to set up the argument,. It should also work in conjunction with Raul's "COMB" program on the 41's.
LBL "COMBR"
