Joy Christian wrote:FrediFizzx wrote:Mathematica says that Joy's original function 0.5 sin^2(theta) with theta (0,pi/2) is the best for f. Those slight deviations around the peaks will be gone when trials go to infinity and degree increments go to 0. No big deal. There is either something wrong with the R programming or R is a piece of junk.
I'm still waiting for you to prove what I am saying is false. Figured that you can't do it because you know it is in fact a waste of time because what I am claiming is true.
I am indeed becoming increasingly curious about your claim. Although the anecdotal evidence seems to favor the R-based claim that the function 0.5 sin^2(theta) with theta in [0, pi/2] is not exactly true at greater precision,
all of this anecdotal evidence is based on finite number of trials and finite degree of increments. But as we know, my analytical model is based on a smooth, simply-connected manifold S^3. So your argument, after all, may win the day in the end. We need more evidence.
The "finite degree of the increments" is not an issue here. We can talk about the values of some particular curves, at some particular values.
If I may use the language of probability theory, the "0.5 sin^2(theta)" simulation model is:
Take two points a, b in S^2 with a.b = cos(phi)
Let Theta ~ Uniform([0, pi/2])
Let E ~ Uniform(S^2), independent of Theta.
Define A = sign(a.E) if abs(a.E) > sin( 0.5 sin^2(Theta) ) otherwise 0
Define B = sign(b.E) if abs(b.E) > sin( 0.5 sin^2(Theta) ) otherwise 0
Define rho(a, b) = E( AB | AB != 0)
Simulation experiment. Pick any a, b (anyway you like), suppose a.b = cos(phi). Keep them fixed.
M times, independenly of one another, pick Theta and E as described above. (I'm keeping a and b fixed, all the time).
Each time, define A and B as above and report the average of the products of A times B, divided by the number of times A times B was unequal to zero. Call this "rhoHat", the estimated correlation. Let N = number of times that AB was unequal to zero.
Elementary statistics tells me that rhoHat is an unbiased estimator of rho(a, b) and that, conditional on N=n, its variance is less than 1/n.
Basically we have a binomial experiment: given N=n, N(++) + N(--) has the binomial distribution with parameters n and p, where p = (rho + 1)/2 and equivalently rho = 2 p - 1. And, rhoHat= 2 pHat -1 with pHat = (N(++) + N(--))/n.
The question we are interested in, is: "Is rho(a, b), as defined above, equal to cos(phi)"?
The numerical accuracy of R, Mathematica, Python is about 10^-17 if I remember correctly (floating point real arithmetic, i.e. "double precision" real numbers represented by two 32 bit words). All of these systems have excellent pseudo random number generators. I am sure they can all compute cosine and sine functions to sufficient accuracy for our present purposes.
The important thing to notice is that there is no binning of continuous angles here, at all! Generating angles a and b at random, uniformly on 0 2 pi, might correspond to some kinds of real experiments, but even experimenters know that they can also "do the experiment" with the settings fixed for a long time. If all settings are different because each new one is random and uniform, then we have to bin or smooth in some way to get curves. But I want to determine just one point on the curve as accurately as possible. Or just a few points on the curve. It's sufficient for present purposes.