Sunday, January 22, 2023

Mean Repeating Continuous Function

It a previous post I looked at the mean path of Brownian motion in 2D. Here I look at something similar in 1D: for a repeated continuous function. 

Again, the question arises as to what the space of all continuous repeating functions are. I think the answer that makes the least assumptions is a Brownian bridge from 0 to 0. It is therefore repeated Brownian motion. 

If we took the mean function of all such Brownian bridges, the result would be y=0, which is rather boring. 

However, this series of 'mean things' is including symmetries, or rather, making certain parameters non-absolute. In this case we make the x position of the function non-absolute, and we give it scale symmetry in its range, so we look at the mean function only relative to its own variance in y, and without any absolute x values. 

We can make a Brownian bridge from 0 to 0 by noting that the power spectrum of Brownian noise is 1/f^2 where f is the spatial frequency. We can therefore generate this spectrum with random phase values per wavelength, and take the inverse Fourier transform to get the resulting Brownian bridge.

The algorithm is as follows:

For each pair of repeating functions, cross correlate (Fourier transform, element-wise multiply, inverse Fourier transform) to get the x offset where they are closest, then average the two using this x offset.

The resulting function looks like this:

In other words a sine wave. At least it appears to be a sine wave, and it probably is exactly that. 

We can also give the range vertical symmetry, so we pick the closest correlation between the two functions from either the two positive functions, or with the second function negated. This removes the symmetry in the repeating function, giving a slightly leaning sine wave:
Noting that it is this function, and its negative, which are the mean repeating functions.

It is probably not right for our samples to have an exact 1/f magnitude for each wave frequency f, a better sample would have its magnitude taken from a normal distribution with standard deviation f. This takes longer to converge but seems to give the same results. Without reflection symmetry:

With reflection symmetry:

We could extend this idea to 2D, for example finding the mean Brownian drum (0 in a unit circle) under rotation symmetry, but I think it is likely to be a simple smooth Bessel function. We could also make a Brownian surface on a sphere (using spherical harmonics presumably) under spherical rotation symmetry, but I also imagine that the result would be very smooth and simple.