1

Recently I was looking at a paper where the velocity auto-correlation function $$C(t) = \langle v_x(t) v_x(0) \rangle = \langle \cos\theta(t), \cos \theta(0) \rangle$$ was being considered for a number of point particles with velocities distributed uniformly on $S^1$ at time zero (here $\langle \cdot \rangle$ denotes an average over initial conditions). In the above, $\theta(t)$ is the angle w.r.t to the horizontal at time $t$. In their plot of $C(t)$ vs. $t$ I noticed that $C(0) \ne 1/2$ (there were multiple plots). However I don't see this when trying to generate a uniform velocity distribution so I assume I am doing something wrong here.

I generate velocities uniformly on $S^1$ as follows:

    N <- 10^4                                          # number of samples
    r <- runif(N, 0, 1)                                # uniform radii in [0,1]
    theta <- runif(N, -pi, pi)                         # uniform angles
    P <- cbind(sqrt(r)*cos(theta), sqrt(r)*sin(theta)) # uniform points in the unit disk
    L <- sqrt(P[,1]*P[,1] + P[,2]*P[,2]) 
    V <- P/L 

Another method I've seen is:

X1 <- rnorm(N, 0, 1)
X2 <- rnorm(N, 0, 1)
R  <- sqrt(X1*X1 + X2*X2)
V  <- matrix(rbind(X1/R, X2/R), N, 2, byrow=TRUE)

Or using the pracma package:

pracma::rands(N, r=1.0, N=1.0)

Firstly, can someone confirm that these are appropriate methods for generating points uniformly on the unit circle?

In all cases mean(V[,1] * V[,1]) returns $\approx 1/2$.

Moreover if $\Theta \sim \mathcal{U}[-\pi, \pi]$ and $V = \cos^2 \Theta$ then it has the pdf $$f_V(x) = \dfrac{-2}{\pi} \dfrac{d}{dx} (\sin^{-1} \sqrt{x}) = \dfrac{-1}{\sqrt{x(1-x)}}$$ which has mean value $$\int_0^1 x f_V(x) dx = 1/2.$$

Is this correct?

Edit:

The issue with the final calculation is that uniform points on the circle are not formed by simply taking the cosine and sine of uniformly distributed angles, so it must be incorrect..

algae
  • 43
  • 9

1 Answers1

1

Integration over initial condition also gives $1/2$. $$ C(0) = \left< \cos \theta, \cos \theta\right> = \frac{\int_{-\pi}^{\pi} \cos^2 \theta \, d\theta }{ \int_{-\pi}^{\pi} \, d\theta} = \frac{1}{2} $$

It could be that in the paper it is normalized by $C(0)$.

slitvinov
  • 125
  • 9
  • And does the code do as suggested? – algae May 24 '20 at 03:24
  • @algae both of your codes do not sample from $S^1$. I think the simple way is to take cosine and sine of `runif(N, -pi, pi)`. – slitvinov May 24 '20 at 08:40
  • AFAIK that is the classic mistake that is made when sampling points uniformly on $S^1$. The first code is based on the paper [here](https://dornsifecms.usc.edu/assets/sites/520/docs/VonNeumann-ams12p36-38.pdf). – algae May 24 '20 at 08:51
  • Interesting. Is it incorrect in theory, computational inefficient, or not robust to floating point precision? – slitvinov May 24 '20 at 09:26
  • Incorrect in theory. Cosine and sine of uniform angles do not give uniform points on the circle. – algae May 24 '20 at 09:32
  • @algae What is your definition of uniform points on the circle? I don't see how $\mathcal{U}(0, 2 \pi)$ can be incorrect. See also https://mathworld.wolfram.com/CirclePointPicking.html – slitvinov May 25 '20 at 17:03
  • Perhaps I was getting confused with disk point picking... You are correct according to [this](https://stats.stackexchange.com/questions/252864/circular-uniform-distribution-using-copula?rq=1) and [this](https://stats.stackexchange.com/questions/79174/how-can-i-generate-uniformly-distributed-points-on-a-circle?rq=1) answer. However I think all my methods here are equivalent to $(\cos \mathcal{U}, \sin \mathcal{U})$, the first one just has an extra step. – algae May 26 '20 at 00:51