0
$\begingroup$

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).
$\endgroup$
1
  • $\begingroup$ The characteristic function (note: this characterizes a probability distribution) has semi-closed form if we are supposing these $(R_n)_{n \in \mathbb{N}}$ are independent: $$E[e^{i\xi S}]=\prod_{1\leq k\leq n}E[e^{i\xi p^{k-1}R_k}]=\prod_{1\leq k \leq n}\frac{e^{i\xi p^{k-1}}-e^{-i\xi p^{k-1}}}{2i\xi p^{k-1}}=\prod_{1\leq k \leq n}\frac{\sin(\xi p^{k-1})}{\xi p^{k-1}}$$ for $\xi \neq 0$ and $=1$ for $\xi =0$. $\endgroup$
    – Snoop
    Apr 5, 2023 at 15:28

1 Answer 1

0
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ Hi there! It'll take me some time to digest your answer, since this is not a domain of mathematics I'm very familiar with... Anyway, thanks for the effort you put into it! $\endgroup$
    – M7kra
    Apr 7, 2023 at 11:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .