I want to calculate the distribution that comes from summing up random numbers between -0.5 and 0.5.
A computationally intensive version of doing this is to simply do the following:
SmoothHistogram[
Table[Table[
Sum[RandomReal[] - 0.5, {i, 1,
numberOfRandomNumbersAdded}], {1000000}], \
{numberOfRandomNumbersAdded, 1, 5}]]
This won't work however if the number of numbers to be summed is very large, like a 1000000 for example.
So I tried doing it by first calculating the distribution of one random number, then calculating the distribution of two random numbers from the first distribution. The first distribution is simply:
UnitBox[x]
The next distribution can be calculated by integrating the previous distribution from x-0.5 to x+0.5:
Integrate[UnitBox[a], {a, x - 1/2, x + 1/2}]
I can't figure out how to iterate this to, for example, draw a plot from the result.
I also tried the following:
NestList[PDF[
ProbabilityDistribution[
Integrate[# /. x -> a, {a, x - 1/2, x + 1/2},
Assumptions -> x \[Element] Reals], {x, -2, 2}], x] &,
UnitBox[x], 5]
Plot[%, {x, -2, 2}]
dis[n_] := UniformSumDistribution[n, {-.5, .5}]; Plot[Evaluate[PDF[dis@#, x] & /@ Range[10]], {x, -2, 2}]
? $\endgroup$