In[]:=
CompoundExpression[
]
​​deploy
Fri 26 May 2023 15:33:19

Break-even point for infinite rank

Question: For which d does
1^-p,2^-p,3^-p,...,
-p
d
resemble the infinite dimensional version in terms of effective rank?Answer: for d>
1
p-1
(2+
2
)
/exp(γ)
math.SE question:
- Smallest value of d such that (math.SE post)
- Getting a series expansion for implicitly defined function (mathematica.SE post)
​
Other notebooks:
- alpha-capacity-effective-rank.nb​
​
TLDR;
- Claude turns it into continuous root finding problem, using continuous generalization of Harmonic number
- Gary gives simpler version of Harmonic in terms of Zeta/truncated sum
- Michael E2 fixes Plot bug, need to use SetPrecision
In[]:=
Clear["Globals`*"];​​predict[p_]:=Exp-0.5843521872961219`+1.228079016227338`*
1
p-1
;​​breakEven[p_]:=d/.FindRoot
2
Zeta[p]
Zeta[2p]
==
2
Sum[
-p
i
,{i,1,d}]
Sum[
-2p
i
,{i,1,d}]
*2,{d,Floor[predict[p]]},AccuracyGoal->1​​rvals=Table[r,{r,1.,100}];​​dvals=breakEven[1+1/#]&/@rvals;​​observedPlot=ListPlot[{rvals,dvals},ScalingFunctions->{Automatic,"Log"},AxesLabel->{"r","
*
d
"},PlotLabel->"Break-even as function of rank r",PlotLegends->{"observed"}];​​​​fit=LinearModelFit[{rvals,Log@dvals},x,x]​​predictedPlot=LogPlot[Exp@fit[r],{r,Min@rvals,Max@rvals},PlotLegends->{fit},PlotStyle->Red];​​Show[observedPlot,predictedPlot]
FindRoot
:Encountered a singular Jacobian at the point {d} = {5.5803×
15
10
}. Try perturbing the initial point(s).
FindRoot
:Encountered a singular Jacobian at the point {d} = {1.90548×
16
10
}. Try perturbing the initial point(s).
FindRoot
:Encountered a singular Jacobian at the point {d} = {6.50659×
16
10
}. Try perturbing the initial point(s).
General
:Further output of FindRoot::jsing will be suppressed during this calculation.
Out[]=
FittedModel
-0.587283+1.22813x

Out[]=
observed
FittedModel
-0.587283+1.22813x

-0.5843521872961219`+1.228079016227338`x
In[]:=
predict2[p_]:=Exp-0.5872825625315911`+1.2281342999064533`
1
p-1
;​​pvals=Table1+
1
r
,{r,2.,100};​​dvals=breakEven/@pvals;​​sf={Automatic,"Log"};​​observedPlot=ListPlot[{pvals,dvals},ScalingFunctions->sf,PlotStyle->PointSize[Medium]];​​​​predictedPlot=Plot[predict2[p],{p,Min[pvals],Max[pvals]},PlotRange->All,ScalingFunctions->sf,PlotLegends->{MaTeX["c_1 \\exp \\left(\\frac{c_2}{p-1}\\right)"]},PlotStyle->Red];​​Show[observedPlot,predictedPlot,AxesLabel->{"p","
*
d
"}]
FindRoot
:Encountered a singular Jacobian at the point {d} = {5.5803×
15
10
}. Try perturbing the initial point(s).
FindRoot
:Encountered a singular Jacobian at the point {d} = {1.90548×
16
10
}. Try perturbing the initial point(s).
FindRoot
:Encountered a singular Jacobian at the point {d} = {6.50659×
16
10
}. Try perturbing the initial point(s).
General
:Further output of FindRoot::jsing will be suppressed during this calculation.
Out[]=

Use Claude and Gary approximation

In[]:=
(*ClaudeVersion*)​​asymp1[p_]:=(​​f[x_]:=Log[2Zeta[2p]
2
HarmonicNumber[Exp[x],p]
]-Log[
2
Zeta[p]
HarmonicNumber[Exp[x],2p]];​​x/.FindRoot[f[x],{x,10},WorkingPrecision->20]​​);​​​​(*GaryapproximationofHarmonicnumber*)​​harmonicNumber[d_,p_]:=Zeta[p]-
1-p
d
p-1
;​​asymp2[p_]:=(​​f[x_]:=Log[2Zeta[2p]
2
harmonicNumber[Exp[x],p]
]-Log[
2
Zeta[p]
harmonicNumber[Exp[x],2p]];​​x/.FindRoot[f[x],{x,10},WorkingPrecision->20]​​);​​​​rvals=Table[r,{r,2,100,5}];​​pvals=Table1+
1
r
,{r,rvals};​​dvals1=asymp1/@pvals;​​dvals2=asymp2/@pvals;​​​​data1={rvals,dvals1};​​data2={rvals,dvals2};​​linearFit1=LinearModelFit[data1,x,x];​​linearFit2=LinearModelFit[data2,x,x];​​fittedPlot1=Plot[linearFit1[x],{x,2,100},PlotStyle->Red];​​fittedPlot2=Plot[linearFit2[x],{x,2,100},PlotStyle->Green];​​observedPlot1=ListPlot[data1];​​observedPlot2=ListPlot[data2,PlotStyle->PointSize[Small]];​​​​Show[fittedPlot1,fittedPlot2,observedPlot1,AxesLabel->{"r","Log[​
*
d
​]"}]
Out[]=
In[]:=
ListPlot[{pvals,dvals1-dvals2},ScalingFunctions->{"Log",Automatic},PlotLabel->"Gary approximation errors",AxesLabel->{"p","error"}]
Out[]=

Simpler plot

In[]:=
ClearAll["Globals`*"];​​g[r_,x_]=Log2
2
-
-1/r
(
x

)
r+Zeta1+
1
r

Zeta21+
1
r
-Log
2
Zeta1+
1
r

-
1-21+
1
r
(
x

)
-1+21+
1
r

+Zeta21+
1
r
;​​f[r_]:=x/.FindRoot[g[r,x],{x,1}];​​Plot[f[r],{r,1,10},AxesLabel->{"r","f(r)"}]

Roman answer

Relative error of Roman’s approximation

Asymptotic Inversion general approach