Created
October 5, 2018 12:51
-
-
Save jw3126/541f53295809b5f473dc1bc558c7d768 to your computer and use it in GitHub Desktop.
Haar Measure of distance Ball SO(3)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://math.stackexchange.com/questions/1049788/haar-measure-of-an-angle-distance-ball-in-so3 | |
using StatsBase | |
using LinearAlgebra | |
using StatPlots | |
using Plots | |
using Rotations | |
function sample_angles(N) | |
map(1:N) do _ | |
rot = rand(RotMatrix{3}) | |
AngleAxis(rot).theta | |
end | |
end | |
N_bins = 100 | |
N_samples = 10^5 | |
wts = weights(fill(1.,N_samples)) | |
edges = range(0,stop=pi,length=N_bins) | |
h = fit(Histogram, sample_angles(N_samples), wts, edges, closed=:left) | |
pdf(angle) = 1 - cos(angle) | |
plot(title="Pdf angle of rotation Haar Measure") | |
plot!(rad2deg.(edges)[2:end], N_bins*normalize!(h.weights,1), label="simulation") | |
plot!(rad2deg.(edges), pdf.(edges), label="pdf") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment