Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#26 2013-04-27 19:44:35

gAr
Member
Registered: 2011-01-09
Posts: 3,478

Re: Marbles without replacement (probability)

For k colors with n marbles each, I find it to be:

May require some modification when number of marbles are different.

Last edited by gAr (2013-04-27 22:53:23)


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#27 2013-04-27 21:03:43

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 84,538

Re: Marbles without replacement (probability)

Hi gAr;

That is a nice one, it will come in handy.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#28 2013-04-27 22:04:07

gAr
Member
Registered: 2011-01-09
Posts: 3,478

Re: Marbles without replacement (probability)

Hi,

Got a recursion to work!
Here's a sage code:

A = 10
B = 10
C = 10
D = 10
def f(a,b,c,d):
    if (A-a == 2 or B-b == 2 or C-c == 2 or D-d == 2):
        return (A+B+C+D-(a+b+c+d))
    return a/Integer(a+b+c+d)*f(a-1,b,c,d) + b/Integer(a+b+c+d)*f(a,b-1,c,d) + c/Integer(a+b+c+d)*f(a,b,c-1,d) + d/Integer(a+b+c+d)*f(a,b,c,d-1)
print f(A,B,C,D)

It returns : 30008/9139


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#29 2013-04-27 22:09:23

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 84,538

Re: Marbles without replacement (probability)

Hi gAr;

Yeparoo! Very good!


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#30 2013-04-27 22:15:09

gAr
Member
Registered: 2011-01-09
Posts: 3,478

Re: Marbles without replacement (probability)

Yeah, that looks much neater than the formula!
I think this will help in many problems involving probability..


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#31 2013-04-27 22:16:56

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 84,538

Re: Marbles without replacement (probability)

Hi;

Have you tried the formula in post#26 on this problem?


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#32 2013-04-27 22:20:40

gAr
Member
Registered: 2011-01-09
Posts: 3,478

Re: Marbles without replacement (probability)

Yes, and we must multiply that by 2, I forgot to include that.


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#33 2013-04-27 22:23:32

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 84,538

Re: Marbles without replacement (probability)

I am not getting the correct answer then, when I multiply by 2 I get:

I am using n = 10 and k = 4.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#34 2013-04-27 22:31:56

gAr
Member
Registered: 2011-01-09
Posts: 3,478

Re: Marbles without replacement (probability)

Perhaps I  made a mistake when translating my program to the formula? Or you took out n from the sum ?

Here's the code I used:

def ans(n,k):
    summ = 0
    for i in range(1,k+1):
        pr = 1
        for j in range(1,i):
            pr *= (k-j)*n/Integer(4*n-j)
        summ += (i)*(i+1)/2 * pr * (n-1)/Integer(4*n-i)
    return 2*summ

ans(10,4) returns 30008/9139


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#35 2013-04-27 22:37:47

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 84,538

Re: Marbles without replacement (probability)

Hi;

Why the Integer() command?


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#36 2013-04-27 22:40:39

gAr
Member
Registered: 2011-01-09
Posts: 3,478

Re: Marbles without replacement (probability)

It causes problem like flooring if it's not written..

In python, we need to convert it to float.


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#37 2013-04-27 22:44:31

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 84,538

Re: Marbles without replacement (probability)

Hi;

There is a typo in the formula. In post #26 there is (k-i), in post #34, (k-j).


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#38 2013-04-27 22:46:37

Pearl2013
Member
Registered: 2013-04-27
Posts: 6

Re: Marbles without replacement (probability)

Oop answer was wrong

Offline

#39 2013-04-27 22:52:45

gAr
Member
Registered: 2011-01-09
Posts: 3,478

Re: Marbles without replacement (probability)

Hi bobbym,

Ah yes, sorry!


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#40 2013-04-27 23:00:16

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 84,538

Re: Marbles without replacement (probability)

No problem! Thank you for the formula.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#41 2013-04-27 23:06:38

gAr
Member
Registered: 2011-01-09
Posts: 3,478

Re: Marbles without replacement (probability)

You're welcome!
I think we can't write a formula like that when the number of marbles are different for different colors, since it involves permutation?
Anyway, I'll stop here, spent almost a day on this one!


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#42 2013-04-27 23:09:58

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 84,538

Re: Marbles without replacement (probability)

Hi;

I will play with it a little in a bit. Right now there is a little bit of an administrative matter to watch for.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#43 2013-04-27 23:19:00

gAr
Member
Registered: 2011-01-09
Posts: 3,478

Re: Marbles without replacement (probability)

Okay..


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#44 2013-04-27 23:23:47

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 84,538

Re: Marbles without replacement (probability)

Hi;

Looks like the worst is over. Now about that formula...

If we hold k = 4 and vary n then we come up with this:

for n = 2, 3, 4, ...


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#45 2013-04-27 23:42:48

gAr
Member
Registered: 2011-01-09
Posts: 3,478

Re: Marbles without replacement (probability)

That's a good one!


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#46 2013-04-27 23:44:54

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 84,538

Re: Marbles without replacement (probability)

Oh yes and quite useless unless you have exactly 4 colors.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#47 2013-04-27 23:56:48

gAr
Member
Registered: 2011-01-09
Posts: 3,478

Re: Marbles without replacement (probability)

Anyway, we can easily extend the recursion if not the formula for any number of variables and experiment with the terms.


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#48 2013-04-28 00:03:25

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 84,538

Re: Marbles without replacement (probability)

There are a lot of possibilities here.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#49 2013-04-28 00:05:37

gAr
Member
Registered: 2011-01-09
Posts: 3,478

Re: Marbles without replacement (probability)

Yes.


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#50 2013-04-28 00:30:18

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 84,538

Re: Marbles without replacement (probability)

Hi;

I am going to get a little sleep. See you later.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

Board footer

Powered by FluxBB