You are not logged in.

- Topics: Active | Unanswered

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

Of each possible draw? Yes, but maybe they should be done separately.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,594

The simulation process is as separate as I can manage.

I've increased the number of draws from 200000 to 1 million...which has had no effect on the results.

Here's an image from my spreadsheet for group A (the one with 21 marbles). For coding simplicity, I've used digits 1,2,3,4 for marbles r,w,b,g respectively.

Groups A, B & C are as per post #19:

A. r = 11, w = 3, b = 2, g = 5 (21 marbles)

B. r = 10, w = 3, b = 2, g = 5 (20 marbles)

C. r = 9, w = 3, b = 2, g = 5 (19 marbles)

A5 = 111111111112223344444, representing 21 marbles that comprise 11 reds ("1"), 3 whites ("2"), 2 blues ("3") and 5 greens ("4").

B5 = 3121 (for example), which is a random (using RANDBETWEEN) selection of 4 marbles from A5.

C5 = 1123, which is B5 arranged in ascending digit order.

D5 = 1234, representing the rwbg draw (but in ascending digit order).

F5 = 1123, representing the wbrr draw (but in ascending digit order).

H5 = 1113, representing the brrr draw (but in ascending digit order).

J5 = 1111, representing the rrrr draw.

E5, G5, I5 & K5 test D5, F5, H5 & J5 for a match with C5 & then record "1" for a successful draw, blank for fail.

So in this case...

E5 = blank

G5 = 1

I5 = blank

K5 = blank

Row 5 is copied down to row 1000004 for the operation to occur 1000000 times. Successful draws are then totalled (see row 3) and proportions (%) calculated (see row 4).

For the calculations of the other two groups (B & C) I deleted a "1" from A5 for group B and a further "1" for group C. In each case the spreadsheet automatically copied the new contents of A5 down column A.

Of the number of draws of 4 marbles from the bag, 22% from Group A are successful, as are 20% from group B and 19% from group C.

I ran the full simulation 5 times for each group A, B & C, with very similar results per group.

I can't see yet where I've gone wrong...

*Last edited by phrontister (2017-02-25 22:11:45)*

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

**deoxysxxxx****Member**- Registered: 2014-12-21
- Posts: 9

...and I don't know what you guys are talking about.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

Hi;

Have you tried with the correct number of each to start?

...and I don't know what you guys are talking about.

Another way to get an answer to any probability question is to run a simulation.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,594

Is this what you meant?

Anyway, your suggestion has helped to uncover a flaw in my column C code. Thanks! So in the image I dispensed with column C's code and instead just used the contents of column A.

The random selection formula is wrong, which must be the reason for the strange results. My code wasn't selecting only unused digits from column A (which means that in some draws I was choosing one or more already-chosen marbles), but I think I've got an answer for that with a UDF.

My simulation idea is probably on the right track, and I hope it will work fine after I fix the flaw.

Back to the drawing board...

*Last edited by phrontister (2017-02-25 22:10:41)*

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

Hi;

Just make sure you get an answer of 21 as above.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,594

My simulation isn't set up to get the answer 21. I'm using that answer to see if I can verify the required 25% success rate for each of the four draw options (1), (2), (3) & (4).

And the good news is......after fixing the column C code, the simulation now results in a 1-in-4 chance for each of those options.

*Last edited by phrontister (2014-12-23 23:00:29)*

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

Then by varying the composition of the urn ( 4 loops ) you could use it to get the answer of 21.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,594

I can't see how I could manage that with my spreadsheet. I'd probably have to switch over to M for that.

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,594

Actually, I don't think I understand what you said...

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

There are no

For red = 1 to...

For white = 1 to ...

For blue = 1 to ...

For green = 1 to ...

Simulate to see if all probabailities are equal

Next green, blue, white, red

constructs for excel?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,594

I'd have to think. That sounds more like something for Visual Basic or Excel 4 Macro...or LB. And M, of course.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

I was just asking, it is not necessary. Hope you are having a good holiday.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,594

Yes...some feet-up time without work pressures certainly is very good.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

Yes, enjoy it. How did you like this problem?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,594

I really enjoyed doing the Excel simulation. Because of some shortcomings in Excel functions (or absence of) I sometimes had to jump through hoops to put together suitable formulas. Good brain-scratching stuff!

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

It is a difficult problem even to program.

See you a bit later, couple of chores need to be done.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline