holy shit 66%

> holy shit 66%

Other urls found in this thread:

en.wikipedia.org/wiki/Bertrand's_box_paradox#Solution
youtube.com/watch?v=WFoC3TR5rzI
wandbox.org/permlink/I73NaqfKEMLB8bDJ
twitter.com/SFWRedditVideos

holeeee fuk
alert the media

you count the probability of picking the gold ball from the first box. but the question is different. try again.

its 75%

You either picked the box with two gold or one gold. You can ignore the two grey box at this point. There are 3 possible balls left, two gold and one grey. That is where you get 2/3. However, you had an equal chance of picking either box you possibly have. If you picked the gold gold box, you have a 100% chance of picking gold. If you picked the gold grey box, you have a 0% chance of picking gold. I got 50%. I could be wrong. I am not the best at these problems, but hold a gun to my head and I say 50%

>writing a fucking class for box

go poo in the

Can't even write a representation...

>That is where you get 2/3. However, you had an equal chance of picking either box you possibly have
If you choose the second box and the silver ball, you need to put it back and try again. That is, there is a selection algorithm that favor choosing the first box.

Your reasoning is wrong. Here is right

/thread

Oh, I get it now. This was my error:
>you had an equal chance of picking either box you possibly have
The chance you chose Gold Gold is twice the chance you chose Gold Grey.
So the actual math is 2/3(100%) + 1/3 (0%).

>using a fucking class for box
This is why people who have ever coded in java should be lifetime banned from Veeky Forums. Just fucking use a fucking typedef "using Box = array;"
>int otherballidx = ballidx == 0 ? 1 : 0;
Pajeet, my son, this isn't /g/. If you can't see 1-ballidx then you need to get the fuck out and stay out.
>random_device r;
You don't need it for more than on call so just use "default_random_engine e1(random_device()());"
>distrib2(e1)
You go out of your way to make the code more readable and then call with generators? Learn to std::bind
auto distrib3 = bind(uniform_int_distribution(0,2), ref(e1));
auto distrib2 = bind(uniform_int_distribution(0,1), ref(e1));
or just
auto distrib3 = bind(uniform_int_distribution(0,2), default_random_engine(random_device()()) );
auto distrib2 = bind(uniform_int_distribution(0,1), default_random_engine(random_device()()) );

No, that's functionally identical. One logically entails the other.

that's a fallacy. probability spaces of choosing 1st box and picking 2nd gold ball are different.
just because you know how the first ball was selected doesn't mean that probability space is reduced about th

/g/ can't answer this.

No. They are functionally identical. If the second ball is gold, then you have picked the first ball from the box with two gold balls. Knowing one means knowing the other.

2/3

...

it's 50-50

whoops nevermind

#include
using std::cout;
using std::endl;
#include
using std::uniform_int_distribution;
using std::default_random_engine;
using std::random_device;
#include
using std::bind;

enum Ball {silver = 0, gold =1};
using Box = Ball[2];

int main()
{
Box boxes[3] { {silver, silver}, {silver, gold}, {gold, gold} };
auto distrib3 = bind(uniform_int_distribution(0,2), default_random_engine(random_device()()) );
auto distrib2 = bind(uniform_int_distribution(0,1), default_random_engine(random_device()()) );
int possible_outcomes{};
int event{};
for(int i = 0; i

...

But there's only two boxes, third one doesn't exist for the problem

fixed

how did i do?

P[gg | one g] = P[gg] / P[one g] = 1/3 / 1/2 = 2/3

Yeah, no:
en.wikipedia.org/wiki/Bertrand's_box_paradox#Solution

>le troll face
nest those if statments fuckface

>No. They are functionally identical
No they're not and you're only asserting they are because you know you answered the wrong question.

Correct.

Imagine the Gold Balls are labeled A, B, C, D, E and F.

You got a gold ball with the first pick. Can't be E or F, because there's no chance of getting a gold ball there.

Your first pick must be A, B or C. It wasn't D.

If you picked A, your next is B.
If you picked B, your next is A.
If you picked C, your next is D.

2/3 of B, A and D are Golden. 66%.

And I don't even fucking know math.

>nest those if statments fuckface
That would answer the wrong question. If you're ever considering the probability of pulling out the initial gold then it means your answer is wrong.

No, I'm asserting they are because they are.

You didn't randomly pick ball [0] or [1] from your randomly selected box. You have it set to always pick [0].

can you even python?

By not nesting the if statements you also count the event that you pick a silver ball and then a gold ball. KYS

Sorry, I said all the balls are gold in the second line, this is incorrect.

The if statements are nested. They didn't randomly select the ball from the box though.

>You have it set to always pick [0].
That's because the question states you pick [0]. It's already been determined. Pretending you had a chance to pick the other ball when the question says it's already been determined is disingenuous and why so many people reach the wrong conclusion.

oh good catch
I guess I'd better learn python

From the question:

>You pick box at random
>You put your hand in and take a ball from that box at random

They don't have it set to take the ball at random. They both have it set so that when they pick the gold-silver box they always pick the gold ball.

>You put your hand in and take a ball from that box at random
And you always get a gold. With 100% certainty. There is no "probability" of picking a silver. According to the question it cannot occur. You pick a box and ALWAYS pick a gold, period. Therefore it is correct to assume the gold is picked because the question presumes you have. You could have a box with a billion silvers and one gold and again, the question says you pull out the gold. Probability has nothing to do with it, the fact you pull out a gold is predetermined.

oh noes

True, but it effectively halves the probability of picking the gold-gold box.

In the gold gold box [1] is also gold.

The probability of picking the box is outside the scope of the question since it's already been done. The probability of events that have already occurred is 1. The probability of picking a gold from either box is the same because the question precludes the possibility of having picked silver.

To demonstrate this, according to what the question asks how probable is it that you end with a silver in your hand? It's impossible, probability of 0 because the question states outright you get a gold. Now imagine we repeat exactly as the question states. We repeat it 1000 times over and always pick a gold. Every time. Why? Because again, the question states we do. Therefore calculating the probability of getting a gold in the first place misses the mark. It has been pre-determined and is one of the basic assumptions of the question. You pick a gold. Therefore even if a box has trillions of silvers and one gold you would still pick a gold from that box. Does that defy probability? It does but luckily we are NOT ASKED to calculate what the probability of what the first ball was. Only what the second one is, and they are independent events.

Again, if you are including the probability of picking the first gold in your calculations you are wrong. This is not what the question asked and is outside the scope of the question. Having gold is a matter of fact, you only need calculate the probability of the second ball which is 0.5

This is the equivalent of that explanation. youtube.com/watch?v=WFoC3TR5rzI

/thread

How you came by that gold ball is still the deciding factor, because if it's from the wrong box, you won't get gold a second time. Therefore, it matters which gold ball you have. It could be one of the ones in the double gold box, or the one from the gold-silver box. Two to one.

>Again, if you are including the probability of picking the first gold in your calculations you are wrong. This is not what the question asked and is outside the scope of the question. Having gold is a matter of fact, you only need calculate the probability of the second ball which is 0.5
This is what I originally thought but it is wrong. This is the flaw in this reasoning: While reading the problem, at the phrase "It's a gold ball" we must calculate the probability we chose any of the boxes. The probability that we chose Grey Grey is 0%. The probability that we chose Gold Gold is twice the probability that we chose Gold Grey.

The easiest way to check the solution is the diagram here: The dotted box is the probability space we are working with.

the only thing that matters is that i could code a little bit

This assumes you had a chance of picking a silver. You didn't. You always pick a gold therefore the probability of picking any gold ball is 1 over the number of gold balls in that box.

Don't you see how silly it is to be trying to claim that you have less chance of getting a gold in the gold/silver box because you make the erroneous presumption you could've picked the silver? The question precludes that possibility. You can never pick silver, ever. If you reason that you have less chance of picking a gold from the gold/silver box you are wrong because the probability you pick a silver is ZERO. None.

>This assumes you had a chance of picking a silver.
No, it does not. It merely acknowledges that your gold ball is twice as likely to come from the box that has twice the gold balls.

Pick a ball at random. If it's gold what's the probability of the other one being gold?

He didn't assume you had a probability of choosing silver. He is talking about the probability that you CHOSE a specific box. Gold Gold is twice as likely as Gold Grey.

It's a counterintuitive problem. The answer seems absurd because it goes against the shortcuts built in our brains, but it's still no less true. Ever heard of the Monty Hall problem?

Pick a box at random. If that box has at least one gold ball what is the probability it has two gold balls?

Wrong. That's not the problem. You're throwing out all the times you picked the gold-silver box but picked a silver.

>You're throwing out all the times you picked the gold-silver box but picked a silver.
That's because it's literally impossible to pick a silver because the initial state of the question is you having already picked out a gold. See

>have a legitimate IQ of 91
>solved Bernard's box problem correctly the first time

I guess Veeky Forums really is filled with LARPing brainlets.

Yeah, yet you didn't subtract that probability from your calculation.

>Implying we're not trying to drive Veeky Forums to greater heights by forcing them to think outside the box to solve counter intuitive problems

[code]
import random

boxes = [[1, 1], [1, 0], [0, 0]]

first = 0
second = 0

for i in range(1000):
box = boxes[random.randint(0, 2)]
ball = random.randint(0, 1)
if box[ball]:
first += 1
if box[1 - ball]: second += 1

print float(second) / float(first)
[/code]
sorry it looks retarded, but outputs
[code]
0.665226781857
[/code]

fuck me I swear I'm smart my mom said I am

Similar to the Monty Hall problem, this can be clarified if we up the numbers. Suppose you have two boxes with a million balls in them. One is all gold. One has a single gold ball, with the rest being silver. You take out one ball from one box. It happens to be gold. How likely is it that your next ball from the same box is also gold? Without doing the maths it's immediately obvious that it will only be gold if you chose the all-gold box, and also that it is a million times likelier that that is where you got your golden ball from.

I can post a screenshot if this is indecipherable.

>have a legitimate IQ of 91
I doubt it now fuck off

/dumb

3 gold balls

2/3 of the time you started from the GG box
1/3 of the time you started from the GS box

This is what I got from it as well.

...

>The gold gold box is not magic. There is only one gold gold box no matter which gold ball you pick in the gold gold box.

I was a 1/2 fag until I saw this, thanks for posting. You all suck at explaining things.

by your logic, a box with 1000 gold balls has a 999/1000 chance of being picked, despite there being an equal chance of picking either box.

I was a 2/3 fag until I saw this, thanks for posting. You all suck at explaining things.

Wait but because the ball you're holding is gold, doesn't that mean it's more likely that the ball it came from only has gold balls?

*box it came from

Yes. But that isn't the question. Read the prompt.

But you know the ball you're holding is gold, so you know it's more likely you chose the gold box, so you know you're more likely to pull a gold

By your logic, if you have two boxes, one with 999/1000 gold balls, and one with 999/1000 silver balls, and you draw a ball from a random box, and it turns up gold, it's equally likely that you drew from the first box as the second.

You're going backwards.

You pick a box with at least 1 gold ball at random, and then take a gold ball. You then are tasked with determining the probability of the next ball you take from the same box being gold.

You do not take a gold ball out of a box, and then find the probability that you are holding a certain box. That is not what was asked.

But if you know which box you have, you know what you're going to pull next. Determining the box is relevant to the problem.

Is your IQ above 85?

That is not my logic, that is not what I said. You're asking a different question.
2/3rd is the answer to "what are the odds that the first gold ball came from the GG box?".
The box is chosen at random with the guarantee that there is at least one gold ball. It doesn't matter how many gold balls above 1 that there are for how likely a box is to be chosen.

What color the second ball is, is entirely determined by which box you picked. If you picked A it's a gold, if you pick B it's a silver. Thus the question is really asking which box you picked since which balls you'll pick out are a consequence of that choice.

>Determining the box
Determining the probability of the next draw being gold for each box is. Determining the which box you actually have isn't.

You're forgetting, averages exist.

Yes—the probability of pulling gold from gg is 100%
The probability of pulling silver from gs is 100%
The probability you chose gold box is is 2/3
There is a 2/3 chance next ball is gold

>using namespace std;
that gets a pass for this one-off program
>default_random_engine and not mt19937
>actually storing random_device instead of mt19937{ random_device{}() }
>using int instead of unsigned for semantic correctness
>creating classes called Box and Ball that are essentially transparent instead of just using a const array and enum class
>storing a reference
>ternary operator in this day and age
>C-style casts
this code is garbage

>using anything related to std::function instead of lambdas

here you go boys: wandbox.org/permlink/I73NaqfKEMLB8bDJ

>being an equal chance of picking either box.
try again

You pick the box before you know which balls are inside. He is correct.

There is only one GG box...

do it a 1000 times, now reject the times you picked a silver. 750 remain.

you have picked from the GG box 250+250 times

you have picked from the GS box 250 times

250/750 = 1/3

500/750 = 2/3

>now reject the times you picked a silver
You can't pick a silver. The question disallows it. There is 0 probability of picking a silver, you pick gold, the question states this very clearly. By going back and assuming there was a possibility of getting silver you are going to come to an erroneous conclusion. You have gold, you only ever could have picked gold.

Flip a coin 3 times in a row 1000 times.
Of the times that you flipped to heads in a row, what are the odds that you flipped heads a third time?

Do you care about the total probability? No.
Do you care about times where you didn't flip two heads in a row? No.

Take another peek. These are the possible gold balls you could have picked. 2/3 times it's from gg. You have a gold ball. There is a 2/3 chance you chose that ball from gg. If it's from gg, there's a 100% chance the next ball is gold. There is a 2/3 chance it's from gg. There is a 2/3 chance next ball is gold.

>>using int instead of unsigned for semantic correctness

pajeet

Maybe use int_64_t to iterate more than 4 billion times for i and the counters but never use unsigned numbers "for semantic correctness". It will always bite you in the ass.

The question starts from the situation where the culling of the 'silver taken first' cases has already happened.

That's what the "It's a gold ball" means.
If you disagree, then probability just isn't for you. Stay away from Las Vegas.

>never use unsigned numbers
is that some nonsense that the google style guide mentions or just some aged advice? unsigneds are perfectly fine. ever wonder what type you're using when you call operator[] on array, vector, etc.? the answer is size_t which is, you guessed it, an unsigned int type.
i couldn't help but notice (because you pointed it out) that you had some counter argument prepared that doesn't even apply - something along the lines of "hurr if you need more just use a bigger int" which really reinforces the idea that you're just regurgitating.
moreover, int_64_t? that's not even guaranteed to exist you moron - you'll want to use int_least64_t or int_fast64_t.

Exactly so why are you taking scenrios where a silver ball could have been picked first into account? The question clearly says you pick gold. Any scenario where you pick silver is irrelevant and entirely ruled out. You cannot pick silver, period.

You have two coin sets. A GG coin + GS coin, and a GG coin + GG coin.
One GG coin was removed from the set.
The second coin is then placed Gold side up.
You are then tasked with finding the odds that bottom side of the coin is gold.

You don't make your own luck, that's not how this works.

Agree with most but there is nothing wrong with ternary operators

They are preferred, if anything

I made a revision to help out the brainlets.
The red number is the probability of the next drawn ball being gold.