In[]:=
SetOptions[EvaluationNotebook[],CreateCellID->True]
In[]:=
deploy
Fri 27 Aug 2021 17:52:40
In[]:=
setupProblem[nn_]:=Clear[x];n=nn;hs=Table,{i,1,n};xs=Array[x,n];Z=;(*Z=Integrate[1,xs∈R]*);setupProblem[2];H==DiagonalMatrix[hs]//TraditionalForm
1
i
2
n/2
π
Gamma[n/2]
Out[]//TraditionalForm=
H
1 | 0 |
0 | 1 2 |
Ratio of Normals
Ratio of Normals
In[]:=
normalRatio:=dist=MultinormalDistribution[IdentityMatrix[n]];TransformedDistribution.,xsdist;Mean[normalRatio]
hs.
2
xs
2
hs
2
xs
Out[]=
4
3
Ratio of Dirichlet
Ratio of Dirichlet
In[]:=
dirichletRatio:=dist=DirichletDistribution[ConstantArray[1/2,n+1]];TransformedDistribution.xs,xsdist;Mean[dirichletRatio]
hs.xs
2
hs
Out[]=
4
3
Surface Integral
Surface Integral
In[]:=
R=ImplicitRegion@@{Total[]1,xs};Z=Integrate[1,xs∈R];Integrate.Z,xs∈R
2
xs
hs.
2
xs
2
hs
2
xs
Out[]=
4
3
Numerical integration
Numerical integration
In[]:=
estimateR[n_]:=setupProblem[n];dist=MultinormalDistribution[IdentityMatrix[n]];ratio=TransformedDistribution.,xsdist;NExpectation[x,xratio];Table[estimateR[n],{n,1,4}]
hs.
2
xs
2
hs
2
xs
Out[]=
{1.,1.33333,1.57976,1.77491}
Dot product expansion
Dot product expansion
From hyperplane simplification: https://stats.stackexchange.com/questions/539720/expected-ratio-of-xax-and-xaax-on-a-unit-sphere/540580#540580
In[]:=
solveDot[nn_]:=setupProblem[nn];dist=MultinormalDistribution[DiagonalMatrix[]];distz=TransformedDistribution,xsdist;z=NExpectation[xs,xsdistz];Total[z/hs]
2
hs
2
xs
Total[]
2
xs
In[]:=
Table[solveDot[i],{i,1,7}]
Out[]=
{1.,1.33333,1.57976,1.77491,1.93664,2.07492,2.19579}
In[]:=
getz[nn_]:=setupProblem[nn];dist=MultinormalDistribution[DiagonalMatrix[]];distz=TransformedDistribution,xsdist;z=NExpectation[xs,xsdistz];vals=getz[7];vals
2
hs
2
xs
Total[]
2
xs
Out[]=
{0.490807,0.209373,0.115147,0.0723392,0.0494284,0.0358013,0.02707}
Average Learning rate
Average Learning rate
Animation
Animation
In[]:=
exportAnim[fn_,images_,is_]:=Module[{},rasters=images;SetDirectory[NotebookDirectory[]];SetDirectory["export"];Export[fn,rasters,"AnimationRepetitions"Infinity]];cylinder[t_]:=With{x=Cos[t],y=Sin[t]},Graphics3D@Cylinder{x,y,0},x,y,+1/2+1/4,1100;plot3da=Plot3D0,+12,+14,{x,-1,1},{y,-1,1},MeshFalse,RegionFunctionFunction[{x,y,z},x^2+y^2≤1],MeshFunctions{#3&},BoxedFalse,AxesNone,PlotStyleOpacity[0.5],PlotPoints50;plot3d[t_]:=Show[plot3da,cylinder[t]]blue=ColorData[97,"ColorList"][[1]];(*plot2da=Plot[Callout[+3,"",Above],Callout[+3,"",Below],Callout[2,"",Above],{t,0,2Pi},PlotStyle{blue,blue,Dashed},AxesOrigin{0,0}];*)plot2da=Plot++,Callout,"",Above,{t,0,2Pi},AxesOrigin{0,0},PlotStyle{Automatic,Dashed},PlotRangePadding.75,Ticks{{Pi/2,Pi,3Pi/2,2Pi},{0,1,1.33,2}};point[t_]:=ListPlotWith{x=Cos[t],y=Sin[t]},t,++,PlotStylePointSize[Large],FillingAxis,FillingStyleDirective[Orange,Opacity[0.8]]plot2d[t_]:=Show[plot2da,point[t],ImageSize400];plotCombined[t_]:=GraphicsRow[{Show[plot3d[t],ImageSize600],Show[plot2d[t],ImageSize500]}]plotCombined[2]
2
x
2
y
2
x
2
y
2
x
2
y
2
x
2
y
2
Cos[t]
2
Sin[t]
λ
1
2
Cos[t]
2
Sin[t]
λ
2
λ
ave
2
Cos[t]
2
Sin[t]
2
2
Cos[t]
2
Sin[t]
4
4
3
4
3
2
Cos[t]
2
Sin[t]
2
2
Cos[t]
2
Sin[t]
4