In[]:=
Wed 22 Mar 2023 15:27:06
Asymptotic Behavior
Asymptotic Behavior
Asymptotic behavior of ∏𝑠𝑖=1(1−𝛼𝑥2𝑖)2 for Gaussian 𝑥𝑖
- https://stats.stackexchange.com/questions/610099/asymptotic-behavior-of-prod-i-1s-1-alpha-x2-i2-for-gaussian-x-i
- root finders: forum-gaussian-integrals.nb
Top-level section:
“Multiplicative Convergence + Kaczmarz” of Notes: Optimization
- https://stats.stackexchange.com/questions/610099/asymptotic-behavior-of-prod-i-1s-1-alpha-x2-i2-for-gaussian-x-i
- root finders: forum-gaussian-integrals.nb
Top-level section:
“Multiplicative Convergence + Kaczmarz” of Notes: Optimization
In[]:=
SeedRandom[Method->"MKL"];gaussianSampler[diag_]:=With{d=Length[diag]},Compile{{n,_Integer}},Module{vals,diagSqrt},diagSqrt=log(1-"]SmoothHistogram[lastStep,PlotLabel->SF["s=``, α=``",numSteps,nf[α]]]Print[SF["At step=``",s]];Clear[expectation,a,x];pdfN01=1/Sqrt[2*Pi]*Exp[-x^2/2];term=2*Log[Abs[1-α*x^2]];expectation[a_]:=NIntegrate[term*pdfN01,{x,-Infinity,Infinity}];expectation2[a_]:=NIntegrate[*pdfN01,{x,-Infinity,Infinity}];variance[a_]:=(expectation2[α]-expectation[α]);TableForm[{{nf@Mean[lastStep],nf@Variance[lastStep]},{nf[expectation[α]*s],nf[variance[α]*s]},{expectation[α],variance[α]}},TableHeadings->{{"Monte-Carlo","NIntegrate","NIntegrate at s=1"},{"mean","variance"}}]
diag
;vals=diagSqrt*#&/@RandomVariate[NormalDistribution[],{n,d}];Clear[step];d=1;h=ConstantArray[1.,d];h=h/Total[h];sampler=gaussianSampler[h];α=2.422;B=1001;(*batch*)s=100;(*simulationlength*)x0=sampler[10];step[w_,x_]=w-αxx.w;batchStep[W_]:=MapThread[step,{W,sampler[B]}];vals=NestList[batchStep,sampler[B],numSteps];(*numSteps+1xBxd*)sqNorms=Total[vals*vals,{3}];(*numSteps+1XB*)lastStep=Log@Last@sqNorms;medianNorms=Median/@sqNorms;meanNorms=Mean/@sqNorms;SF=StringForm;nf[val_]:=NumberForm[N@val,{3,3}];ListPlot[{Log[meanNorms],Log[medianNorms]},PlotLegends->{"mean","median"},PlotRange->All,AxesLabel->{"s","value"},PlotLabel->"Values of s
∑
2
x
i
2
)
2
term
Out[]=
Out[]=
At step=100
Out[]//TableForm=
mean | variance | |
Monte-Carlo | -1.610 | 653.000 |
NIntegrate | 0.040 | 646.000 |
NIntegrate at s=1 | 0.00039635 | 6.45951 |