# #StackBounty: #self-study #autocorrelation Mean square of x-component of uniformly distributed circle points

### Bounty: 50

Recently I was looking at a paper where the velocity auto-correlation function
$$C(t) = langle v_x(t) v_x(0) rangle = langle costheta(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..

Get this bounty!!!

This site uses Akismet to reduce spam. Learn how your comment data is processed.