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]]

Matching all

Matching all (Subscript[θ, c]) fixed

Match ends

nAs=2;

s0=#1->Re[#2]&@@@untilSuccess[newSol[randomEval[eqAround[nAs,h[0]][1,-1,2]],{θc->1+RandomReal[],θ0->0.2},{AH,A[1],A[2]},.1]]

Timing[dFdξLowList[nAs,h[0]][6]/(Range[0,6]!)//.rules[h[0]]/.s0]

ListLogPlot[{
Abs[Gls],
Chop[Abs[dFdξLowList[nAs,h[0]][6]]//.rules[h[0]]/.s0]
}]

ListLogPlot[{
Abs[Ghs],
Chop[Abs@dFdξHighList[nAs,h[0]][6]//.rules[h[0]]/.s0]
}]

42492.10772459181`

m0=annealFit[res[2,h[0],d][2]//.rules[h[0]],d,s0,(10^(-5)),(10^(-13)),10,1,2]

s0[[All,1]]

m01=FindRoot[Evaluate[D[Total[((res[2,h[0],(10^(-15))][2])^2)]//.rules[h[0]],{s0[[All,1]]}]],Evaluate[m0[[2]]/.Rule->List],WorkingPrecision->20,MaxIterations->5000]

Total[((res[2,h[0],(10^(-15))][2])^2)]//.rules[h[0]]/.m01

m1=annealFit[res[2,h[1],δ][3]//.rules[h[1]],δ,Append[m0[[2]],gC[1]->0]]

m11=FindRoot[Evaluate[D[Total[((res[2,h[1],(10^(-15))][3])^2)]//.rules[h[1]],{m1[[2,All,1]]}]],Evaluate[m1[[2]]/.Rule->List],WorkingPrecision->20,MaxIterations->5000]

Total[((res[2,h[1],(10^(-15))][3])^2)]//.rules[h[1]]/.m11

m2=annealFit[res[2,h[3],δ][4]//.rules[h[3]],δ,Join[m1[[2]],{gC[2]->0,gC[3]->0}]]

m21=FindRoot[Evaluate[D[Total[((res[2,h[3],(10^(-15))][4])^2)]//.rules[h[3]],{m2[[2,All,1]]}]],Evaluate[m2[[2]]/.Rule->List],WorkingPrecision->20,MaxIterations->5000]

Total[((res[2,h[3],(10^(-15))][4])^2)]//.rules[h[3]]/.m21

m3=annealFit[res[2,h[3],δ][5]//.rules[h[3]],δ,Join[m2[[2]],{}]]

m31=FindRoot[Evaluate[D[Total[((res[2,h[3],(10^(-15))][5])^2)]//.rules[h[3]],{m3[[2,All,1]]}]],Evaluate[m3[[2]]/.Rule->List],WorkingPrecision->20,MaxIterations->5000]

Total[((res[2,h[4],(10^(-15))][5])^2)]//.rules[h[4]]/.m31

m4=annealFit[res[2,h[5],δ][6]//.rules[h[5]],δ,Join[m3[[2]],{gC[4]->0,gC[5]->0}]]

m41=FindRoot[Evaluate[D[Total[((res[2,h[5],(10^(-15))][6])^2)]//.rules[h[5]],{m4[[2,All,1]]}]],Evaluate[m4[[2]]/.Rule->List],WorkingPrecision->20,MaxIterations->5000]

Total[((res[2,h[5],(10^(-15))][6])^2)]//.rules[h[5]]/.m41

m5=annealFit[res[2,h[7],δ][7]//.rules[h[7]],δ,Join[m4[[2]],{gC[6]->0,gC[7]->0}]]

res[2,h[6],(10^(-15))][7]//Length

m5[[2]]//Length

m51=FindRoot[Evaluate[D[Total[((res[2,h[7],(10^(-15))][7])^2)]//.rules[h[7]],{m5[[2,All,1]]}]],Evaluate[m5[[2]]/.Rule->List],WorkingPrecision->20,MaxIterations->5000]

Total[((res[2,h[7],(10^(-15))][7])^2)]//.rules[h[7]]/.m51

m6=annealFit[res[2,h[9],δ][8]//.rules[h[9]],δ,Join[m5[[2]],{gC[8]->0,gC[9]->0}]]

m61=FindRoot[Evaluate[D[Total[((res[2,h[9],(10^(-15))][8])^2)]//.rules[h[9]],{m6[[2,All,1]]}]],Evaluate[m6[[2]]/.Rule->List],WorkingPrecision->20,MaxIterations->5000]

Total[((res[2,h[9],(10^(-15))][8])^2)]//.rules[h[9]]/.m61

m7=annealFit[res[2,h[9],δ][9]//.rules[h[9]],δ,Join[m6[[2]],{}]]

ListPlot[
If[Head[#]===Around,#/#["Uncertainty"],Around[#/(10^(-15)),1]]&/@(Abs[Ghs[[;;7+1]]-dFdξHighList[nAs,h[5]][7]]//.rules[h[5]]/.m41)
]

ListPlot[
If[Head[#]===Around,#/#["Uncertainty"],Around[#/(10^(-13)),1]]&/@(Abs[Gls[[;;4+1]]-dFdξLowList[nAs,h[3]][4]]//.rules[h[3]]/.m21)
]

((res[2,h[5],δ][7])^2)//.rules[h[5]]/.m41/.δ->(10^(-13))

m6[[2]]

m61=levenburgMarquardt[res[2,h[9],(10^(-9))][8]//.rules[h[9]],Join[m6[[2]],{}]]

ntest=3;n1=2;
ourΦ1=dFdηList[n1,h[0]][ntest][1]/Range[0,ntest]!//.rules[h[0]]/.m01;
ourΦ2=dFdηList[n1,h[1]][ntest][1]/Range[0,ntest]!//.rules[h[1]]/.m11;
ourΦ3=dFdηList[n1,h[3]][ntest][1]/Range[0,ntest]!//.rules[h[3]]/.m21;
ourΦ4=dFdηList[n1,h[3]][ntest][1]/Range[0,ntest]!//.rules[h[3]]/.m31;
ourΦ5=dFdηList[n1,h[5]][ntest][1]/Range[0,ntest]!//.rules[h[5]]/.m41;
ourΦ6=dFdηList[n1,h[7]][ntest][1]/Range[0,ntest]!//.rules[h[7]]/.m51;
ourΦ7=dFdηList[n1,h[9]][ntest][1]/Range[0,ntest]!//.rules[h[9]]/.m61;
test=((Φs[[;;ntest+1]]-#)(*/Φs[[;;ntest+1]]*))&/@{ourΦ1,ourΦ2,ourΦ3,ourΦ4,ourΦ5,ourΦ6,ourΦ7};

ListLogPlot[Abs@Re@Transpose[test],Joined->True]