Page 1 of 1

Problem 286

Posted: Sat Apr 03, 2010 12:34 pm
by Taifu
Just nitpicking: for each successful shot you have 2 points (or even 3 depending from distance!) in Basketball.

Perhaps "points" is not the better wording :-)

Ciao.
Marco.

Re: Problem 286

Posted: Sat Apr 03, 2010 2:04 pm
by Listing
Somehow I always get q=90.1546080185 but it seems to be wrong :?

Is it some rounding mistake or am I completely off?

Re: Problem 286

Posted: Sat Apr 03, 2010 2:17 pm
by stijn263
You're completely off I'm afraid. Each shot scores one point only.

Good luck! (Problem 286 (View Problem))

Re: Problem 286

Posted: Sat Apr 03, 2010 2:22 pm
by Listing
I solved it, thanks for your post. Stupid me calculated it for 20 misses and not for 20 hits :D

Re: Problem 286

Posted: Thu Mar 03, 2011 7:51 pm
by MaJJ
Is q=54.4656158489 too far away to be a rounding error?

Re: Problem 286

Posted: Thu Mar 03, 2011 8:02 pm
by jaap
MaJJ wrote:Is q=54.4656158489 too far away to be a rounding error?
Yes, even the integer part is not correct.

Re: Problem 286

Posted: Thu Mar 03, 2011 8:58 pm
by MaJJ
Thanks. I'll ask another question:

Can I use "average probability" in binomial distribution?

Code: Select all

def p(x,q): return 1-(x/q)

def avg(q):
    s = 0
    for xx in range(1,51):
        s += p(xx,q)
    s /= 50
    return s
and then find out the probability (the wanted 2%) with something like (n choose k) * (avg(q) ** k) * ((1 - avg(q)) ** n-k) ?

EDIT: or, more precisely, where is the reasoning incorrect? I know I can't use it like that, b/c it provides wrong result :)

Re: Problem 286

Posted: Thu Mar 03, 2011 11:29 pm
by jaap
MaJJ wrote:EDIT: or, more precisely, where is the reasoning incorrect? I know I can't use it like that, b/c it provides wrong result :)
Look at a simpler case: 2 distances, with individual probabilities 5%, 95% and you want to score exactly once.

Your method:
Average is 50%. Scoring exactly 1 out of 2 with 50% each is
0.5 * (1-0.5) + (1-0.5) * 0.5 = 0.5

Actual probability of scoring exactly 1 out of 2 with probabilities 5%, 95% is
0.05 * (1-0.95) + (1-0.05) * 0.95 = 0.905

The question is, why would you expect this to give the same answer?

Re: Problem 286

Posted: Fri Mar 04, 2011 1:09 pm
by MaJJ
Thanks for putting me on the right track.
I'm beginner in the field of probability, so I'm learning quite a lot from this PE problem :)

I'm trying to do it your way - but I'm still struggling with it.

Is probability of scoring 2 out of 2 with probabilities 5%, 95% this?

Code: Select all

0,05 * 0,95 = 0,0475
And for three distances with probabilities 50%, 60% and 70%:
Scoring 1 out of 3:

Code: Select all

   0,5  * (1-0,6) * (1-0,7) +
(1-0,5) *    0,6  * (1-0,7) +
(1-0,5) * (1-0,6) *    0,7  = 0,29
Scoring 3 out of 3:

Code: Select all

0,5 * 0,6 * 0,7 = 0,21
But what is the probability of scoring 2 out of 3?
This is wrong, but I didn't find a way how to calculate it correctly:

Code: Select all

   0.5  *    0.6  * (1-0.7) +
   0.5  * (1-0.6) *    0.7  +
(1-0.5) *    0.6  *    0.7  = 0.44 <--- too high
I tried to do it this way because I thought the possibilities are ABC or ABC or ABC (   denoting scoring this ball)

Re: Problem 286

Posted: Fri Mar 04, 2011 1:58 pm
by Lord_Farin
MaJJ wrote: But what is the probability of scoring 2 out of 3?
This is wrong, but I didn't find a way how to calculate it correctly:

Code: Select all

   0.5  *    0.6  * (1-0.7) +
   0.5  * (1-0.6) *    0.7  +
(1-0.5) *    0.6  *    0.7  = 0.44 <--- too high
I tried to do it this way because I thought the possibilities are ABC or ABC or ABC (   denoting scoring this ball)
As far as I have ever done statistics, that is in fact the correct way to calculate it, as the throws are all assumed to be independent.

Re: Problem 286

Posted: Fri Mar 04, 2011 3:07 pm
by jaap
MaJJ wrote:Is probability of scoring 2 out of 2 with probabilities 5%, 95% this?

Code: Select all

0,05 * 0,95 = 0,0475
Yes.
MaJJ wrote:And for three distances with probabilities 50%, 60% and 70%:
Scoring 1 out of 3: [...] = 0,29
Scoring 3 out of 3: [...] = 0,21
[...]
scoring 2 out of 3 [...] = 0.44
That is all correct. Together with:
Scoring 0 out of 3: (1-0.5) * (1-0.6) * (1-0.7) = 0.06
that makes the total exactly 1, which it should because they are mutually exclusive and include all the possible cases that could happen.

Re: Problem 286

Posted: Fri Apr 27, 2012 2:01 pm
by dharasty
I suggest that the wording of the problem is VERY POOR. In basketball, "scoring 20 points" is not the same as sinking 20 shots, since a "shot" can add 2 or 3 *points* to the "score". I saw that ambiguity when I read the problem, and thought "gee, somebody who doesn't know the rules and terminology of basketball might not be able to get this problem, as that information is not provided. They really should update the wording."

Now I realize the problem author is not familiar with the rules and terminology of basketball. The problem really is asking about "making 20 shots", not "scoring 20 points".

I was able to overcome this unfortunate choice of wording since I a) saw the ambiguity, and, b) proved to myself it was mathematically impossible to have exactly a 2% chance of sinking exactly 10 shots (for 20 true "points").

PLEASE update the wording of the problem to state: "score a total of exactly 20 times" or "sink a total of exactly 20 shots". Please do not use the word "points" unless you mean it in the sense that basketball players do.

All Project Euler questions aim to be VERY PRECISE in their wording. This one -- as of this date -- alas, is not.

Thanks for considering this.

Re: Problem 286

Posted: Sat Apr 28, 2012 7:31 am
by TripleM
I agree that the wording is slightly unfortunate and it wouldn't hurt to change it, but I disagree that there is any ambiguity / lack of precision in the problem statement itself. It defines the probability of scoring a point from a distance, and then asks you to calculate something involving the probability of scoring 20 points. The only way you could misunderstand that is if you try to you try to read between the lines, use the real rules of basketball, and make assumptions that you shouldn't - the details provided by the problem are perfectly precise.

Re: Problem 286

Posted: Tue Apr 30, 2013 11:12 pm
by oleglyamin
I'm trying to identify the source of error - whether it's in the part related to probabilities or in the part related to handling large and small numbers.

Could you tell me how close I am?
xxxxxx (edit by hk)(rounded to 5 decimal places)

Thanks.

EDIT: Found it. It was numerical error.

Re: Problem 286

Posted: Tue Mar 03, 2026 9:27 pm
by yourmaths
dharasty wrote: Fri Apr 27, 2012 2:01 pma "shot" can add 2 or 3 *points* to the "score".
Wouldn't this depend on how far out the 3-point line extends? Also there are no units (feet/metres?) for the distances in the problem statement. At any rate, my understanding is that the only way to score one point in basketball is with a free throw, i.e. similar to what is happening in the problem statement, albeit at different distances.

At this point (lol) most people would probably come and look here for clarification. But I agree, the use of "point" in relation to a basketball problem is probably unfortunate. Maybe change it to golf.