panamajack, I think APB9999 is actually pretty much correct about the continuous case, with kesagirl’s slight amendment. Before I looked at his solution, I worked it out myself. Let me try to explain the approach I took.
Let p(x) be the probability of finding a parking space at x.
Let P(x) be the probability that the car ends up parking at x. By definition, the car parks at the first empty space, so P(x) is also the probability that the car couldn’t find a spot closer than x times the probability that there is a space at x (which is p(x)). So, using the two definitions for P(x), we have the equation
P(x) = p(x) * (1 - int[sub]0->x[/sub]P(y)dy)
This is an integral equation for P(x), given the distribution p(x). Your objection that the discrete case involves products, so there shouldn’t be an integral is incorrect. The way you set up the discrete case, the products involved p, not P.
Fortunately, we can reduce this to a differential equation fairly easily. Take the derivative with respect to x to get
and note that the term multiplying p’ is just P/p (from the first equation). Incidentally, the last term comes from the Fundamental Theorem of Calculus, that the derivative of the integral of a function is just the function. So,
P’ = ((p’/p) - p)P
If you know p(x), you can solve this ODE given the following boundary conditions:
P(0) = 0
Integral of P over all x = 1.
If p(x) is not differentiable everywhere, you may need to impose continuity conditions on P as well.
Oops, minor screw-up. My boundary condition 1 should be P(0)=p(0) (from the first equation). I had worked out the result for the sample case where p(x) is linearly increasing from 0 to 1 out to some distance x[sub]0[/sub], after which it is 1. In that case p(0) is 0 (and, thus, so is P(0)), but that’s a special case.
Wow Rick, you win! That’s exactly the sort of thing I was hoping for. Didn’t even think of that approach.
BTW, APB9999 did label his equation incorrect (assuming he was doing the same as you did); he had f(x) inside the integral, which of course doesn’t work out, hence my objection.
again, thank you very much.
And apologies to kesagiri; turns out the c.d.f. was indeed an important part of the solution
Yup, all the corrections are right. It is of course true that int[sub]0->x[/sub][1-f(x)] = 1-int[sub]0->x[/sub][f(x)]; here I was just keeping concepts together in the expression, and 1-f(x) has a clear intuitive interpretation. This doesn’t really affect the outcome, though.
More seriously, I did goof, as Rick points out, in using (in my notation) f(x) rather than p(x). D’OH! That makes solving it a little trickier, where you have to use DEs as Rick explains. He takes the gold!
Yes, kesagiri, it is. I was going by what you had said earlier, when you made the very mistake you’re catching me in now, and wasn’t watching closely enough. So I was right to keep it simple in the first place, since I’m obviously easily confused. Again, it doesn’t change the analysis, just the manipulations.
That’s okay, when looking at integrals in this kind of format making mistakes is easy. First time I looked at yours I was confused too. Hopefully someday will come when we can use the real integral sign…and other mathematical notation on a bulletin board.