Get["~/doc/research/first_order_singularities/mma/schofield.wl"]

SetAttributes[untilSuccess,HoldAll];
untilSuccess[e_]:=Quiet[Check[e,untilSuccess[e]]]

randomEval[eq_]:=eq/.Around[x_,y_]:>RandomVariate[NormalDistribution[x,y]]

$DefaultRemoteKernel=RemoteKernelObject["ssh://math@sident.lassp.cornell.edu"];

Match ends

Generate fits

ListLogPlot[{
Abs[Gls],
Chop@Abs@dGdξLowList[NF[2],H[2],Join[rules[H[2]],S[2]]][14],
Chop@Abs@dGdξLowList[NF[7],H[7],Join[rules[H[7]],S[7]]][14]
}]

ListLogPlot[{
Abs[Ghs],
Chop[Abs@dGdξList[NF[2],H[2],Join[rules[H[2]],S[2]]][14,0]],
Chop[Abs@dGdξList[NF[7],H[7],Join[rules[H[7]],S[7]]][14,0]]
}]

ListLogPlot[{
Abs[Φs],
Chop[Abs@dΦdηList[NF[2],H[2],Join[rules[H[2]],S[2]]][10,1]],
Chop[Abs@dΦdηList[NF[7],H[7],Join[rules[H[7]],S[7]]][10,1]]
}]

NFN[2]=2;
HN[2]=h[1];
SN[2]=annealFit[Join[resAll[NFN[2],HN[2],(10^(-5))][2],Table[A[i]i!,{i,1,NFN[2]}],Table[gC[i]i!,{i,1,1}]],{θc->1.2,θ0->0.2,AH->-2.5,A[1]->1,A[2]->0,gC[1]->0},(10^(-1))]

SN[2]=annealFit[Join[resAll[NFN[2],HN[2],(10^(-10))][2],Table[A[i]i!,{i,1,NFN[2]}],Table[gC[i]i!,{i,1,1}]],SN[2][[2]]]

NFN[3]=2;
HN[3]=h[2];
SN[3]=annealFit[Join[resAll[NFN[3],HN[3],(10^(-6))][3],Table[A[i]i!,{i,1,NFN[3]}],Table[gC[i]i!,{i,1,2}]],Join[SN[2][[2]],{gC[2]->0}],(10^(-2))]

SN[3]=annealFit[Join[resAll[NFN[3],HN[3],(10^(-10))][3],Table[A[i]i!,{i,1,NFN[3]}],Table[gC[i]i!,{i,1,2}]],SN[3][[2]]]

NFN[4]=3;
HN[4]=h[3];
SN[4]=annealFit[Join[resAll[NFN[4],HN[4],(10^(-6))][4],Table[A[i]i!,{i,1,NFN[4]}],Table[gC[i]i!,{i,1,3}]],Join[SN[3][[2]],{gC[3]->0,A[3]->0}],(10^(-3))]

SN[4]=annealFit[Join[resAll[NFN[4],HN[4],(10^(-10))][4],Table[A[i]i!,{i,1,NFN[4]}],Table[gC[i]i!,{i,1,3}]],SN[4][[2]]]

NFN[5]=4;
HN[5]=h[4];
SN[5]=annealFit[Join[resAll[NFN[5],HN[5],(10^(-4))][5],Table[A[i]i!,{i,1,NFN[5]}],Table[gC[i]i!,{i,1,4}]],Join[SN[4][[2]],{gC[4]->0,A[4]->0}],(10^(-3))]

SN[5]=annealFit[Join[resAll[NFN[5],HN[5],(10^(-7))][5],Table[A[i]i!,{i,1,NFN[5]}],Table[gC[i]i!,{i,1,4}]],SN[5][[2]]]

SN[5]=annealFit[Join[resAll[NFN[5],HN[5],(10^(-10))][5],Table[A[i]i!,{i,1,NFN[5]}],Table[gC[i]i!,{i,1,4}]],SN[5][[2]]]

NFN[6]=5;
HN[6]=h[5];
SN[6]=annealFit[Join[resAll[NFN[6],HN[6],(10^(-4))][6],Table[A[i]i!,{i,1,NFN[6]}],Table[gC[i]i!,{i,1,5}]],Join[SN[5][[2]],{A[5]->0,gC[5]->0}],(10^(-4))]

SN[6]=annealFit[Join[resAll[NFN[6],HN[6],(10^(-7))][6],Table[A[i]i!,{i,1,NFN[6]}],Table[gC[i]i!,{i,1,5}]],SN[6][[2]]]

SN[6]=annealFit[Join[resAll[NFN[6],HN[6],(10^(-10))][6],Table[A[i]i!,{i,1,NFN[6]}],Table[gC[i]i!,{i,1,5}]],SN[6][[2]]]

NFN[7]=4;
HN[7]=h[6];
SN[7]=annealFit[Join[resAll[NFN[7],HN[7],(10^(-4))][7],Table[A[i]i!,{i,1,NFN[7]}],Table[gC[i]i!,{i,1,6}]],Join[SN[6][[2]],{gC[6]->0}],(10^(-4))]

SN[7]=annealFit[Join[resAll[NFN[7],HN[7],(10^(-7))][7],Table[A[i]i!,{i,1,NFN[7]}],Table[gC[i]i!,{i,1,6}]],SN[7][[2]]]

SN[7]=annealFit[Join[resAll[NFN[7],HN[7],(10^(-10))][7],Table[A[i]i!,{i,1,NFN[7]}],Table[gC[i]i!,{i,1,6}]],SN[7][[2]]]

NFN[8]=5;
HN[8]=h[7];
SN[8]=RemoteEvaluate@annealFit[Join[resAll[NFN[8],HN[8],(10^(-3))][8],Table[A[i]i!,{i,1,NFN[8]}],Table[gC[i]i!,{i,1,7}]],Join[SN[7][[2]],{A[5]->0,gC[7]->0}],(10^(-5))]

SN[8]=RemoteEvaluate@annealFit[Join[resAll[NFN[8],HN[8],(10^(-6))][8],Table[A[i]i!,{i,1,NFN[8]}],Table[gC[i]i!,{i,1,7}]],SN[8][[2]]]

SN[8]=RemoteEvaluate@annealFit[Join[resAll[NFN[8],HN[8],(10^(-9))][8],Table[A[i]i!,{i,1,NFN[8]}],Table[gC[i]i!,{i,1,7}]],SN[8][[2]],(10^(-6))]

NFN[9]=5;
HN[9]=h[8];
SN[9]=RemoteEvaluate@annealFit[Join[res[NFN[9],HN[9],(10^(-4))][9],Table[A[i]i!,{i,1,NFN[9]}],Table[gC[i]i!,{i,1,8}]],Join[SN[8][[2]],{gC[8]->0}],(10^(-7))]

SN[9]=RemoteEvaluate@annealFit[Join[res[NFN[9],HN[9],(10^(-7))][9],Table[A[i]i!,{i,1,NFN[9]}],Table[gC[i]i!,{i,1,8}]],SN[9][[2]]]

SN[9]=RemoteEvaluate@annealFit[Join[res[NFN[9],HN[9],(10^(-10))][9],Table[A[i]i!,{i,1,NFN[9]}],Table[gC[i]i!,{i,1,8}]],SN[9][[2]]]

NFN[10]=7;
HN[10]=h[8];
SN[10]=RemoteEvaluate@annealFit[Join[res[NFN[10],HN[10],(10^(-6))][10],Table[A[i]i!,{i,1,NFN[10]}],Table[gC[i]i!,{i,1,8}]],Join[SN[9][[2]],{gC[8]->0,A[7]->0}],(10^(-6))]

SN[10]=RemoteEvaluate@annealFit[Join[res[NFN[10],HN[10],(10^(-10))][10],Table[A[i]i!,{i,1,NFN[10]}],Table[gC[i]i!,{i,1,8}]],SN[10][[2]],(10^(-7))]

test=((Φs[[;;3+1]]-#)(*/Φs[[;;ntest+1]]*))&@dΦdηList[NF[#],H[#]][3,1]//.rules[H[#]]/.S[#]&/@Range[2,7];

testN=((Φs[[;;3+1]]-#)(*/Φs[[;;ntest+1]]*))&@dΦdηList[NFN[#],HN[#]][3,1]//.rules[HN[#]]/.SN[#][[2]]&/@Range[2,5];

ListLogPlot[Evaluate[Abs[Transpose@testN]],Joined->True]

Φcomp=Flatten/@({#,Abs@((Φs[[;;4+1]]-#)(*/Φs[[;;ntest+1]]*))&@dΦdηList[NF[#],H[#]][4,1]//.rules[H[#]]/.S[#]}&/@Range[2,7])

Export["~/doc/research/first_order_singularities/paper/data/phi_comparison.dat",Φcomp];

pCov=Show[ListLogPlot[Thread[{Range[2,7],#}]&/@Abs@Re@Transpose[test],Joined->True,
AxesLabel->{"Order","((Subscript[Δℱ, 0])^((n)))"},PlotLegends->LineLegend[{0,1,2,3},LegendLabel->n]],
LogLogPlot[0.1(x^(-4)),{x,1,15},PlotStyle->Black]]

Export["/tmp/convergence.pdf",pCov];

Export["~/doc/research/first_order_singularities/paper/data/yl_comparison.dat",((n|->{#,n["Value"],n["Uncertainty"]})@(Abs@ruleθ0[H[#]]/.S[#]/.gC[0]->1))&/@Range[2,7]]

ListLogPlot[(Abs@ruleθ0[H[#]]/.S[#]/.gC[0]->1)&/@Range[2,7],PlotRange->{(10^(-6)),.1}]

ListPlot[Abs@(Re@ruleAH[H[#]]/.S[#]/.gC[0]->1)&/@Range[2,7]]

ListLogLogPlot[(n|->Table[{1/(2i+1),Abs@((SeriesCoefficient[H[n][θ],{θ,0,2i+1}])/(SeriesCoefficient[H[n][θ],{θ,0,2i-1}]))},{i,1,11}]/.S[n]/.gC[0]->1)/@Range[4,7],Joined->True]

ListLogLogPlot[Table[{1/(2i),Abs@((A[i])/(A[i-1]))},{i,1,11}]/.(S/@Range[4,7]),Joined->True]

Plot[Evaluate[H[#][θ ]/.gC[0]->1/.S[#]&/@Range[6,7]],{θ,0,1.4}]

Plot[Evaluate[ℱ[#][θ ]//.rules[H[#]]/.S[#]&/@Range[6,7]],{θ,0,1.4}]

ParametricPlot[Evaluate[{-t[θ]((H[#][θ ])^(-1/Δ[])),((H[#][θ])^(-2/Δ[]))(ℱ[#][θ ]-((t[θ])^2)((Log[((H[#][θ])^2)])/(8 π Δ[])))-(((t[θ]((H[#][θ ])^(-1/Δ[]))))^2)Log[(((t[θ]((H[#][θ ])^(-1/Δ[]))))^2)](1/(8π))}//.rules[H[#]]/.S[#]&/@Range[6,7]],{θ,0.00001,1.4},AspectRatio->1/GoldenRatio,PlotRange->{{-50,50},{-2.5,0.5}},PlotPoints->400]

ParametricPlot[Evaluate[{H[#][θ]((Abs[t[θ]])^(-Δ[])),((t[θ])^(-2))ℱ[#][θ ]-((Log[((t[θ])^2)])/(8 π ))}//.rules[H[#]]/.S[#]&/@Range[5,7]],{θ,1,3},AspectRatio->1/GoldenRatio]

ParametricPlot[Evaluate[{H[#][θ]((Abs[t[θ]])^(-Δ[])),((t[θ])^(-2))ℱ[#][θ ]-((Log[((t[θ])^2)])/(8 π ))}//.rules[H[#]]/.S[#]&/@Range[7,10]],{θ,-0.8,0.8},AspectRatio->1/GoldenRatio]

complexField=3;ComplexPlot[RFC[NF[9]][θ]//.rules[H[9]]/.S[9],{θ,-complexField-complexField/GoldenRatio  I,complexField+complexField/GoldenRatio I},PlotPoints->200,Exclusions->None,ColorFunction->{Automatic,"None"}]

ComplexPlot[Evaluate[RFC[0][θ]/.AH->0/.{B->1,θc->1,AL->1}],{θ,1-0.05-0.05I,1+0.05+0.05I},Exclusions->None,ColorFunction->{"Automatic",None},PlotPoints->100,WorkingPrecision->500]

complexField=0.2;ComplexPlot[RFC[NF[9]][θ]//.rules[H[9]]/.S[9],{θ,θc-complexField-complexField/GoldenRatio  I,θc+complexField+complexField/GoldenRatio I}/.S[9],PlotPoints->100,Exclusions->None,ColorFunction->{Automatic,"None"},WorkingPrecision->200]

Plot[Evaluate[Arg@RFC[0][θ+I (10^(-7))]/.AH->0/.{B->1,θc->1,AL->1}],{θ,0.9,1.1},WorkingPrecision->200,PlotPoints->50]

Stored fits

H[2]=h[1];
NF[2]=2;
ℱ[2]=RF[2];
S[2]={θc->1.2218190668446298`,θ0->0.19815153122601004`,AH->-2.393380156636518`,A[1]->1.5218210670773562`,A[2]->0.4558675458279417`,gC[1]->-0.014069600756944788`};

H[3]=h[2];
NF[3]=2;
ℱ[3]=RF[2];
S[3]={θc->1.3312829236892874`,θ0->0.1990484241151759`,AH->-2.2569953198152035`,A[1]->1.3076667198757734`,A[2]->0.39615702441258427`,gC[1]->-0.014413476770888844`,gC[2]->-0.00023301374253497338`};

H[4]=h[3];
NF[4]=3;
ℱ[4]=RF[3];
S[4]={θc->1.3310596746630394`,θ0->0.19891824286627846`,AH->-2.361502215519321`,A[1]->1.460584099622719`,A[2]->0.3071976169866144`,gC[1]->-0.026882257199972816`,gC[2]->0.033212060175714056`,gC[3]->-0.004370268382751191`,A[3]->0.03233338210075686`};

H[5]=h[4];
NF[5]=3;
ℱ[5]=RF[3];
S[5]={θc->1.4174499095572046`,θ0->0.19623837275274397`,AH->-2.3844047782650346`,A[1]->1.4945044321287986`,A[2]->0.4827425954641644`,gC[1]->-0.22253679627867537`,gC[2]->-0.03607696344672339`,gC[3]->0.006550889829736402`,A[3]->-0.09566783498205164`,gC[4]->-0.0006927978972384512`};

H[6]=h[5];
NF[6]=4;
ℱ[6]=RF[4];
S[6]={θc->1.3693245643432388`,θ0->0.19714303679801537`,AH->-2.4337573590963326`,A[1]->1.559970006062279`,A[2]->0.4606135324822247`,gC[1]->-0.20059393001573939`,gC[2]->-0.02621063711050144`,gC[3]->-0.01488474127424088`,A[3]->-0.054064411318565486`,gC[4]->0.004613876176117714`,A[4]->-0.014420057543619254`,gC[5]->-0.000570797961625302`};

H[7]=h[6];
NF[7]=4;
ℱ[7]=RF[4];
S[7]={θc->1.3414183177738805`,θ0->0.19689919009832824`,AH->-2.4797396545378896`,A[1]->1.6274015230688736`,A[2]->0.5212082982033303`,gC[1]->-0.23880901356745154`,gC[2]->-0.028717858615113008`,gC[3]->0.0003968707731909203`,A[3]->-0.11829440269500721`,gC[4]->0.0022181153155482465`,A[4]->0.0014665587532066901`,gC[5]->-0.0005511982630786123`,gC[6]->0.00003213793548002806`};