In[]:=
CompoundExpression[
]
​​deploy
Wed 17 May 2023 18:55:27

Deriving Erfc formula

Root notebook:
- forum-mean-field-equation.nb
In[]:=
formula=Erfc
2
t
d

π
2
2
t
;​​formula=1-Erf
2
t
d

π
2
2
t
;​​​​​​getTrueLosses[p_,d_,z_,maxSteps_]:=Module[{},​​discretize[expr_]:=Table[N@expr,{i,0,d-1}];​​h$=discretize[
-p
(1+i)
/z];​​steps=Table[t,{t,0,maxSteps}];​​traj=NestList[#-#*h$&,discretize[1],maxSteps];​​{steps,h$.
2
#
&/@traj}​​];​​​​​​Block[{p=2,d=100,a=-2,maxSteps=100},​​trueLosses=Rest[Last/@getTrueLosses[p,d,1,maxSteps]];​​predictedLosses=Table[formula,{t,1,maxSteps}];​​];​​ListPlot[{trueLosses,predictedLosses},Joined->{False,True},PlotLegends->{"f(t)",formula},AxesLabel->{"t"}]​​
Out[]=
f(t)
π
2
1-erf
2
t
d
2
t
In[]:=
A=DiagonalMatrix[h$];​​ii=IdentityMatrix[Length@h$];​​h$.MatrixPower[ii-A,200,discretize[1]]==Last@trueLosses
Out[]=
True
In[]:=
Tr[A.MatrixPower[ii-A,200]]==Last@trueLosses
Out[]=
True

Obtaining candidate

In[]:=
Clear["Global`*"];​​baseAssumptions=d>1,1<p<=2,a<0,0<=b<=1,
p
d
!=1,
-p
d
<1,
p
d
>0,Log-
1
a
≠0,Log-
p
d
a
!=0;​​sAssumptions={s>0};​​​​​​(*Trickfrom​​https://mathematica.stackexchange.com/questions/284437/inverselaplacetransform-involving-an-arctan*)​​hackedLaplaceAtan[expr_]:=Module[{expr2,ilap},​​expr2=expr/.ArcTan[e_]->ArcTan[A*e];​​ilap=InverseLaplaceTransform[D[expr2,A]//Factor,s,t];​​Assuming[{t>0},Integrate[ilap,{A,0,1}]]​​];​​​​z=1;​​​​(*Changebetweenindexingdomainanddensitydomain*)​​iDomain[expr_]:=MemberQ[Reduce`FreeVariables[expr],i];​​yDomain[expr_]:=MemberQ[Reduce`FreeVariables[expr],y];​​varchange[expr_]:=​​IfiDomain[expr],​​expr/.i->
-1
p
(yz)
-1,​​Assert[yDomain[expr]];​​expr/.y->
-p
(i+1)
z​​​​;​​​​h=varchange@y;(*h=
-p
(i+1)
/z;*)​​pdf=
1
p
-1/p
z
-(1+1/p)
y
;​​toI[expr_]:=If[iDomain[expr],expr,varchange@expr];​​toY[expr_]:=If[yDomain[expr],expr,varchange@expr];​​​​laplaceDomain[expr_]:=MemberQ[Reduce`FreeVariables[expr],s];​​timeDomain[expr_]:=MemberQ[Reduce`FreeVariables[expr],t];​​​​lap[expr_]:=Block[{$Assumptions=baseAssumptions},​​If[laplaceDomain[expr],​​InverseLaplaceTransform[expr,s,t],LaplaceTransform[expr,t,s]]]​​​​Ei[expr_]:=Block[{i},Inactive[Integrate][toI[expr],{i,0,d-1}]];​​Ey[expr_]:=Block[{y},Inactive[Integrate][pdftoY[expr],{y,
-p
d
,1}]];​​​​Ehi[expr_]:=Block[{i},Inactive[Integrate][htoI[expr],{i,0,d-1}]];​​Ehy[expr_]:=Block[{y},Inactive[Integrate][pdfytoY[expr],{y,
-p
d
,1}]];​​​​​​f0=1;​​z=1;​​F=
f0
s-ah
;​​Activate[Ehi@F/.{p->2,a->-2}]//Apart//Expand
Out[]=
-
ArcTan
s
2

2
s
+
ArcTan
d
s
2

2
s
In[]:=
Activate[Ehy@F/.{p->2,a->-2}]//Apart//Expand
Out[]=
-
ArcTan
s
2

2
s
+
ArcTan
d
s
2

2
s
In[]:=
hackedLaplaceAtan-
ArcTan
s
2

2
s
+
ArcTan
d
s
2

2
s
//Apart//Expand
Out[]=
-
π
2
Erfc[
2
t
]
2
t
+
π
2
Erfc
2
t
d

2
t
In[]:=
term1=
π
2
Erfc
2
t
d

2
t
;​​term2=-
π
2
Erfc[
2
t
]
2
t
;​​Block{d=100},LogPlotterm1+term2,-
term2
term1+term2
,{t,1,100},PlotLabel->"Can we drop second term? (yes)",PlotLegends->{"loss","relative size of second term"},AxesLabel->{"t"}

Asymptotic behavior

Infinite t asymptotics

Infinite d asymptotics

Asymptotic Plots

From mean-field-equation: Exhaustive Solutions