6 ms·
>The distance from the edge is a product of n I.I.D. variables It is not a product of random variables; it is an iterated random variable. The output of one in
by SideQuark 3y ago
>The distance from the edge is a product of n I.I.D. variables
It is not a product of random variables; it is an iterated random variable. The output of one influences those higher in the chain. Redo your python code with rand(rand(rand...))) not rand() * rand() * rand()...
The expectation of composition of functions is not the composition of expectations, so there is some work to do.
For uniform over [0,1] for the innermost item, it becomes an iterated integral, with value (1/2)^n.
- sobellian 3y agoI did redo it, and the distributions are identical. It's just a very heavily skewed distribution, so the expected value is not very intuitive. I still think even E[x] decreases faster than 2^-n though. See my other comments. Edit - Actually, I think E[x] = 2^-n, but showing this numerically for large n is impractical because of just how skewed the distribution is. It is simultaneously true that E[iter_rand(N)] = 2^-N and E[log(iter_rand(N))] = -N. Fun stuff :)
- SideQuark 3y agoIt's not about intuition. I computed it directly from the integral definition for expected value. I posted it elsewhere in the thread. It proves it for all N. Also, you keep using the new incorrect claim that r() * r() * ... * r() is the same as r(r(...r())..). They are not.
- maxbond 3y agorandom() * 5 is equivalent to random(5) (the former being the classic way to implement the latter). So why wouldn't random() * random() be equivalent to random(random())?
- SideQuark 3y agoMultiplying by a constant commutes with expectation. Multiplying by a random variable does not. It may in some cases, but intuition is not the way to check it.
- deleted 3y ago[deleted]
- anderskaseorg 3y agoThe claim here is not about expectations. random(X) is identically distributed to random() * X, even if X itself is a random variable, because the randomness in random() is independent from the randomness in X. Indeed, the way you would implement random(X), if you only had random() and X available, would be to compute random() * X. So in particular, random(random()) is identically distributed to random() * random(). (To be clear, this is different from random()^2, as pointed out elsewhere.)
- jasomill 3y agoAs a quick sanity check, Mathematica 13.2.1 Kernel for Linux ARM (64-bit) Copyright 1988-2023 Wolfram Research, Inc. In[1]:= DI = Distributed; In[2]:= EV = Expectation; In[3]:= SS = Subscript; In[4]:= UD = UniformDistribution; In[5]:= f[1] := EV[x, DI[x, UD[{0, 1}]]] In[6]:= f[n_Integer] := EV[x, DI[x, UD[{0, f[n - 1]}]]] In[7]:= Block[{n = 42}, EV[Product[SS[x, k], {k, 1, n}], Map[DI[SS[x, #], UD[{0, 1}]] &, Range[1, n]]] == Product[EV[x, DI[x, UD[{0, 1}]]], {k, 1, n}] == f[n]] Out[7]= True where n = 42 ∈ ℕ is arbitrary. Alas, Mathematica doesn't appear to support actual nested distributions of the form UD[{1,UD[{1,...}]}], so, e.g., f[2] == EV[x_2, DI[x_2, UD[{0, EV[x_1, DI[x_1, UD[{0,1}]]]}]]] == EV[x_2, DI[x_2, UD[{0,1/2}] == 1/4 which is trivial.
- jasomill 3y ago(As is the expectation of a uniform distribution in the first place. From the PDF for the uniform distribution (1/(b - a) for x ∈ [a,b], zero elsewhere) and the definition of EV as the integral of the product of the identity map and the PDF over the reals, EV[x, DI[x, UD[{a,b}]]] == Integrate[x * Piecewise[{ {1/(b - a), a <= x <= b}, {0, x < a || x > b}}], {x, -∞, ∞}] == Integrate[x * 1/(b - a), {x, a, b}] == ((b^2/2) - (a^2/2)) / (b - a) == (a + b)/2 so for a = 0, == b/2 no matter how many nested integrals it takes to define the real number b.)
- sobellian 3y agoI agree that E[r() * r() * ...] = 2^-n but that's not the final word. E[log(r() * r() * ...)] = -n and Pr(r() * r() * ... > 2^-n) is very small. That's the intuition part. The two distributions are identical, I checked numerically and they have the same summary statistics. Furthermore, r() * n is a uniform distribution from 0 to n so by induction we can prove the two are identical.
- sobellian 3y agoFor anyone who cares and read this far (and if so, I'm honestly surprised) I made a colab that demonstrates all this: https://colab.research.google.com/drive/1xCZ24cLPNOqyJD0kUTOUMKm3jDsDb48-?usp=sharing https://colab.research.google.com/drive/1xCZ24cLPNOqyJD0kUTO... To wrap it up: - X == r() * r() * ... == r(r(...)) - E[X] = 2^-n - median[X] ~ 1/2 exp(1 - n) ?! Anyway, I thought it was interesting - especially how the median never quite "catches up" to the value one might naively compute from the CLT. I think there's some subtlety I'm missing there.