In[]:=
(*deployswithcanonicalname*)​​
CompoundExpression[
]
​​deploy
Wed 21 Jun 2023 09:33:14
Shifted Beta for unsquared post, ArcSin is special case​
​Using characteristic functions post by Wolfies, Bob Hanlon post using TransformedDistribution)​

Distribution of a squared coordinate on a sphere

First and second coordinate

Regular coordinate

In[]:=
ClearAll["Globals`*"];​​dims=Range[5];​​SF=StringForm;​​legends=SF["n=``",#]&/@dims;​​func[n_]=PDF[#,x]&@TransformedDistribution[(2x-1),xBetaDistribution[n/2,n/2]]//Simplify​​Plot[Evaluate[func/@dims],{x,-1,1},PlotLegends->legends,PlotLabel->"Distribution of
x
1
on n-sphere"]​​​​func[n_]=
-1+
n
2
(1-x)
Gamma
1+n
2

π
x
Gamma
n
2

;​​func[n_]=Refine@PDF[BetaDistribution[1/2,n/2],x];(*sameasabove*)​​func[n]​​Plot[Evaluate[func/@dims],{x,0,1},PlotLegends->legends,PlotLabel->"Distribution of
2
x
1
on n-sphere"]
Out[]=
1-n
2
-1+
n
2
(1-
2
x
)
Beta
n
2
,
n
2

Out[]=
n=1
n=2
n=3
n=4
n=5
Out[]=
-1+
n
2
(1-x)
x
Beta
1
2
,
n
2

Out[]=
n=1
n=2
n=3
n=4
n=5

Deriving from characteristic functions

Following example in:
https://mathematica.stackexchange.com/a/286688/217
In[]:=
pdf=
n/2-1
(1-
2
x
)
Beta[n/2,1/2]
;​​$Assumptions={0<x<1};​​char=Expectation[Exp[Itx],xTransformedDistribution[(2x-1),xBetaDistribution[n/2,n/2]]];​​pdf2=InverseFourierTransform[char,t,x,FourierParameters->{1,1}];​​
In[]:=
pdf==pdf2/.{n->3,x->RandomReal[{0,1}]}
Out[]=
True
In[]:=
char=Expectation[Exp[It
2
x
],xTransformedDistribution[(2x-1),xBetaDistribution[n/2,n/2]]];​​InverseFourierTransform[char,t,x,FourierParameters->{1,1}]
Out[]=
-1+
n
2
(1-x)
Gamma
1+n
2

π
x
Gamma
n
2


Deriving from Mathematica built-in

In[]:=
n=.;​​dist=BetaDistribution[n/2,n/2];​​squaredDist=TransformedDistribution[(2x-1)^2,xdist];​​pdf=Refine@PDF[squaredDist,x]
Out[]=
1-n
2
-1+
n
2
(1-x)
x
Beta
n
2
,
n
2


Using moment matching

In[]:=
moments={1,2,3};​​dist=TransformedDistribution[
2
(2x-1)
,xBetaDistribution[n/2,n/2]];​​mgf=MomentGeneratingFunction[dist,u];​​N@SeriesCoefficient[mgf#!,{u,0,#}]&/@moments​​​​data=
2
First[#]
&/@RandomPoint[Sphere[n+1],10000];​​Moment[data,#]&/@moments
Out[]=
{0.333333,0.2,0.142857}
Out[]=
{0.331413,0.198514,0.141643}

Fourth coordinate

In[]:=
n=2;​​moments={1,2,3};​​dist=TransformedDistribution[
4
(2x-1)
,xBetaDistribution[n/2,n/2]];​​mgf=MomentGeneratingFunction[dist,u];​​N@SeriesCoefficient[-mgf#!,{u,0,#}]&/@moments
Out[]=
{SeriesCoefficient[0.25ExpIntegralE[0.75,-1.u],{u,0.,1.}],SeriesCoefficient[0.5ExpIntegralE[0.75,-1.u],{u,0.,2.}],SeriesCoefficient[1.5ExpIntegralE[0.75,-1.u],{u,0.,3.}]}
In[]:=
data=
4
First[#]
&/@RandomPoint[Sphere[n+1],10000];​​Moment[data,#]&/@moments
Out[]=
{0.200752,0.11119,0.0765144}
Old Stuff
