Cumulative distribution function of weighted sum of random uniform variables

normal distributionprobability distributionsprobability theoryuniform distribution

I'm not very familiar with the mathematical jargon of probabilities, so I apologize in advance for any mistakes I might make.

Short version

I want to know how to compute the cumulative distribution of the weighted sum of $n$ uniform variables. Specifically, the sum $S$ is computed as

$$
S = \Sigma_{i = 1}^{n}\ R_i\ \times\ P^{n – 1}
$$

Where $R_i$ is a uniform random variable in the range $[-1, 1]$ and $P$ a constant real number (normally, $0 < P < 1$).

Long version

Perlin noise is a type of gradient noise developed by Ken Perlin in 1983. It has many uses, including but not limited to: procedurally generating terrain, applying pseudo-random changes to a variable, and assisting in the creation of image textures.

Wikipedia

When generating Perlin noise, it is common to overlap many octaves (each in the range$[-1, 1]$ to create more detailed looking noise. These octaves are assigned different weights. The parameter used to control this is called persistance. The weight of the $n$th octave is $persistance^{n – 1}$. Finally, this sum is normalized to bring the value back to a $[-1, 1]$ range.

One of the nice characteristics of Perlin noise is that it has a uniform distribution: each value in the range $[-1, 1]$ is equally likely. However, using many octaves ruins this, since the distribution becomes a normal distribution. Hence, I would like to tranform it into a uniform distribution using probability integral transform.

For this, the cumulative distribution function is needed. I've looked into Bates distribution and Irwin-Hall distribution, but they assume an equal weight for each of the variables being added.

Here is the question:

I want to know how to compute the cumulative distribution of the weighted sum of $n$ uniform variables. Specifically, the sum $S$ is computed as

$$
S = \Sigma_{i = 1}^{n}\ R_i\ \times\ P^{n – 1}
$$

Where $R_i$ is a uniform random variable in the range $[-1, 1]$ and $P$ a constant real number (normally, $0 < P < 1$).

Final notes

I've lost all hope of implementing this in code, but I'm curious to know the formula anyway. Just for the sake of curiosity, my plan is to sample something like a million values, arrange them in a thousand "buckets" and compute the cumulative probability function with them.

  • More details on Perlin noise and its uses can be found on this video by Sebastian Lague (one of my favorite youtubers, btw).
  • For a different explanation of the problem with uniform Perlin noise, see this question on StackOverflow (just ignore the paragraph about Matlab).

Best Answer

The pdf of the distribution you seek is a spline polynomial of degree $n-1$ that has $2^n$ nodes. However,your distribution actually stabilizes quickly with just a few values of $n$. Here is picture of an example of the distribution, with $p=1/3$ and $n=5$ convolutional layers. You get essentially the same picture with just $n=3$ layers. The reason? When you adjoin more layers of complexity you are convolving the prior probability distributions with rectangular window functions that have very narrow widths and are essentially delta functions.

Note. Modifying the observation in Snoop's comment, I used the convention $R=[0,1]$ rather than $ R=[-1,1]$ ( so that I could use a built-in Laplace transform inverter rather than the Fourier transform). This translation of the center of the interval merely has the effect of re-centering the distribution you seek.

See this related post for additional info regarding sums of uniformly distributed random variables that live on different intervals. sums of uniform random variables with different support intervals

enter image description here

Related Question