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

You are not logged in.

## #26 2013-04-28 17:44:35

gAr
Star Member

Offline

### 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-28 20: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."

## #27 2013-04-28 19:03:43

bobbym

Online

### 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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #28 2013-04-28 20:04:07

gAr
Star Member

Offline

### Re: Marbles without replacement (probability)

Hi,

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

#### 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."

## #29 2013-04-28 20:09:23

bobbym

Online

### Re: Marbles without replacement (probability)

Hi gAr;

Yeparoo! Very good!

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #30 2013-04-28 20:15:09

gAr
Star Member

Offline

### 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."

## #31 2013-04-28 20:16:56

bobbym

Online

### 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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #32 2013-04-28 20:20:40

gAr
Star Member

Offline

### 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."

## #33 2013-04-28 20:23:32

bobbym

Online

### 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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #34 2013-04-28 20:31:56

gAr
Star Member

Offline

### 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:

#### Code:

```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."

## #35 2013-04-28 20:37:47

bobbym

Online

### Re: Marbles without replacement (probability)

Hi;

Why the Integer() command?

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #36 2013-04-28 20:40:39

gAr
Star Member

Offline

### 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."

## #37 2013-04-28 20:44:31

bobbym

Online

### 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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

Pearl2013
Novice

Offline

## #39 2013-04-28 20:52:45

gAr
Star Member

Offline

### 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."

## #40 2013-04-28 21:00:16

bobbym

Online

### 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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #41 2013-04-28 21:06:38

gAr
Star Member

Offline

### 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."

## #42 2013-04-28 21:09:58

bobbym

Online

### 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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #43 2013-04-28 21:19:00

gAr
Star Member

Offline

### 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."

## #44 2013-04-28 21:23:47

bobbym

Online

### 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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #45 2013-04-28 21:42:48

gAr
Star Member

Offline

### 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."

## #46 2013-04-28 21:44:54

bobbym

Online

### 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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #47 2013-04-28 21:56:48

gAr
Star Member

Offline

### 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."

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

bobbym

Online

### 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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

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

gAr
Star Member

Offline

### 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."

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

bobbym

Online

### 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.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.