|
||
Title: Re: Probability Problem 1 Post by towr on Jun 17th, 2018, 12:14pm [hide] experimentally it's around 36% mathematically, I think it should be 4 times the number of ways to split 8 passengers over 3 non-empty carriages, divided by the number of ways to split 8 passengers over 4 carriages. Which I'd hope would be 4*([5+3-1]!/5!/[3-1]!) / ([8+4-1]!/8!/[4-1]!), but isn't. So I'm making a mistake somewhere [/hide] |
||
Title: Re: Probability Problem 1 Post by towr on Jun 17th, 2018, 10:52pm Ah [hide]like railway companies, I had trouble looking at the passengers as individuals. It should be (4*3^8 - 12*2^8 + 12) / 4**8 = 1449/4096 ~= 35.4% [/hide] |
||
Title: Re: Probability Problem 1 Post by rmsgrey on Jun 18th, 2018, 4:36pm A quick and dirty program to count all possibilities agrees with towr's second answer. C# code: [hideb] static void Main(string[] args) { int[] pass = {0,0,0,0,0,0,0,0}; int total = 0; int success = 0; while (pass[7] < 4) { int[] car = { 0, 0, 0, 0 }; for (int i = 0; i < 8; i++) car[pass[i] = 1; if (car[0] + car[1] + car[2] + car[3] == 3) success++; total++; int j = 0; pass[j]++; while (j < 7 && pass[j] == 4) { pass[j] = 0; j++; pass[j]++; } } Console.WriteLine("{0} successes out of {1} total", success, total); Console.ReadLine(); } [/hideb] Output: [hide]23184 successes out of 65536 total[/hide] |
||
Title: Re: Probability Problem 1 Post by navdeep1771 on Jun 18th, 2018, 8:59pm Your second answer is correct towr. |
||
Powered by YaBB 1 Gold - SP 1.4! Forum software copyright © 2000-2004 Yet another Bulletin Board |