(* SumRPMSbALEPHM2m090.m:  with (double) pinched ('P') Borel-Laplace sum rules *)
(* and alpha_s(mtau^2; MSbar) is adjustable (as input, or as result fo global fit) *)
(*-------------------------------------------------*)
(* Borel-Laplace fitted in |M^2|-intervals: (M2min,1.5); M2min=0.65 or 0.90; *)
(* here: M2min=0.90, i.e., YYY=090 *)
(* in pQCD, MSbar scheme *)

(* This prg. calculates BT sum rule, when in Adler function MSbar pQCD coupling *)
(* aMSpert is used, for ALEPH data; either Adler is TPS *)
(* (truncated series in power of aMSpert, up to aMSpert^5 or higher order, *)
 (* either CIPT, or FOPT, or PV Borel-resumation, or renormalon-motivated sum *)
(*-------------------------------------------------*)
 <</home/gorazd/3danQCD.dir/AdlerFunction4lMiniMOM.m;
<</home/gorazd/3danQCD.dir/MSbarRenMod5A.save;
BtDUV1[u_, tkapp_] := Exp[Log[tkapp]*u]*Pi*(tdUVp12/(1 + u)^2);
BtDIR3[u_, tkapp_] := 
  Exp[Log[tkapp]*u]*Pi*(tdIRp32/(3 - u)^2 + tdIRp31/(3 - u));
BtDIR2[u_, tkapp_] := 
  Exp[Log[tkapp]*u]*Pi*(tdIRp2*(1/(2 - u) + talf*-1*Log[1 - u/2]));
(* BtDUV1[u,tkap]+BtDIR3[u,tkap]+BtDIR2[u,tkap]=BtDgen[u,tkap] *)
tddtkUV1[nn_, tkapp_] := Coefficient[Series[BtDUV1[u, tkapp], {u, 0, 30}], u^nn] nn! be0^nn;
tddtkUV1[0, tkapp_] := BtDUV1[0, tkapp];
tddtkIR3[nn_, tkapp_] := Coefficient[Series[BtDIR3[u, tkapp], {u, 0, 30}], u^nn] nn! be0^nn;
tddtkIR3[0, tkapp_] := BtDIR3[0, tkapp];
tddtkIR2[nn_, tkapp_] := Coefficient[Series[BtDIR2[u, tkapp], {u, 0, 30}], u^nn] nn! be0^nn;
tddtkIR2[0, tkapp_] := BtDIR2[0, tkapp];
(* tddtkUV1[n, tkap] + tddtkIR3[n, tkap] + tddtkIR2[n, tkap] = tddtk[n,tkap]  +{tilde d}_n(kappa=tkap Exp[-tKK]) *)
(* Check for the onset of the UV1-renormalon dominance in {tilde d}_n, for kappa=1: kappa=1; tkap = kappa Exp[tKK]; tabtddUV1vstdd=Table[{nn, tddtkUV1[nn, tkap]/tddtk[nn, tkap]}, {nn, 1, 15}]={{1, 0.0751416}, {2, -0.227154}, {3, 0.257563}, {4, -1.97777}, {5, 0.573134}, {6, 1.55361}, {7, 0.856263}, {8, 1.08529}, {9, 0.964573}, {10, 1.01747}, {11, 0.992026}, {12, 1.00378}, {13, 0.99823}, {14, 1.00084}, {15, 0.999605}}; in a way UV1 dominates starting at nn=5-6 upwards *)
(* Do[ddtkUV1[n - 1, tkap] = Expand[Sum[kk[n - s, s] tddtkUV1[n - 1 - s, tkap], {s, 0, n - 2}]], {n, 2, 31}];  Do[ddtkIR2[n - 1, tkap] = Expand[Sum[kk[n - s, s] tddtkIR2[n - 1 - s, tkap], {s, 0, n - 2}]], {n, 2, 31}]; Do[ddtkIR3[n - 1, tkap] = Expand[Sum[kk[n - s, s] tddtkIR3[n - 1 - s, tkap], {s, 0, n - 2}]], {n, 2, 31}]; tabddUV1vsdd = Table[{nn, ddtkUV1[nn, tkap]/ddtk[nn, tkap]}, {nn, 1, 15}]={{1, 0.0751416}, {2, -0.0888303}, {3, 0.0786098}, {4, -0.100583}, {5, 0.0988345}, {6, -0.170178}, {7, 0.170568}, {8, -0.445023}, {9, 0.325567}, {10, -3.6304}, {11, 0.56694}, {12, 1.81027}, {13, 0.795075}, {14, 1.17141}, {15, 0.924117}} *)
(* All this indicates that {tilde d}_n of Adler d(Q^2)_{D=0} are clearly dominated by UV1 part starting already at n=5-7; while d_n are dominated by UV1 part starting at HIGHER n (n =11-13); this indicates that FOPT evaluations of FESRs and Borel-Laplace are probably even better behaved when using {tilde a}_n(kappa sigmax) [insetad of powers of a(kappa sigmax)], as the UV1 renormalon of {tilde d}_{D=0} is cancelled in the Borel of {tilde d}_{D=0}, i.e., using {tilde FOPT}  *)


 aMSp[Q2f_, fif_, alsinf_] := Module[{Q2ff = Q2f, fiff = fif, alsinff = alsinf}, Clear[alsin] ; alsin = alsinff; <</home/gorazd/3danQCD.dir/aMSQ2complS_almtauinput.m; aMSpert[Q2ff, fiff]];
(* aMSp[0.8, 0.4, 0.320] is then a(Q^2=0.8 Exp[I 0.4]; MSbar) with initial condition alpha_s(mtau^2;MSbar)=0.320  (all with nf=3) *)

(* The other way: when we want to fix alpha_s(mtau^2;MSbar)=alsin to a value fixed value, say 0.320: alsin=0.320; <</home/gorazd/3danQCD.dir/aMSQ2complS_almtauinput.m; Then MSpert[Q2,phi]=a(Q^2=Q2 Exp[I phi]; MSbar; nf=3) such that Pi a(mtau^2;MSbar)=0.320 *)


mtauphys=1.77686;  (*= 1.77686+-0.00012 *)
mtau=mtauphys;

(* <</home/gorazd/3danQCD.dir/aMSpertComplexnf3al01179.save; *)
M2min=0.90; (* --> YYY=090 *)  (* M2min=0.65; M2min=1.00; *)
 (* M2min is |M^2|_{min} (in GeV^2) which we will use in the fit procedures; *)
 (* 0.65 =< M2min < 1.5; note that |M^2|_{max}=1.5 always, in our approach *)
(* Note: for wolrd average value alpha_s(MZ^2)=0.1179+-0.0010 -> *)
(* alpha_s(mtau^2)=0.31363+0.00801-0.00772 =appr 0.314 +-0.008 *)
 (* ALEPH: *)
 (* sigmax=2.80 (GeV^2) *)
 sigmax=2.80; 

(* Save["O4O6O8fitMinALEPH090.save", {M2min,sigmax}];  *)
(*--------------------------------__*)
(* ALEPH experimental data: *)
<</home/gorazd/3danQCD.dir/expdataALEPH.m;
(* NNAL=77 will be now, and not NNAL=79 bins *)
NNAL=77;
sigmax=2.80;
ddel=fPi^2 mPi^2;
fPi = 0.13050;
mPi = 0.13957;
(* gives: OmegaVplA[ii],sbin[[ii]  and dsbin[[ii] (ii=1,...,77) *)
(*--------------------------------------------*)
 (* Now for FOPT: *)

nqu=3; be0=(11 -2 nqu/3)/4; 
be1=(102-38 nqu/3)/16; ce1=be1/be0;
bett2MS=(2857/2 - 5033 nqu/18 + 325 nqu^2/54)/64;
bett3MS=(1/4^4)( (149753/6) + 3564 Zeta[3] - nqu ( (1078361/162) + (6508/27) Zeta[3] )  + nqu^2 ( (50065/162) + (6472/81) Zeta[3] )  + nqu^3 (1093/729) );
bett4MS[Nff_]:=(1/4^5) ( (8157455/16) + (621885/2) Zeta[3] - (88209/2) Zeta[4] - 288090 Zeta[5] + Nff ( -(336460813/1944) - (4811164/81) Zeta[3] + (33935/6) Zeta[4] + (1358995/27) Zeta[5] ) + Nff^2 ( (25960913/1944) + (698531/81) Zeta[3] - (10526/9) Zeta[4] - (381760/81) Zeta[5] ) + Nff^3 (-(630559/5832) - (48722/243) Zeta[3] + (1618/27) Zeta[4] + (460/9) Zeta[5] ) + Nff^4 ( (1205/2916) - (152/81) Zeta[3] ) );
 ce2MS=bett2MS/be0;
ce3MS=bett3MS/be0;
ce4MS=bett4MS[nqu]/be0;

betaMSbar[x_]:=-be0 x^2 - be1 x^3 - bett2MS x^4 - bett3MS x^5 - bett4MS[3.] x^6;
bta[x_]:=betaMSbar[x];
(* Note: x =a(mu^2) = alpha_s(mu^2)/Pi *)
(* x=Log[Q2/sigmax];  *) delext=5.; Clear[x];
solQ2pos[aALf_]:= NDSolve[{y'[x]==bta[y[x]], y[0]==aALf}, y, {x,-1.,+1.}];
(* ' *)
  aMSext[xx_,aAL0f_]:=First[y[Log[xx]]/.solQ2pos[aAL0f]];
  (* aMSext[x,aAL0]=a(Q^2=x Q20), where Q2=x*Q20 and a(Q^2=Q20) = aAL0 *)

(* ff[2,x]=bta[x]; ff[3,x]=bta[x] bta'[x]; etc. ' *)
ff[nn_, xx_] := 
  Module[{ffp, nnp, xxp}, ffp[2, xxp_] := bta[xxp]; 
   ffp[nnp_, xxp_] := 
    ffp[nnp, xxp] = bta[xxp] D[ffp[nnp - 1, xxp], xxp]; ffp[nn, xx]];

(* ta[1,x_]:=x; ta[2,x]=((-1)/be0 1!) bta[x];  ta[3,x]=((-1)^2/be0^2 2!) bta[x] bta'[x]; ' *)
taprov[nn_,x_]:=((-1)^(nn-1)/(be0^(nn-1) (nn-1)!)) ff[nn,x];  (* nn=2,3,4, *)
taprov[1,x_]:=x;
ta[nn_,x_,Nn_]:=Normal[Series[Expand[taprov[nn,x]], {x, 0, Nn}]];
(* i.e., we will expand ta_n only up to powers of a^Nn (not higher), because we will not need higher in practice, and we save time now *)
ta[1,x_,Nn_]:=x;
(*----------------------------------------------*)
<</home/gorazd/3danQCD.dir/DiegoT.dir/SumRthMSbar.save;
  (* This gives coeffext coefficients:  coeffext[jj,nn] is the coefficient of a^nn in ta[jj]={tilde a}_{jj} (nn <= 16) *)
  (*-----------------------------------_*)  
  (* (Double-)Pinched ('P') Borel-Laplace in FO approach (PFO): *)

  kappa=1;  (* kappa = mu^2/Q^2, where mu^2 is RScl *)
  tkap=kappa Exp[tKK];
  
(* Now (double) pinched ('P') Re[BPFOfast]: *)
cKP[kp_,M2p_]:=(1/(2 Pi)) (-I)^kp NIntegrate[ th^kp ( ( (1 + Exp[I th])^2 - 2 (M2p/sigmax) (1 + Exp[I th]) + 2  (M2p/sigmax)^2 ) Exp[(sigmax/M2p) Exp[I th]] - 2 (M2p/sigmax)^2 Exp[-(sigmax/M2p)] ),{th, -Pi,Pi}];
  coeffBPFO[M2f_,Nn_]:=Sum[tddtk[nn,tkap] Binomial[nn + kk, kk] be0^kk coeffext[nn + kk + 1, Nn] cKP[kk,M2f], {nn, 0, Nn - 1}, {kk, 0, Nn - 1 - nn}]; 
 (* coeffBPFO[M2,Nn] is the coefficient at x^Nn in the expansion of BPFOexpD0[x,M2,Nn] or of any BPFOexpD0[x,M2,MM,M2] with MM >= Nn *)
 BPFOD0fast[M2_,Nn_,aALf_]:=Sum[coeffBPFO[M2,nn] x^nn,{nn,1,Nn}]/.{x->aALf};
(* aALf=alpha_s(kappa*sigmax)/Pi *)
  (* And now for tFO, i.e., in {tilde a}_nn(kappa sigmax)=taprov[nn,aALf]: *)
  coeffBPtFO[M2f_,nn_]:=Sum[tddtk[nn-kk,tkap] be0^kk cKP[kk,M2f]  Binomial[nn,kk],{kk,0,nn}];
BPtFOD0[M2_,Nn_,aALf_]:=Sum[coeffBPtFO[M2,nn-1] taprov[nn,x],{nn,1,Nn}]/.{x->aALf};  (* This is double-pinched D=0 part of the Borel-Laplace in the tFO ({tilde FOPT}) approach, truncated at {tilde a}_{Nn}(kappa sigmax) *)
(* aALf=alpha_s(kappa*sigmax)/Pi *)
  
(* experimental values of double-pinched Borel-Laplace: *)  
BPexpBinAL[M2_]:=(1/M2) (Sum[ (1 - sbin[[ii]]/sigmax)^2 Exp[-sbin[[ii]]/M2]*OmegaVplA[ii]*dsbin[[ii]],{ii,1,NNAL}] + 2 Pi^2 fPi^2  (1 - mPi^2/sigmax)^2 Exp[-mPi^2/M2]);
ReBPexpBinAL[M2_]:=Re[(1/M2) ( Sum[ (1 - sbin[[ii]]/sigmax)^2 Exp[-sbin[[ii]]/M2]*OmegaVplA[ii]*dsbin[[ii]],{ii,1,NNAL}] + 2 Pi^2 fPi^2 (1 - mPi^2/sigmax)^2 Exp[-mPi^2/M2])];
delReBPexpBinAL[M2_]:=(2 Pi^2) Sqrt[Sum[Re[(1 - sbin[[ii]]/sigmax)^2 Exp[-sbin[[ii]]/M2]/M2] Re[(1 - sbin[[jj]]/sigmax)^2 Exp[-sbin[[jj]]/M2]/M2] dsbin[[ii]] dsbin[[jj]] (  covVV[ii,jj]+covAA[ii,jj]+covVA[ii,jj]+ covAV[ii,jj]),{ii,1,NNAL},{jj,1,NNAL}]];
(* end of experimental values *)

ReBPFOfast[M2f_,Nn_,aALf_,O4_,O6_,O8_]:=Re[((1- 2 M2f/sigmax) + 2 (M2f/sigmax)^2 (1 - Exp[-sigmax/M2f]))+BPFOD0fast[M2f,Nn,aALf]+ 2 Pi^2 ( (1/(M2f sigmax))(2 O4 + O6/sigmax) + (1/M2f^2) (O4 + 2 (O6/sigmax) + (O8/sigmax^2)) + (1/M2f^3) (1/2)(O6 + 2 O8/sigmax) + (1/M2f^4) (1/6) O8 )];  (* This is the FOPT approach when the order of truncation is a^Nn; with a=a(sigmax); the higher order coefficients are those of the renormalon-motivated model in MSbar; the higher-twist terms are as determied by double-pinched Borel-Laplace  *) 

ReBPtFO[M2f_,Nn_,aALf_,O4_,O6_,O8_]:=Re[((1- 2 M2f/sigmax) + 2 (M2f/sigmax)^2 (1 - Exp[-sigmax/M2f]))+BPtFOD0[M2f,Nn,aALf]+ 2 Pi^2 ( (1/(M2f sigmax))(2 O4 + O6/sigmax) + (1/M2f^2) (O4 + 2 (O6/sigmax) + (O8/sigmax^2)) + (1/M2f^3) (1/2)(O6 + 2 O8/sigmax) + (1/M2f^4) (1/6) O8 )];  (* This is the FOPT approach when the order of truncation is a^Nn; with a=a(sigmax); the higher order coefficients are those of the renormalon-motivated model in MSbar; the higher-twist terms are as determied by double-pinched Borel-Laplace  *)

(* Now search for condensate values with this Borel-Laplace (double) pinched ('P') approach, with FO method for D=0 part: *)
NchP=10; (* number of intervals in: (M2min < |M^2} < 1.5) *)
M2FP[ii_]:=M2min+ii*(1.5-M2min)/NchP; (* ii=0,1,2,...,NchP *)
(* We will use sum of squares minimization in this interval, for M^2=|M^2| Exp[I Psi] with Psi=0, Pi/6, Pi/4 one after another in the sum (it turns out that it is not good to include Psi=Pi/3, this value appears to be too large, and xi^2 become large): *)


Clear[aAlf];
O4init=0.001; O6init=-0.001; O8init=0.; aALfinit=0.100;
(* FO approach: *)
alO4O6O8fitPFOMinN[Nn_]:= FindMinimum[Sum[(ReBPFOfast[M2FP[jj] Exp[I Pi/6], Nn, aALf,O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/6]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/6]]^2, {jj, 0, NchP}]+Sum[(ReBPFOfast[M2FP[jj] Exp[I Pi/4], Nn, aALf, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/4]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/4]]^2, {jj, 0, NchP}]+Sum[(ReBPFOfast[M2FP[jj], Nn, aALf, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj]])^2/delReBPexpBinAL[M2FP[jj]]^2, {jj, 0, NchP}], {{aALf,aALfinit},{O4fitf, O4init},{O6fitf, O6init},{O8fitf, O8init}}];
(* aALf=alpha_s(kappa*sigmax)/Pi *)
(* tFO ({tilde FOPT}) approach: *)
alO4O6O8fitPtFOMinN[Nn_]:= FindMinimum[Sum[(ReBPtFO[M2FP[jj] Exp[I Pi/6], Nn, aALf,O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/6]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/6]]^2, {jj, 0, NchP}]+Sum[(ReBPtFO[M2FP[jj] Exp[I Pi/4], Nn, aALf, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/4]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/4]]^2, {jj, 0, NchP}]+Sum[(ReBPtFO[M2FP[jj], Nn, aALf, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj]])^2/delReBPexpBinAL[M2FP[jj]]^2, {jj, 0, NchP}], {{aALf,aALfinit},{O4fitf, O4init},{O6fitf, O6init},{O8fitf, O8init}}];
(* aALf=alpha_s(kappa*sigmax)/Pi *)

(* Do[alO4O6O8fitPFOMinnum[nn]=alO4O6O8fitPFOMinN[nn], {nn, 3, 15}]; *)
(* Do[alO4O6O8fitPtFOMinnum[nn]=alO4O6O8fitPtFOMinN[nn], {nn, 3, 15}]; *)			     
(* Save["alO4O6O8fitMinALEPH090.save", {M2min,sigmax}];  *)
(* Save["O4O6fitMinALEPH1179090.save", {M2min, NchP, alO4O6O8fitPFOMinnum}]; *)

(* FO global, NchP=10; M2min=0.9, (and kappa=1) aALf VARIED (and O8=0): *)
(*
 alO4O6O8fitPFOMinnum[3]={0.0007474545761431042, {aALf -> 0.10942844911060866`, O4fitf -> 0.0011570988154334335`, O6fitf -> -0.00014623829696587437`, O8fitf -> 0.0000743528157350349`}};
alO4O6O8fitPFOMinnum[4]={0.0000875341741119025, {aALf -> 0.10495580507191908, O4fitf -> 0.00030769417544819136, O6fitf -> 0.00048351517106770564, O8fitf -> -0.0001963640042762657}};
 (* ->  aALfFO[4]=aALf/.alO4O6O8fitPFOMinnum[4][[2]]; alsmtauFO[4]=aMSext[mtauphys^2/(kappa sigmax),aALfFO[4]] Pi is the corresponding alpha_s(mtau^2;MSbar) value; O4FO[4]=O4fitf/.alO4O6O8fitPFOMinnum[4][[2]]; O6FO[4]=O6fitf/.alO4O6O8fitPFOMinnum[4][[2]]; O8FO[4]=O8fitf/.alO4O6O8fitPFOMinnum[4][[2]]; *)
alO4O6O8fitPFOMinnum[5]={0.0012144946129046532, {aALf -> 0.10330930282446786, O4fitf -> -0.0005056414816044826, O6fitf -> 0.001016406010934591, O8fitf -> -0.00041132657253014563}};
alO4O6O8fitPFOMinnum[6]={0.0025380678699832016`, {aALf -> 0.10246908050001834`, O4fitf -> -0.0012690216464647855`, O6fitf -> 0.001440367680457593`, O8fitf -> -0.0005682777810446469`}};
 alO4O6O8fitPFOMinnum[7]={0.003543879357931492, {aALf -> 0.10183893230226336, O4fitf -> -0.0020096474457054862, O6fitf -> 0.0017784139443780215, O8fitf -> -0.0006814397356611508}};
alO4O6O8fitPFOMinnum[8]={0.004287816184596373`, {aALf -> 0.10122255774076128`, O4fitf -> -0.0027756129809026844`, O6fitf -> 0.002062451844738742`,  O8fitf -> -0.0007675526757783264`}};
alO4O6O8fitPFOMinnum[9]={0.0050836140363828336`, {aALf -> 0.10064609554624415`, O4fitf -> -0.0036671505836988806`, O6fitf -> 0.0023432586173957074`, O8fitf -> -0.0008487038698841716`}};
alO4O6O8fitPFOMinnum[10]={0.006086038046420737, {aALf -> 0.10014273316812684, O4fitf -> -0.004814401655486666, O6fitf -> 0.0026585334205051704, O8fitf -> -0.0009377997907807637}};
alO4O6O8fitPFOMinnum[11]={0.007611313481031427`, {aALf -> 0.09987723810182139`, O4fitf -> -0.006509255192194031`, O6fitf -> 0.0030791433479292734`, O8fitf -> -0.0010562078159779427`}};
alO4O6O8fitPFOMinnum[12]={0.009013496774097332`, {aALf -> 0.09972068883303456`, O4fitf -> -0.009031863664674365`, O6fitf -> 0.003580370203786567`, O8fitf -> -0.0011831051363982196`}};
alO4O6O8fitPFOMinnum[13]={0.011136484494888953`, {aALf -> 0.09998531390666428`, O4fitf -> -0.013532837977787648`, O6fitf -> 0.004334278236671556`, O8fitf -> -0.0013637306489187903`}};
alO4O6O8fitPFOMinnum[14]={0.009525246277054828`, {aALf -> 0.09954422855295118`, O4fitf -> -0.019350458723569466`, O6fitf -> 0.00480204134917539`, O8fitf -> -0.001402811457135451`}};
alO4O6O8fitPFOMinnum[15]={0.01688351758321297`, {aALf -> 0.10116293546095716`, O4fitf -> -0.03836052780851794`, O6fitf -> 0.006908203472701846`, O8fitf -> -0.0018584584747883147`}};
 Clear[Nn]; Do[Module[{}, xi2FO[Nn]=alO4O6O8fitPFOMinnum[Nn][[1]]; aALfFO[Nn]=aALf/.alO4O6O8fitPFOMinnum[Nn][[2]]; alsmtauFO[Nn]=aMSext[mtauphys^2/(kappa sigmax),aALfFO[Nn]] Pi;  O4FO[Nn]=O4fitf/.alO4O6O8fitPFOMinnum[Nn][[2]]; O6FO[Nn]=O6fitf/.alO4O6O8fitPFOMinnum[Nn][[2]]; O8FO[Nn]=O8fitf/.alO4O6O8fitPFOMinnum[Nn][[2]]],{Nn,3,15}];
 *)
(*-----------------_*)
(* Now global tFO, NchP=10; M2min=0.9, (and kappa=1) aALf VARIED (and O8-0): *)
(*
 alO4O6O8fitPtFOMinnum[3]={0.0000118162, {aALf -> 0.103161251, O4fitf -> 0.000717381, O6fitf -> 0.000209857, O8fitf -> -0.0000858027}};
alO4O6O8fitPtFOMinnum[4]={0.00269896, {aALf -> 0.101784567, O4fitf -> -0.000741425, O6fitf -> 0.0012442, O8fitf -> -0.000519178}}; 
alO4O6O8fitPtFOMinnum[5]={0.00627679, {aALf -> 0.102449417, O4fitf -> -0.00231109, O6fitf -> 0.00210775, O8fitf -> -0.000830984}};
alO4O6O8fitPtFOMinnum[6]={0.00411835, {aALf -> 0.101191432, O4fitf -> -0.00323869, O6fitf -> 0.00228238, O8fitf -> -0.000827757}}; 
alO4O6O8fitPtFOMinnum[7]={0.0041745, {aALf -> 0.0993438809, O4fitf -> -0.00414978, O6fitf -> 0.00241138, O8fitf -> -0.000836931}};
alO4O6O8fitPtFOMinnum[8]={0.00800403, {aALf -> 0.0982638871, O4fitf -> -0.00606465, O6fitf -> 0.0029864, O8fitf -> -0.00103157}};
alO4O6O8fitPtFOMinnum[9]={0.0495335, {aALf -> 0.102516428, O4fitf -> -0.0178047, O6fitf -> 0.00683276, O8fitf -> -0.00230941}};
alO4O6O8fitPtFOMinnum[10]={0.00229079, {aALf -> 0.0970241284, O4fitf -> -0.0147449, O6fitf -> 0.00409961, O8fitf -> -0.00114169}}; 
alO4O6O8fitPtFOMinnum[11]={19.8045, {aALf -> 0.088811167, O4fitf -> -0.00323425, O6fitf -> -0.00416711, O8fitf -> 0.00394253}};
alO4O6O8fitPtFOMinnum[12]={0.00777154, {aALf -> 0.0869554244, O4fitf -> -0.00791593, O6fitf -> 0.000485939, O8fitf -> 0.000160095}};
 Clear[Nn]; Do[Module[{}, xi2tFO[Nn]=alO4O6O8fitPtFOMinnum[Nn][[1]]; aALftFO[Nn]=aALf/.alO4O6O8fitPtFOMinnum[Nn][[2]]; alsmtautFO[Nn]=aMSext[mtauphys^2/(kappa sigmax),aALftFO[Nn]] Pi;  O4tFO[Nn]=O4fitf/.alO4O6O8fitPtFOMinnum[Nn][[2]]; O6tFO[Nn]=O6fitf/.alO4O6O8fitPtFOMinnum[Nn][[2]]; O8tFO[Nn]=O8fitf/.alO4O6O8fitPtFOMinnum[Nn][[2]]],{Nn,3,12}];
 *) 
(*-----------------_*) 
 (* Now with FO with FIXED aALf=0.104857 (=alpha_s(sigmax) extracted from a^{(2,5)}_{FO}^{Nt=6} - a^{(2,5)}_exp, see below; corresponding to alpha_s(mtau^2)=0.318064) ('af') *)
Clear[aAlf];
O4init=0.001; O6init=-0.001; O8init=0.; 
aAL=0.104857;
O4O6O8fitPFOMinN[Nn_]:= FindMinimum[Sum[(ReBPFOfast[M2FP[jj] Exp[I Pi/6], Nn, aAL, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/6]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/6]]^2, {jj, 0, NchP}]+Sum[(ReBPFOfast[M2FP[jj] Exp[I Pi/4], Nn, aAL, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/4]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/4]]^2, {jj, 0, NchP}]+Sum[(ReBPFOfast[M2FP[jj], Nn, aAL, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj]])^2/delReBPexpBinAL[M2FP[jj]]^2, {jj, 0, NchP}], {{O4fitf, O4init},{O6fitf, O6init},{O8fitf, O8init}}];

(* Now with tFO with FIXED aALf=0.106553 (=alpha_s(sigmax) extracted from a^{(2,5)}_{FO}^{Nt=5} - a^{(2,5)}_exp, see below; corresponding to alpha_s(mtau^2)=0.322977 ('af') *)
Clear[aAlf];
O4init=0.001; O6init=-0.001; O8init=0.; 
aAL=0.106553;
O4O6O8fitPtFOMinN[Nn_]:= FindMinimum[Sum[(ReBPtFO[M2FP[jj] Exp[I Pi/6], Nn, aAL, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/6]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/6]]^2, {jj, 0, NchP}]+Sum[(ReBPtFO[M2FP[jj] Exp[I Pi/4], Nn, aAL, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/4]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/4]]^2, {jj, 0, NchP}]+Sum[(ReBPtFO[M2FP[jj], Nn, aAL, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj]])^2/delReBPexpBinAL[M2FP[jj]]^2, {jj, 0, NchP}], {{O4fitf, O4init},{O6fitf, O6init},{O8fitf, O8init}}];

 
 (* Do[O4O6O8fitPFOMinnum[nn]=O4O6O8fitPFOMinN[nn], {nn, 3, 15}]; *)
(* NchP=10; M2min=0.9, (and kappa=1) , and alpha_s(sigmax)=aAL=0.104857: *)
(* aAL=0.104857;
 O4O6O8fitPFOMinnum[3]={0.9882610887398665`, {O4fitf -> 0.0022262172884706375`, 
  O6fitf -> -0.001633503663156077`, O8fitf -> 0.0011328775022884554`}};
O4O6O8fitPFOMinnum[4]={0.0006982482939429157`, {O4fitf -> 0.0003374139615189852`, 
  O6fitf -> 0.0004442120452587251`, O8fitf -> -0.0001690454228981371`}};
O4O6O8fitPFOMinnum[5]={0.17331369695983476`, {O4fitf -> -0.0010662063135740154`, 
  O6fitf -> 0.0017164576114845288`, O8fitf -> -0.0008861374625710671`}};
O4O6O8fitPFOMinnum[6]={0.4503552493330029`, {O4fitf -> -0.0022843768561015983`, 
  O6fitf -> 0.002631023346186392`, O8fitf -> -0.0013568572495440579`}};
O4O6O8fitPFOMinnum[7]={0.7793569802226384`, {O4fitf -> -0.0035102790697973804`, 
  O6fitf -> 0.0034198481016598954`, O8fitf -> -0.0017440928064294985`}};
O4O6O8fitPFOMinnum[8]={1.240592734402202`, {O4fitf -> -0.004911715747254533`, 
  O6fitf -> 0.00422265222632251`, O8fitf -> -0.002135386383216637`}};
O4O6O8fitPFOMinnum[9]={1.8449603110761275`, {O4fitf -> -0.006656045089198109`, 
  O6fitf -> 0.005096568630400593`, O8fitf -> -0.002550976831768859`}};
O4O6O8fitPFOMinnum[10]={2.5649555919189306`, {O4fitf -> -0.008984935135777064`, 
  O6fitf -> 0.006079297366707359`, O8fitf -> -0.0029938478147279696`}};
O4O6O8fitPFOMinnum[11]={3.047631183280993`, {O4fitf -> -0.012231440548874779`, 
  O6fitf -> 0.007096916073792773`, O8fitf -> -0.0033783646434522624`}};
O4O6O8fitPFOMinnum[12]={3.3815395399891384`, {O4fitf -> -0.017119430022867185`, 
  O6fitf -> 0.00821864404779844`, O8fitf -> -0.0037314828633714706`}};
O4O6O8fitPFOMinnum[13]={2.811031252024672`, {O4fitf -> -0.024832242435064128`, 
  O6fitf -> 0.009226620353217795`, O8fitf -> -0.0038464924831436856`}};
O4O6O8fitPFOMinnum[14]={3.8731054377508105`, {O4fitf -> -0.03854504072466938`, 
  O6fitf -> 0.01098272540898657`, O8fitf -> -0.004342757689965657`}};
O4O6O8fitPFOMinnum[15]={1.023891775632992`, {O4fitf -> -0.06290185126226547`, 
  O6fitf -> 0.011752551534764639`, O8fitf -> -0.0037274858184927384`}};
 *)
 (*----------------*)		    
(* Clear[Nn]; Do[Module[{}, xi2FOaf[Nn]=O4O6O8fitPFOMinnum[Nn][[1]]; aALfFOaf[Nn]=aAL; alsmtauFOaf[Nn]=aMSext[mtauphys^2/(kappa sigmax),aAL] Pi;  O4FOaf[Nn]=O4fitf/.O4O6O8fitPFOMinnum[Nn][[2]]; O6FOaf[Nn]=O6fitf/.O4O6O8fitPFOMinnum[Nn][[2]]; O8FOaf[Nn]=O8fitf/.O4O6O8fitPFOMinnum[Nn][[2]]],{Nn,3,15}]; *) 
 
 (* end of FO double-pinched Borel-Laplace (PFO) *)
(*---------------------------------------------------------------------_*)
 alsmtaufFO[8]=aMSext[mtau^2/sigmax,aALfFO[8]] Pi;

Plot0FOo77= 
Plot[{ReBPexpBinAL[M2] + delReBPexpBinAL[M2], 
  ReBPexpBinAL[M2] - delReBPexpBinAL[M2], 
  ReBPexpBinAL[M2],
  ReBPFOfast[M2, 8, aALfFO[8], O4FO[8], O6FO[8], O8FO[8]]},
  {M2, M2min, 1.5}, PlotRange -> {{M2min, 1.5}, {0.50, 0.75}}, 
 AxesOrigin -> {M2min, 1.09}, 
 PlotStyle -> {{Black, Thin}, {Black, Thin}, {Black, 
    Thickness[0.003]}, {Red, Dashed, 
    Thickness[0.003]}},(*{Black,Dotted,Thickness[0.003]},{Black,DotDashed,\
Thickness[0.003]}},*)Filling -> {1 -> {2}}, Frame -> True, 
 FrameLabel -> {Superscript[Abs[M], 2][Superscript[GeV, 2]], 
   Re B[Superscript[M, 2]]}, 
 PlotLegends -> Placed[{None, None, Style["ALEPH exp", 10], 
    Style["FO (Nt=8)", 10]}, {0.25, 0.25}], 
 Epilog -> {Inset[Style["(a)", 11], Scaled[{0.50, 0.88}]], 
   Inset[Style[\[Psi] == 0 , 11], Scaled[{0.70, 0.88}]], 
   Inset[Style[Subscript[\[Alpha], s], 11] [
      Subsuperscript[m, \[Tau], 2]] == 
     Style[Round[alsmtaufFO[8] 10^4]/10.^4, 11], Scaled[{0.77, 0.70}]]}];

PlotPi6FOo77= 
Plot[{ReBPexpBinAL[M2 Exp[I Pi/6]] + delReBPexpBinAL[M2 Exp[I Pi/6]], 
      ReBPexpBinAL[M2 Exp[I Pi/6]] - delReBPexpBinAL[M2 Exp[I Pi/6]],
      ReBPexpBinAL[M2 Exp[I Pi/6]],
    ReBPFOfast[M2 Exp[I Pi/6], 8, aALfFO[8], O4FO[8], O6FO[8], O8FO[8]]},
  {M2, M2min, 1.5}, PlotRange -> {{M2min, 1.5}, {0.50, 0.75}}, 
 AxesOrigin -> {M2min, 1.09}, 
 PlotStyle -> {{Black, Thin}, {Black, Thin}, {Black, 
    Thickness[0.003]}, {Red, Dashed, 
    Thickness[0.003]}},(*{Black,Dotted,Thickness[0.003]},{Black,DotDashed,\
Thickness[0.003]}},*)Filling -> {1 -> {2}}, Frame -> True, 
 FrameLabel -> {Superscript[Abs[M], 2][Superscript[GeV, 2]], 
   Re B[Superscript[M, 2]]}, 
 PlotLegends -> Placed[{None, None, Style["ALEPH exp", 10], 
    Style["FO (Nt=8)", 10]}, {0.25, 0.25}], 
 Epilog -> {Inset[Style["(b)", 11], Scaled[{0.50, 0.88}]], 
   Inset[Style[\[Psi] == \[Pi]/6 , 11], Scaled[{0.70, 0.88}]], 
   Inset[Style[Subscript[\[Alpha], s], 11] [
      Subsuperscript[m, \[Tau], 2]] == 
     Style[Round[alsmtaufFO[8] 10^4]/10.^4, 11], Scaled[{0.77, 0.70}]]}];

PlotPi4FOo77= 
 Plot[{ReBPexpBinAL[M2 Exp[I Pi/4]] + delReBPexpBinAL[M2 Exp[I Pi/4]],
    ReBPexpBinAL[M2 Exp[I Pi/4]] - delReBPexpBinAL[M2 Exp[I Pi/4]], 
   ReBPexpBinAL[M2 Exp[I Pi/4]], 
   ReBPFOfast[M2 Exp[I Pi/4], 8, aALfFO[8], O4FO[8], O6FO[8], 
    O8FO[8]]}, {M2, M2min, 1.5}, 
  PlotRange -> {{M2min, 1.5}, {0.50, 0.75}}, 
  AxesOrigin -> {M2min, 1.09}, 
  PlotStyle -> {{Black, Thin}, {Black, Thin}, {Black, 
     Thickness[0.003]}, {Red, Dashed, Thickness[0.003]}},(*{Black,
  Dotted,Thickness[0.003]},{Black,DotDashed,Thickness[0.003]}},*)
  Filling -> {1 -> {2}}, Frame -> True, 
  FrameLabel -> {Superscript[Abs[M], 2][Superscript[GeV, 2]], 
    Re B[Superscript[M, 2]]}, 
  PlotLegends -> 
   Placed[{None, None, Style["ALEPH exp", 10], 
     Style["FO (Nt=8)", 10]}, {0.25, 0.25}], 
  Epilog -> {Inset[Style["(c)", 11], Scaled[{0.50, 0.88}]], 
    Inset[Style[\[Psi] == \[Pi]/4, 11], Scaled[{0.70, 0.88}]], 
    Inset[Style[Subscript[\[Alpha], s], 11][
       Subsuperscript[m, \[Tau], 2]] == 
      Style[Round[alsmtaufFO[8] 10^4]/10.^4, 11], Scaled[{0.77, 0.70}]]}];

(* Export["FigPsi0PFOo77.pdf",Plot0FOo77];  Export["FigPsiPi6PFOo77.pdf",PlotPi6FOo77];  Export["FigPsiPi4PFOo77.pdf", PlotPi4FOo77]; *)
(*---------------------------------------------------------------------_*)
 (* Now FESR (2,n) moments a^{(2,n)} (i.e., double-pinched) in FO: *)

 (*--------*)
 (* First the experimental ALEPH values of (2,n) moments a^{(2,n)} (see also file rtauALEPH.m): *)
grs0a[2,nn_][sig_]:=((nn+3)/(nn+1)) (1/sigmax) (1 - (nn+2) (sig/sigmax)^(nn+1) + (nn+1) (sig/sigmax)^(nn+2) );
aexpBin77[2,nn_]:=(Sum[ dsbin[[ii]] grs0a[2,nn][sbin[[ii]]] OmegaVplA[ii],{ii,1,77}] + 2 Pi^2 fPi^2 grs0a[2,nn][mPi^2]) -  1;
delaexpBin77[2,nn_]:=(2 Pi^2) Sqrt[Sum[ grs0a[2,nn][sbin[[ii]]] grs0a[2,nn][sbin[[jj]]] dsbin[[ii]] dsbin[[jj]](  covVV[ii,jj]+covAA[ii,jj]+ covVA[ii,jj]+covAV[ii,jj] ),{ii,1,77},{jj,1,77}]];
(*  aexpBin77[2,n] +- delaexpBin77[2,n] = a^{(2,n)}_{exp} *)
(*---*)
(* Now the experimental ALEPH values for (1,n) moments a^{(1,n)} (see also the file rtauALEPH.m): *)
 grs0a[1,nn_][sig_]:=((nn+2)/(nn+1)) (1/sigmax) (1 - (sig/sigmax)^(nn+1));
aexpBin77[1,nn_]:=(Sum[ dsbin[[ii]] grs0a[1,nn][sbin[[ii]]] OmegaVplA[ii],{ii,1,77}] + 2 Pi^2 fPi^2 grs0a[1,nn][mPi^2]) -  1;
delaexpBin77[1,nn_]:=(2 Pi^2) Sqrt[Sum[ grs0a[1,nn][sbin[[ii]]] grs0a[1,nn][sbin[[jj]]] dsbin[[ii]] dsbin[[jj]](  covVV[ii,jj]+covAA[ii,jj]+ covVA[ii,jj]+covAV[ii,jj] ),{ii,1,77},{jj,1,77}]];
(*  a^{(1,n)}_{exp} = aexpBin77[1,n] +- delaexpBin77[1,n] *)
(*---*)
(* Now the experimental ALEPH values for (0,0) moment a^{(0,0)} (see also the file rtauALEPH.m): *)
grs0a[0,0][sig_]:=(1/sigmax);
aexpBin77[0,0]=(Sum[ dsbin[[ii]] grs0a[0,0][sbin[[ii]]] OmegaVplA[ii],{ii,1,77}] + 2 Pi^2 fPi^2 grs0a[0,0][mPi^2]) -  1;
delaexpBin77[1,nn_]:=(2 Pi^2) Sqrt[Sum[ grs0a[0,0][sbin[[ii]]] grs0a[0,0][sbin[[jj]]] dsbin[[ii]] dsbin[[jj]](  covVV[ii,jj]+covAA[ii,jj]+ covVA[ii,jj]+covAV[ii,jj] ),{ii,1,77},{jj,1,77}]];
(*  a^{(0,0)}_{exp} = aexpBin77[0,0] +- delaexpBin77[0,0] *)
(*--------*)

 kappa=1.0;
 tkap=kappa*Exp[tKK];
 (*-----*)
(* moments a^{(2,n}}, FO: *)			     
 cAg[2,nn_][kp_]:=(1/(2 Pi)) ((nn+3)/(nn+1)) Re[ (-I)^kp NIntegrate[ th^kp ( Exp[I th] (1 - (-Exp[I th])^(nn+1)) + ((nn+1)/(nn+3))(1 - (-Exp[I th])^(nn+3)) ),{th, -Pi,Pi}] ];  
(* kp = 0, 1, 2, ... *)
 coeffaaFO[2,n_][NN_]:=Sum[tddtk[nn,tkap] Binomial[nn + kk, kk] be0^kk coeffext[nn + kk + 1, NN] cAg[2,n][kk], {nn, 0, NN - 1}, {kk, 0, NN - 1 - nn}];
 coeffaaFOIR2[2,n_][NN_]:=Sum[tddtkIR2[nn,tkap] Binomial[nn + kk, kk] be0^kk coeffext[nn + kk + 1, NN] cAg[2,n][kk], {nn, 0, NN - 1}, {kk, 0, NN - 1 - nn}];
  coeffaaFOIR3[2,n_][NN_]:=Sum[tddtkIR3[nn,tkap] Binomial[nn + kk, kk] be0^kk coeffext[nn + kk + 1, NN] cAg[2,n][kk], {nn, 0, NN - 1}, {kk, 0, NN - 1 - nn}];
  coeffaaFOUV1[2,n_][NN_]:=Sum[tddtkUV1[nn,tkap] Binomial[nn + kk, kk] be0^kk coeffext[nn + kk + 1, NN] cAg[2,n][kk], {nn, 0, NN - 1}, {kk, 0, NN - 1 - nn}];
(* coeffaaFO[2,n][NN] is the coefficient at x^NN in the expansion of aa[2,n] *)
aaFOD0fast[2,n_,aALf_][NN_]:=Sum[coeffaaFO[2,n][nn] x^nn,{nn,1,NN}]/.{x->aALf};
(* aALf=a(kappa*sigmax) *)
aaFOD0fastIR2[2,n_,aALf_][NN_]:=Sum[coeffaaFOIR2[2,n][nn] x^nn,{nn,1,NN}]/.{x->aALf};
aaFOD0fastIR3[2,n_,aALf_][NN_]:=Sum[coeffaaFOIR3[2,n][nn] x^nn,{nn,1,NN}]/.{x->aALf};
aaFOD0fastUV1[2,n_,aALf_][NN_]:=Sum[coeffaaFOUV1[2,n][nn] x^nn,{nn,1,NN}]/.{x->aALf}; 
 aaFOfast[2,n_,aALf_][NN_,O2np4_,O2np6_]:=aaFOD0fast[2,n,aALf][NN] + ((n+3)/(n+1)) 2 Pi^2 (-1)^n ( (n+2) O2np4/sigmax^(n+2) + (n+1) O2np6/sigmax^(n+3) );
(* O2np4= <O_{2 n + 4}>_{V+A}; O2np6= <O_{2 n + 6}>_{V+A}; *)
(* Note, on 2 March 2021 I compared with Cesar and found out an error in my prg in aaFOfast[2,n], aaCIfast[2,n], aaPVfast[2,n], aaRenfast[2,n]: the factor in front of the condensates must be (n+3)/(n+1), and NOT (n+3)/(n+2); this is numerically important *)
 (* aALf=alpha_s(kappa*sigmax)/Pi *)
(* moments a^{(2,n}}, tFO: *)
coeffaatFO[2,n_][nn_]:=Sum[tddtk[nn-kk,tkap] be0^kk  cAg[2,n][kk] Binomial[nn,kk],{kk,0,nn}];
coeffaatFOIR2[2,n_][nn_]:=Sum[tddtkIR2[nn-kk,tkap] be0^kk  cAg[2,n][kk] Binomial[nn,kk],{kk,0,nn}];
coeffaatFOIR3[2,n_][nn_]:=Sum[tddtkIR3[nn-kk,tkap] be0^kk  cAg[2,n][kk] Binomial[nn,kk],{kk,0,nn}];
coeffaatFOUV1[2,n_][nn_]:=Sum[tddtkUV1[nn-kk,tkap] be0^kk  cAg[2,n][kk] Binomial[nn,kk],{kk,0,nn}]; 
aatFOD0[2,n_,aALf_][NN_]:=Sum[coeffaatFO[2,n][nn-1] taprov[nn,x],{nn,1,NN}]/.{x->aALf};
(* aALf=a(kappa*sigmax) *)
aatFOD0IR2[2,n_,aALf_][NN_]:=Sum[coeffaatFOIR2[2,n][nn-1] taprov[nn,x],{nn,1,NN}]/.{x->aALf};
aatFOD0IR3[2,n_,aALf_][NN_]:=Sum[coeffaatFOIR3[2,n][nn-1] taprov[nn,x],{nn,1,NN}]/.{x->aALf};
aatFOD0UV1[2,n_,aALf_][NN_]:=Sum[coeffaatFOUV1[2,n][nn-1] taprov[nn,x],{nn,1,NN}]/.{x->aALf}; 
aatFO[2,n_,aALf_][NN_,O2np4_,O2np6_]:=aatFOD0[2,n,aALf][NN] + ((n+3)/(n+1)) 2 Pi^2 (-1)^n ( (n+2) O2np4/sigmax^(n+2) + (n+1) O2np6/sigmax^(n+3) );
 (*----*)
(* moments a^{(1,n}}, FO: *)			     
cAg[1,nn_][kp_]:=(1/(2 Pi)) ((nn+2)/(nn+1)) Re[ (-I)^kp NIntegrate[ th^kp ( (1+Exp[I th]) - (1/(nn+2))(1 - (-Exp[I th])^(nn+2)) ),{th, -Pi,Pi}] ];  
(* kp = 0, 1, 2, ... *)
coeffaaFO[1,n_][NN_]:=Sum[tddtk[nn,tkap] Binomial[nn + kk, kk] be0^kk coeffext[nn + kk + 1, NN] cAg[1,n][kk], {nn, 0, NN - 1}, {kk, 0, NN - 1 - nn}];
(* coeffaaFO[1,n][NN] is the coefficient at x^NN in the expansion of aa[1,n] *)
aaFOD0fast[1,n_,aALf_][NN_]:=Sum[coeffaaFO[1,n][nn] x^nn,{nn,1,NN}]/.{x->aALf};
aaFOfast[1,n_,aALf_][NN_, O2np4_]:=aaFOD0fast[1,n,aALf][NN]+((n+2)/(n+1)) 2 Pi^2 (-1)^n O2np4/sigmax^(n+2);
(* moments a^{(1,n}}, tFO: *)				     
coeffaatFO[1,n_][nn_]:=Sum[tddtk[nn-kk,tkap] be0^kk  cAg[1,n][kk] Binomial[nn,kk],{kk,0,nn}];
aatFOD0[1,n_,aALf_][NN_]:=Sum[coeffaatFO[1,n][nn-1] taprov[nn,x],{nn,1,NN}]/.{x->aALf};			     
aatFO[1,n_,aALf_][NN_, O2np4_]:=aatFOD0[1,n,aALf][NN]+((n+2)/(n+1)) 2 Pi^2 (-1)^n O2np4/sigmax^(n+2);
(*--------------*)
 (*----*)
(* moment a^{(0,0}}, FO: *)			     
cAg[0,0][kp_]:=(1/(2 Pi)) Re[ (-I)^kp NIntegrate[ th^kp ( (1+Exp[I th]) ),{th, -Pi,Pi}] ];  
(* kp = 0, 1, 2, ... *)
coeffaaFO[0,0][NN_]:=Sum[tddtk[nn,tkap] Binomial[nn + kk, kk] be0^kk coeffext[nn + kk + 1, NN] cAg[0,0][kk], {nn, 0, NN - 1}, {kk, 0, NN - 1 - nn}];
(* coeffaaFO[0,0][NN] is the coefficient at x^NN in the expansion of aa[0,0] *)
aaFOD0fast[0,0,aALf_][NN_]:=Sum[coeffaaFO[0,0][nn] x^nn,{nn,1,NN}]/.{x->aALf};
aaFOfast[0,0,aALf_][NN_]:=aaFOD0fast[0,0,aALf][NN];
(* moments a^{(0,0}}, tFO: *)				     
coeffaatFO[0,0][nn_]:=Sum[tddtk[nn-kk,tkap] be0^kk  cAg[0,0][kk] Binomial[nn,kk],{kk,0,nn}];
aatFOD0[0,0,aALf_][NN_]:=Sum[coeffaatFO[0,0][nn-1] taprov[nn,x],{nn,1,NN}]/.{x->aALf};			     
(*---------------------_*)
(* Some cross-checking with a[2,1][NN]=aaFOD0fast[2, 1, as][NN]=rtau(sigmax;D=0) as FOPT expansion in powers of as=a(kappa sigmax): *)
rtauaa[n_,kappa]:=Module[{nn},nn=n;Coefficient[aaFOD0fast[2, 1, as][16],as^(nn+1)]]; (* n=1,2,...,11; note that rtauaa[0,kappa]=1 *)
(*
rtauaa[n_,kappa]:=Module[{nn},nn=n;Coefficient[aaFOD0fast[2, 1, as][16],as^(nn+1)]];
tabrtauaa = Table[{nn, rtauaa[nn, kappa]}, {nn, 0, 15}];
Boreltd[u_,kappa]:=1 + Sum[tddtk[jj, tkap] u^jj/(jj! be0^jj),{jj,1,30}];
Boreltrtau[u_,kappa]:=Series[Boreltd[uu,kappa]*(Sin[Pi uu]/Pi)(1/uu - 2/(uu-1) +2/(uu-3)-1/(uu-4)),{uu,0,30}]/.uu->u;
trtau[n_,kappa]:=Coefficient[Boreltrtau[u,kappa],u^n] n! be0^n;  (* n=1,2,...; this is coefficient at {tilde a}_n(kappa sigmax] of rtau *)
trtau[0,kappa]=1;
rtau[n_,kappa]:=Sum[coeffext[jj+1,n+1] trtau[jj,kappa],{jj,0,n}];
 (* n=1,2,...; this is coeff at a(kappa sigmax)^(n+1) of FOPT expansion of rtau(sigmax,D=0) in powers of as=a(kappa sigmax) *)
rtau[0,kappa]=1;
tabrtau = Table[{nn, rtau[nn, kappa]}, {nn, 0, 15}];
 *) 
(* We can now compare the coefficients, e.g., of the expansion aaFOD0fast[2, 1, as][12] in powers of as=a(kappa sigmax); and rtau[n,kappa], and we see that the coefficients coincide; thus, my theoretical approach to obtaining the FOPT expansion of rtau via the (1-loop) Borel of (tilde d} works  (I checked for kappa=1 and kappa=2)! I.e., tables tabrtauaa and tabrtau give the same results (tabrtauaa - tabrtau = practically zero). This concludes the cross-check in the case of rtau FESR *)
(*
tabtd = Table[{nn, tddtk[nn, tkap]}, {nn, 0, 15}]
tabd = Table[{nn, ddtk[nn, tkap]}, {nn, 0, 15}]
tabtrtau = Table[{nn, trtau[nn, kappa]}, {nn, 0, 15}]
tabrtau = Table[{nn, rtau[nn, kappa]}, {nn, 0, 15}]
tabtdrat = Table[{nn, tddtk[nn, tkap]/((nn + 1)! (-be0)^nn)}, {nn, 0, 15}]
 bg1 = 1 - 1 c1/be0;
 tabdrat = Table[{nn, ddtk[nn, tkap]/(N[Gamma[1 + nn + bg1]] (-be0)^nn)}, {nn, 0, 15}]
tabtrtaurat = Table[{nn, trtau[nn, kappa]/((nn + 1)! (-be0)^nn)}, {nn, 0, 15}]
tabrtaurat = Table[{nn, rtau[nn, kappa]/(Gamma[1 + nn + bg1] (-be0)^nn)}, {nn, 0, 15}]
*)
 (* We see that  tabtrtaurat and tabrtaurat go to zero as nn increases, i.e., no u=-1 UV contribution there really *)
 (* while tabtdrat and tabdrat go to a constant when nn increases, i.e., typical u=-1 UV dominance behaviour *)
 (* Note: coeffext[j+1,n+1]=kk[j+1,n-j]; for n=1,2,3,... and j=1,2,...,n(1 =< h =<n); *)
 (* n=0:  coeffext[1,1]=1 (=kk[1,0]) *)
 (*
rtauext[nm_, kappa] := Module[{s, ffp}, ffp = Sum[kk[nm + 1 - s, s] trtau[nm - s, kappa], {s, 0, nm - 1}]; ffp]; rtauext[0, kappa]=1;
tabrtauext=Table[{nn, rtauext[nn, kappa]}, {nn, 0, 30}]
  *)
(* This should agree with tabrtau, but now it is extended to nn=30 *)
  (* Now the ratios involving coefficients, in the extended regime 0 =< nn =< 30: *)
  (* for td and trtau: *)
  (*
 TABtdextratDP = Table[{nn, tddtk[nn, tkap]/((nn + 1)! (-be0)^nn)}, {nn, 0, 30}]
  TABtdextratSP = Table[{nn, tddtk[nn, tkap]/(nn! (-be0)^nn)}, {nn, 0, 30}]
TABtrtauextratDP = Table[{nn, trtau[nn, kappa]/((nn + 1)! (-be0)^nn)}, {nn, 0, 30}]
TABtrtauextratSP = Table[{nn, trtau[nn, kappa]/(nn! (-be0)^nn)}, {nn, 0, 30}]
  (* for d and rtau: *)
TABdextratDP = Table[{nn, ddtk[nn, tkap]/(N[Gamma[1 + nn + bg1]] (-be0)^nn)}, {nn, 0, 30}]
TABdextratSP = Table[{nn, ddtk[nn, tkap]/(N[Gamma[nn + bg1]] (-be0)^nn)}, {nn, 0, 30}]
TABrtauextratDP = Table[{nn, rtauext[nn, kappa]/(N[Gamma[1 + nn + bg1]] (-be0)^nn)}, {nn, 0, 30}]
TABrtauextratSP = Table[{nn, rtauext[nn, kappa]/(N[Gamma[nn + bg1]] (-be0)^nn)}, {nn, 0, 30}]
   *)
   (* these results clearly show that: trtau(sigmax;kappa) ({tilde FOPT) is a pt series (in powers of a(kappa*sigmax)) with coefficients dominated by SINGLE POLE u=-1 UV renormalon; while {tilde Adler} function td(Q^2;kappa) is a pt series (in powers of a(kappa*Q^2)) dominated by DOUBLE POLE u=1 UV renormalon  *)
    (* and: these results clearly indicate that rtau(sigmax) (FOPT) is a pt series (in powers of a(kappa*sigmax)) with coefficients dominated by DRESSED SINGLE POLE u=1 UV renormalon; while Adler function d(Q^2) is a pt series (in powers of a(kappa*Q^2)) dominated by DRESSED DOUBLE POLE u=1 UV renormalon  [this is IMPORTANT: the DRESSING of the poles occurs in this TIMELIKE quantity rtau in the same way as it occured in the SPACELIKE quantities (Adler d, etc.)] -- this has to do with the fact that the relations between the coefficients r_n and {tr}_k (dressing for rtau) are the same as between the doefficients d_n and {td}_k (dressing of Adler d) *)
    (* We note that when bg1 -> 1, this represents (undressed) single or double poles: Gamma[1 + nn + bg1] -> (nn+1)!; Gamma[nn + bg1] -> nn!; however, bg1=1 - 1 c1/be0=17/81 =
     0.2099, which implies that the one-loop dressing is numerically a very important effect; i.e., the coefficients d_n and r_n (not tilde) increase more slowly than the corresponding {tilde d}_n and {tilde r}_n coefficients when n increases *)
    (* nonetheless, when kappa=1, we see that |d_n| is larger than |td_n| for (n< 8), and |td_n| cathes up with |d_n| at n=8, and for n>8 we have |td_n|>|d_n| and |td_n| increased (somewhat) faster than |d_n| *)
    (* the same is true for |r_n| vs |tr_n|; |tr_n| cathes up with |r_n| at n=11-12; although for n<11 we have |r_n|>|tr_n|, the convergence properties are somewhat better for FOPT rtau (i.e., using r_n a^{n+1}) than for {tilde FOPT} of rtau (i.e., using tr_n {tilde a}_{n+1}) (for n< 11), because at Q^2=sigmax=2.8 we have. e.g., {tilde a}_5=app 4 a^5 =app 4 10^-5 >> a^5, etc. *)
    (* Further, comparing tabd = Table[{nn, ddtk[nn, tkap]}, {nn, 0, 30}] and tabrtau = Table[{nn, rtauext[nn, kappa]}, {nn, 0, 30}], we see that r_n are increasing more slowly than d_n (although r_n are larger than d_n), at n=6 d_n catches up with r_n; UV u=1 contribution in r_n becomes dominant at n=13-14 (in {tr}_n at n=7-8); in d_n at n=11-12 (in {td}_n at n=5-6)  *)
    (*--------------*)
(* Verification (check) of another aspect: to see that {tilde d}_n is (significantly) different from {tilde d}_n^{(LB)}: *)
(* The generator of {tilde d}_n^{(LB)}(kappa): the LB Borel of Adler: (with kappa=1, of Adler d(Q^2)_{(D=0)}): *)
 (* Nt is roughly a precision truncation number; Nt=50 gives quite good precision, it seems: *)
 BoreldLB[uf_,kappaf_,Nt_]:=(32/3) Exp[uf Log[kappaf]] (Exp[(5/3) uf]/(2-uf)) Sum[ ((-1)^kk) kk/((kk-1+uf)^2 (kk+1-uf)^2),{kk,2,Nt}];
 SerBoreldLB[uf_,kappaf_,Nt_]:=Series[BoreldLB[uf,kappaf,Nt],{u,0,Nt}];
 tddtkLB[nn_,tkap_,Nt_]:=Coefficient[SerBoreldLB[u,tkap Exp[-tKK],Nt],u^nn] (be0^nn) nn!;
 (* Now can compare, e.g., for n=1 ({tilde d}_1): *)
  (* for n=1 ({tilde d}_1): tddtkLB[1,tkap,50] with tddtk[1,tkap] (for kappa=1, they are not far apart: 1.56 vs 1.64); *)
  (* for n=2 ({tilde d}_2):  tddtkLB[2,tkap,50] with tddtk[2,tkap] (for kappa=1, they are far apart: 15.71 vs 3.46; *)
   (* for n=3 ({tilde d}_3):  tddtkLB[3,tkap,50] with tddtk[3,tkap]  (for kappa=1, they are not far apart: 24.83 vs 26.38 *)   
    (* for kappa=1: TabRattddvstddLB=Table[{n,tddtk[n, tkap]/tddtkLB[n, tkap, 50]},{n,1,10}] = {{1, 1.05347}, {2, 0.219949}, {3, 1.06242}, {4, 0.0479434}, {5, -0.869819}, {6, -0.100932}, {7, -0.298927}, {8, -0.184191}, {9, -0.238877}, {10, -0.21536}}; This means that {tilde d}_n in general have important contributions beyond-LB; so, our approach with {tilde d}_n (<-> {tilde D}) is important, not close to LB (D^{(LB)}) numerically *)
    (*--------------*)
    (* A more systematic separation of various parts (UV1, IR2, IR3) of d and rtau(=a^{(2,1)}(sigmax;D=0)): *)
(*     
BoreltdUV1[u_, tkapp_] := Normal[Series[BtDUV1[u, tkapp], {u, 0, 30}]];
BoreltdIR2[u_, tkapp_] := Normal[Series[BtDIR2[u, tkapp], {u, 0, 30}]];
BoreltdIR3[u_, tkapp_] := Normal[Series[BtDIR3[u, tkapp], {u, 0, 30}]];

tddtkUV1[nn_, tkapp_] := Coefficient[BoreltdUV1[u, tkapp], u^nn] nn! be0^nn;
tddtkUV1[0, tkapp_] := BoreltdUV1[u, tkapp]/.u->0;
tabtdUV1[tkapp_]:=Table[{nn, tddtkUV1[nn, tkapp]}, {nn, 0, 30}];          
tddtkIR2[nn_, tkapp_] := Coefficient[BoreltdIR2[u, tkapp], u^nn] nn! be0^nn;
tddtkIR2[0, tkapp_] := BoreltdIR2[u, tkapp]/.u->0;
tabtdIR2[tkapp_]:=Table[{nn, tddtkIR2[nn, tkapp]}, {nn, 0, 30}];               
tddtkIR3[nn_, tkapp_] := Coefficient[BoreltdIR3[u, tkapp], u^nn] nn! be0^nn;
tddtkIR3[0, tkapp_] := BoreltdIR3[u, tkapp]/.u->0;          
tabtdIR3[tkapp_]:=Table[{nn, tddtkIR3[nn, tkapp]}, {nn, 0, 30}];               
     tabtdsum[tkapp_]:=Table[{nn, tddtkUV1[nn, tkapp]+tddtkIR2[nn, tkapp]+tddtkIR3[nn, tkapp]}, {nn, 0, 30}];  (* tabtdsum[tkap] gives the same result as Table[{nn, tddtk[nn, tkap]}, {nn, 0, 30}], as it should be *)

ddtkUV1[nm_, tkapp_] := Module[{s, ffp}, ffp = Sum[kk[nm + 1 - s, s] tddtkUV1[nm - s, tkapp], {s, 0, nm - 1}]; ffp]; ddtkUV1[0, tkapp_]:= tddtkUV1[0, tkapp];
tabdUV1[tkapp_]:=Table[{nn, ddtkUV1[nn, tkapp]}, {nn, 0, 30}];               
ddtkIR2[nm_, tkapp_] := Module[{s, ffp}, ffp = Sum[kk[nm + 1 - s, s] tddtkIR2[nm - s, tkapp], {s, 0, nm - 1}]; ffp]; ddtkIR2[0, tkapp_]:= tddtkIR2[0, tkapp];
tabdIR2[tkapp_]:=Table[{nn, ddtkIR2[nn, tkapp]}, {nn, 0, 30}];                  ddtkIR3[nm_, tkapp_] := Module[{s, ffp}, ffp = Sum[kk[nm + 1 - s, s] tddtkIR3[nm - s, tkapp], {s, 0, nm - 1}]; ffp]; ddtkIR3[0, tkapp_]:= tddtkIR3[0, tkapp];
tabdIR3[tkapp_]:=Table[{nn, ddtkIR3[nn, tkapp]}, {nn, 0, 30}];
 tabdsum[tkapp_]:=Table[{nn, ddtkUV1[nn, tkapp]+ddtkIR2[nn, tkapp]+ddtkIR3[nn, tkapp]}, {nn, 0, 30}]; (* tabdsum[tkap] gives the same result as Table[{nn, ddtk[nn, tkap]}, {nn, 0, 30}], as it should be *)
     
BoreltrtauUV1[u_, tkapp_] := Series[BoreltdUV1[uu, tkapp]*(Sin[Pi uu]/Pi) (1/uu - 2/(uu - 1) + 2/(uu - 3) - 1/(uu - 4)), {uu, 0, 30}] /. uu -> u;
trtauUV1[n_, tkapp_] := Coefficient[BoreltrtauUV1[u, tkapp], u^n] n! be0^n;
trtauUV1[0,tkapp_]:=BoreltrtauUV1[0, tkapp];
tabtrtauUV1[tkapp_]:=Table[{nn, trtauUV1[nn, tkapp]}, {nn, 0, 30}];     
BoreltrtauIR2[u_, tkapp_] := Series[BoreltdIR2[uu, tkapp]*(Sin[Pi uu]/Pi) (1/uu - 2/(uu - 1) + 2/(uu - 3) - 1/(uu - 4)), {uu, 0, 30}] /. uu -> u;
trtauIR2[n_, tkapp_] := Coefficient[BoreltrtauIR2[u, tkapp], u^n] n! be0^n;
trtauIR2[0,tkapp_]:=BoreltrtauIR2[0, tkapp];
tabtrtauIR2[tkapp_]:=Table[{nn, trtauIR2[nn, tkapp]}, {nn, 0, 30}];     
BoreltrtauIR3[u_, tkapp_] := Series[BoreltdIR3[uu, tkapp]*(Sin[Pi uu]/Pi) (1/uu - 2/(uu - 1) + 2/(uu - 3) - 1/(uu - 4)), {uu, 0, 30}] /. uu -> u;
trtauIR3[n_, tkapp_] := Coefficient[BoreltrtauIR3[u, tkapp], u^n] n! be0^n;
trtauIR3[0,tkapp_]:=BoreltrtauIR3[0, tkapp];     
tabtrtauIR3[tkapp_]:=Table[{nn, trtauIR3[nn, tkapp]}, {nn, 0, 30}];     
tabtrtausum[tkapp_]:=Table[{nn, trtauUV1[nn, tkapp]+trtauIR2[nn, tkapp]+trtauIR3[nn, tkapp]}, {nn, 0, 30}];   (* tabtrtausum[tkap] coincides with tabtrtau when kappa=1, as it should; *)
trtausum[nn_,tkapp_]:= trtauUV1[nn, tkapp]+trtauIR2[nn, tkapp]+trtauIR3[nn, tkapp];
 
rtauUV1[nm_, tkapp_] := Module[{s, ffp}, ffp = Sum[kk[nm + 1 - s, s] trtauUV1[nm - s, tkapp], {s, 0, nm - 1}]; ffp]; rtauUV1[0, tkapp_]=trtauUV1[0, tkapp];
tabrtauUV1[tkapp_]:=Table[{nn, rtauUV1[nn, tkapp]}, {nn, 0, 30}];
rtauIR2[nm_, tkapp_] := Module[{s, ffp}, ffp = Sum[kk[nm + 1 - s, s] trtauIR2[nm - s, tkapp], {s, 0, nm - 1}]; ffp]; rtauIR2[0, tkapp_]=trtauIR2[0, tkapp];
tabrtauIR2[tkapp_]:=Table[{nn, rtauIR2[nn, tkapp]}, {nn, 0, 30}];
rtauIR3[nm_, tkapp_] := Module[{s, ffp}, ffp = Sum[kk[nm + 1 - s, s] trtauIR3[nm - s, tkapp], {s, 0, nm - 1}]; ffp]; rtauIR3[0, tkapp_]=trtauIR3[0, tkapp];
tabrtauIR3[tkapp_]:=Table[{nn, rtauIR3[nn, tkapp]}, {nn, 0, 30}];     
tabrtausum[tkapp_]:=Table[{nn, rtauUV1[nn, tkapp]+rtauIR2[nn, tkapp]+rtauIR3[nn, tkapp]}, {nn, 0, 30}];  (* tabrtausum[tkap] coincides with tabrtau when kappa=1, as it should; *) 
rtausum[nn_,tkapp_]:= rtauUV1[nn, tkapp]+rtauIR2[nn, tkapp]+rtauIR3[nn, tkapp];
 
 (* When kappa=1 (tkap=1.6803): *)
Table[{nn, tddtkUV1[nn, tkap]/tddtk[nn, tkap]}, {nn, 0, 30}]
     vs.
Table[{nn, tddtkIR2[nn, tkap]/tddtk[nn, tkap]}, {nn, 0, 30}]  -->
 (* For n >= 7 UV1 in td_n becomes more important than IR2 in td_n (lpt-expansion); i.e., for n >=7 UV1 imposes its dominance in the coeffs td_n in lpt-expansion of Adler: for n>=7: 0.85<|tddtkUV1[nn, tkap]/tddtk[nn, tkap]|<1.1 and |tddtkIR2[nn, tkap]/tddtk[nn, tkap]|<0.16 and |tddtkIR3[nn, tkap]/tddtk[nn, tkap]|<0.016 *)
     (* For n>=5 IR3 becomes negligible in coeffs td_n (less than 10%) *)

 Table[{nn, ddtkUV1[nn, tkap]/ddtk[nn, tkap]}, {nn, 0, 30}]
     vs.
Table[{nn, ddtkIR2[nn, tkap]/ddtk[nn, tkap]}, {nn, 0, 30}]
 (* For n >=13  UV1 in d_n becomes more important than IR2 in d_n (pt-expansion); i.e., for n>=13 UV1 imposes its dominance in the coeffs d_n in pt-expansion: 0.79 < |ddtkUV1[nn, tkap]/ddtk[nn, tkap]| < 1.17;  |ddtkIR2[nn, tkap]/ddtk[nn, tkap]| < 0.22;  |ddtkIR3[nn, tkap]/ddtk[nn, tkap]| < 0.01  *) 
     (* For n>=11 IR3 becomes negligible in coeffs d_n (less than 5%) *)

 (* How do these compare with the coefficients in rtau(sigmax;D=0)=a^{(2,1)}(sigmax; D=0) (kappa=1)?: *)
     
     Table[{nn, trtauUV1[nn, tkap]/trtausum[nn, tkap]}, {nn, 0, 30}]
     vs.
      Table[{nn, trtauIR2[nn, tkap]/trtausum[nn, tkap]}, {nn, 0, 30}]
 (* For n >= 8 UV1 in tr_n gives more important contributions than IR2 and IR3 gives to tr_n (tFO (lpt) - expansion); i.e., for n>=8 UV1 imposes its dominance in  the coeffs tr_n of the tFO (lpt) expansion of rtau: for n>=8: 0.87 < |trtauUV1[nn, tkap]/trtausum[nn, tkap]| < 1.11; |trtauIR2[nn, tkap]/trtausum[nn, tkap]| < 0.15; |trtauIR3[nn, tkap]/trtausum[nn, tkap]| < 0.13 *)
 (* IR3 competes with the (suppressed IR2) contribution to tr_n up to n=20, for n > 20 the IR2 is a bit stronger (from the subleading IR2 effects, ~ln(1-u/2) in B[td]) *)

Table[{nn, rtauUV1[nn, tkap]/rtausum[nn, tkap]}, {nn, 0, 30}]
vs.
Table[{nn, rtauIR2[nn, tkap]/rtausum[nn, tkap]}, {nn, 0, 30}]
 (* For n>=15 UV1 becomes dominant contribution to r_n (more important than IR2 and IR3), i.e., for n>=15 UV1 imposes its dominance to r_n (FO (pt) expansion of rtau):  0.71 < |rtauUV1[nn, tkap]/rtausum[nn, tkap]| < 1.24; |rtauIR2[nn, tkap]/rtausum[nn, tkap]| < 0.11; |rtauIR3[nn, tkap]/rtausum[nn, tkap]| < 0.18; *)
 (* IR3 competes with the (suppressed IR2) contribution in r_n up to n=20, for larger n IR2 is stronger *)

										 (* So, we see that in rtau, either in tFO (lpt) or in FO (pt) expansions, the UV1 contribution to the coefficients imposes itself over the other (IR2 and IR3) contributions somewhat later than in the Adler d (pt or lpt expansions); this is so because UV1 in rtau becomes suppressed (from double to single pole) *)
										 (* Nonetheless, IR2 also gets supressed in rtau, we are left only with subleading u=2 IR2 (from log[1-u/2]) *)

										 (* Beware, when comparing Table[{nn, trtauIR2[nn, tkap]/trtausum[nn, tkap]}, {nn, 0, 30}] vs. Table[{nn, tddtkIR2[nn, tkap]/tddtk[nn, tkap]}, {nn, 0, 30}]; we can see that the lpt (tFO) expansions cannot show in this way explicitly the suppression of IR2 in rtau because also the full coefficients tr_n get suppressed significantly with respect to td_n (at n >= 7), this due to the suppression of the UV1 renormalon from DP to SP when d -> rtau *)
										 (* Further, the coefficients r_n get suppressed in comparison with d_n at n>=11, again due to the spresssion of the UV1 in rtau with respect to d *)										 (*----------------------------------------*)
 (* When aALf=a(sigmax) is varied ('avar'), i.e.,using alO4O6O8fitPFOMinnum[N] (N=3,4,...15) from global FO: *)			     
(*
 Tab20D0FOavar=Table[{NN,aaFOfast[2,0,aALfFO[NN]][NN,0,0]},{NN,3,15}];
 (* Tab20FOavar=Table[{NN,aaFOfast[2,0,aALfFO[NN]][NN,O4FO[NN],O6FO[NN]]},{NN,3,15}];*)   Tab20FOavar=Table[{NN, Tab20D0FOavar[[NN - 2]][[2]] + ((0 + 3)/(0 + 1)) 2 Pi^2 (-1)^0 ((0 + 2) O4FO[NN]/sigmax^(0 + 2) + (0 + 1) O6FO[NN]/sigmax^(0 + 3))}, {NN, 3, 15}];
 delTab20FOavar= Table[{Nn, Tab20FOavar[[Nn - 2]][[2]] - Tab20FOavar[[Nn - 3]][[2]]}, {Nn, 4, 15}];
 Tab21D0FOavar=Table[{NN,aaFOfast[2,1,aALfFO[NN]][NN,0,0]},{NN,3,15}]; 
 (* Tab21FOavar=Table[{NN,aaFOfast[2,1,aALfFO[NN]][NN,O6FO[NN],O8FO[NN]]},{NN,3,15}];*)
 Tab21FOavar=Table[{NN, Tab21D0FOavar[[NN - 2]][[2]] + ((1 + 3)/(1 + 1)) 2 Pi^2 (-1)^1 ((1 + 2) O6FO[NN]/sigmax^(1 + 2) + (1 + 1) O8FO[NN]/sigmax^(1 + 3))}, {NN, 3, 15}];
delTab21FOavar= Table[{Nn, Tab21FOavar[[Nn - 2]][[2]] - Tab21FOavar[[Nn - 3]][[2]]}, {Nn, 4, 15}];
Tab10D0FOavar=Table[{NN,aaFOfast[1, 0, aALfFO[NN]][NN, 0]},{NN,3,15}];
Tab10FOavar=Table[{NN,Tab10D0FOavar[[NN - 2]][[2]] + ((0+2)/(0+1)) 2 Pi^2 (-1)^0 O4FO[NN]/sigmax^(0 + 2)}, {NN, 3, 15}];
delTab10FOavar= Table[{Nn, Tab10FOavar[[Nn - 2]][[2]] - Tab10FOavar[[Nn - 3]][[2]]}, {Nn, 4, 15}];  
ff20exp=Table[{NN,aexpBin77[2,0]},{NN,3,15}]; ff20plexp=Table[{NN,aexpBin77[2,0]+delaexpBin77[2,0]},{NN,3,15}]; ff20miexp=Table[{NN,aexpBin77[2,0]-delaexpBin77[2,0]},{NN,3,15}];
ff21exp=Table[{NN,aexpBin77[2,1]},{NN,3,15}];  ff21plexp=Table[{NN,aexpBin77[2,1]+delaexpBin77[2,1]},{NN,3,15}]; ff21miexp=Table[{NN,aexpBin77[2,1]-delaexpBin77[2,1]},{NN,3,15}]; ff10exp=Table[{NN,aexpBin77[1,0]},{NN,3,15}]; ff10plexp=Table[{NN,aexpBin77[1,0]+delaexpBin77[1,0]},{NN,3,15}]; ff10miexp=Table[{NN,aexpBin77[1,0]-delaexpBin77[1,0]},{NN,3,15}];
*)
 (*-------*)
(* Now the same, but from global tFO: *)
(*
 Tab20D0tFOavar=Table[{NN,aatFO[2,0,aALftFO[NN]][NN,0,0]},{NN,3,12}];
 (* Tab20tFOavar=Table[{NN,aatFO[2,0,aALftFO[NN]][NN,O4tFO[NN],O6tFO[NN]]},{NN,3,12}];*)   Tab20tFOavar=Table[{NN, Tab20D0tFOavar[[NN - 2]][[2]] + ((0 + 3)/(0 + 1)) 2 Pi^2 (-1)^0 ((0 + 2) O4tFO[NN]/sigmax^(0 + 2) + (0 + 1) O6tFO[NN]/sigmax^(0 + 3))}, {NN, 3, 12}];
 delTab20tFOavar= Table[{Nn, Tab20tFOavar[[Nn - 2]][[2]] - Tab20tFOavar[[Nn - 3]][[2]]}, {Nn, 4, 12}];
 Tab21D0tFOavar=Table[{NN,aatFO[2,1,aALftFO[NN]][NN,0,0]},{NN,3,12}]; 
 (* Tab21tFOavar=Table[{NN,aatFO[2,1,aALftFO[NN]][NN,O6tFO[NN],O8tFO[NN]]},{NN,3,12}];*)
 Tab21tFOavar=Table[{NN, Tab21D0tFOavar[[NN - 2]][[2]] + ((1 + 3)/(1 + 1)) 2 Pi^2 (-1)^1 ((1 + 2) O6tFO[NN]/sigmax^(1 + 2) + (1 + 1) O8tFO[NN]/sigmax^(1 + 3))}, {NN, 3, 12}];
delTab21tFOavar= Table[{Nn, Tab21tFOavar[[Nn - 2]][[2]] - Tab21tFOavar[[Nn - 3]][[2]]}, {Nn, 4, 12}];
Tab10D0tFOavar=Table[{NN,aatFO[1, 0, aALftFO[NN]][NN, 0]},{NN,3,12}];
Tab10tFOavar=Table[{NN,Tab10D0tFOavar[[NN - 2]][[2]] + ((0+2)/(0+1)) 2 Pi^2 (-1)^0 O4tFO[NN]/sigmax^(0 + 2)}, {NN, 3, 12}];
delTab10tFOavar= Table[{Nn, Tab10tFOavar[[Nn - 2]][[2]] - Tab10tFOavar[[Nn - 3]][[2]]}, {Nn, 4, 12}];
 *)    
  (*-------*)   
(*
 (* global FO: a21, a20, a10: *)
 a20FOavar=ListPlot[{Tab20D0FOavar, Tab20FOavar, ff20exp, ff20miexp, ff20plexp}, PlotRange -> {{2.8, 15.2}, {0.205, 0.35}}, PlotStyle -> {Black, Red, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "FO:" Superscript[(a), "(2,0)"]},Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.85}]]}]
 a21FOavar=ListPlot[{Tab21D0FOavar, Tab21FOavar, ff21exp, ff21miexp, ff21plexp}, PlotRange -> {{2.8, 15.2}, {0.20, 0.24}}, PlotStyle -> {Black, Red, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "FO:" Superscript[a, "(2,1)"]},Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.85}]]}]
 a20FOavarZoom =ListPlot[{Tab20D0FOavar, Tab20FOavar, ff20exp, ff20miexp, ff20plexp},PlotRange -> {{2.8, 12.2}, {0.235, 0.250}}, PlotStyle -> {Black, Red, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "FO:" Superscript[a, "(2,0)"]},Epilog -> {Inset[Style["(b)", 13], Scaled[{0.20, 0.85}]]}]
a21FOavarZoom=ListPlot[{Tab21D0FOavar, Tab21FOavar, ff21exp, ff21miexp, ff21plexp}, PlotRange -> {{2.8, 12.2}, {0.20, 0.215}}, PlotStyle -> {Black, Red, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "FO:" Superscript[a, "(2,1)"]},Epilog -> {Inset[Style["(b)", 13], Scaled[{0.20, 0.85}]]}]
a10FOavar=ListPlot[{Tab10D0FOavar, Tab10FOavar, ff10exp, ff10miexp, ff10plexp}, PlotRange -> {{2.8, 15.2}, {0.18, 0.30}}, PlotStyle -> {Black, Red, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "FO:" Superscript[(a), "(1,0)"]},Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.85}]]}]
 a10FOavarZoom= ListPlot[{Tab10D0FOavar, Tab10FOavar, ff10exp, ff10miexp, ff10plexp}, PlotRange -> {{2.8, 12.2}, {0.195, 0.215}}, PlotStyle -> {Black, Red, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "FO:" Superscript[(a), "(1,0)"]}, Epilog -> {Inset[Style["(b)", 13], Scaled[{0.20, 0.85}]]}]
 *)
    (* Export["a20FOavar.pdf",a20FOavar]; Export["a21FOavar.pdf",a21FOavar]; Export["a10FOavar.pdf",a10FOavar];  Export["a20FOavarZ.pdf",a20FOavarZoom]; Export["a21FOavarZ.pdf",a21FOavarZoom]; Export["a10FOavarZ.pdf",a10FOavarZoom]; *)
(* global FO: a21 and a20 suggest that Nt=8 (marginally also Nt=9) is the most reasonable truncation (in this global FO fit approach), because the difference from Nt=7 to B=Nt=8 has the smallest absolute value; the same is true for a10; therefore, we will take Nt=8 in the FO global fit approach *)			     
    (*----*)
(*
 (* global tFO: a21, a20, a10: *)
a20tFOavar= ListPlot[{Tab20D0tFOavar, Tab20tFOavar, ff20exp, ff20miexp, ff20plexp}, PlotRange -> {{2.8, 12.2}, {0.20, 0.500}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "tFO:" Superscript[a, "(2,0)"]}, Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.85}]]}]
a20tFOavarZoom= ListPlot[{Tab20D0tFOavar, Tab20tFOavar, ff20exp, ff20miexp, ff20plexp}, PlotRange -> {{2.8, 12.2}, {0.235, 0.250}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black,PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "tFO:" Superscript[a, "(2,0)"]}, Epilog -> {Inset[Style["(b)", 13], Scaled[{0.20, 0.85}]]}]
a21tFOavar= ListPlot[{Tab21D0tFOavar, Tab21tFOavar, ff21exp, ff21miexp, ff21plexp}, PlotRange -> {{2.8, 12.2}, {0.15, 0.235}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "tFO:" Superscript[a, "(2,1)"]}, Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.85}]]}]
a21tFOavarZoom= ListPlot[{Tab21D0tFOavar, Tab21tFOavar, ff21exp, ff21miexp, ff21plexp}, PlotRange -> {{2.8, 12.2}, {0.20, 0.215}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "tFO:" Superscript[a, "(2,1)"]}, Epilog -> {Inset[Style["(b)", 13], Scaled[{0.20, 0.85}]]}]  
a10tFOavar= ListPlot[{Tab10D0tFOavar, Tab10tFOavar, ff10exp, ff10miexp, ff10plexp}, PlotRange -> {{2.8, 12.2}, {0.175, 0.285}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black,PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "tFO:" Superscript[(a), "(1,0)"]}, Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.85}]]}]
a10tFOavarZoom= ListPlot[{Tab10D0tFOavar, Tab10tFOavar, ff10exp, ff10miexp, ff10plexp}, PlotRange -> {{2.8, 12.2}, {0.195, 0.215}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black,PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "tFO:" Superscript[(a), "(1,0)"]}, Epilog -> {Inset[Style["(b)", 13], Scaled[{0.20, 0.85}]]}]
  *)
 (* global tFO: a21 and a20 suggest that Nt=6 (also Nt=7) is the most reasonable truncation (in this global tFO fit approach), because at Nt=6 we have local maximum (plateau at 6 =< Nt =< 7); the same is true for a10; therefore, we will take Nt=6 in the FO global fit approach *)
 (*----------*)
(* When aALf=a(sigmax)=0.104857 is fixed ('a105', 'af', as obtained from the a^{(2,5}} approach) ), i.e.,using O4O6O8fitPFOMinnum[N] (N=3,4,...15): *)
(* Tab20D0FOa105=Table[{NN,aaFOfast[2,0,aALfFOaf[NN]][NN,0,0]},{NN,3,15}];
(*Tab20FOa105=Table[{NN,aaFOfast[2,0,aALfFOaf[NN]][NN,O4FOaf[NN],O6FOaf[NN]]},{NN,3,15}];*) 
 Tab20FOa105=Table[{NN, Tab20D0FOa105[[NN - 2]][[2]] + ((0 + 3)/(0 + 1)) 2 Pi^2 (-1)^0 ((0 + 2) O4FOaf[NN]/sigmax^(0 + 2) + (0 + 1) O6FOaf[NN]/sigmax^(0 + 3))}, {NN, 3, 15}]; delTab20FOa105= Table[{Nn, Tab20FOa105[[Nn - 2]][[2]] - Tab20FOa105[[Nn - 3]][[2]]}, {Nn, 4, 15}];
Tab21D0FOa105=Table[{NN,aaFOfast[2,1,aALfFOaf[NN]][NN,0,0]},{NN,3,15}]; 
(*Tab21FOa105=Table[{NN,aaFOfast[2,1,aALfFOaf[NN]][NN,O6FOaf[NN],O8FOaf[NN]]},{NN,3,15}];*)
Tab21FOa105=Table[{NN, Tab21D0FOa105[[NN - 2]][[2]] + ((1 + 3)/(1 + 1)) 2 Pi^2 (-1)^1 ((1 + 2) O6FOaf[NN]/sigmax^(1 + 2) + (1 + 1) O8FOaf[NN]/sigmax^(1 + 3))}, {NN, 3, 15}]; delTab21FOa105= Table[{Nn, Tab21FOa105[[Nn - 2]][[2]] - Tab21FOa105[[Nn - 3]][[2]]}, {Nn, 4, 15}]; *)
 (*  Tab10D0FOa105=Table[{NN,aaFOfast[1, 0, aALfFOaf[NN]][NN, 0]},{NN,3,15}];
 Tab10FOa105=Table[{NN,Tab10D0FOa105[[NN - 2]][[2]] + ((0+2)/(0+1)) 2 Pi^2 (-1)^0 O4FOaf[NN]/sigmax^(0 + 2)}, {NN, 3, 15}];  delTab10FOa105= Table[{Nn, Tab10FOa105[[Nn - 2]][[2]] - Tab10FOa105[[Nn - 3]][[2]]}, {Nn, 4, 15}]; *)
 (* |delTab20FOa105| and are |delTab21FOa105| the smalles for Nt=7; |delTab10FOa105| is the smallest for Nt=6; *)
 
(*
a20FOa105 = ListPlot[{Tab20D0FOa105, Tab20FOa105, ff20exp, ff20miexp, ff20plexp},PlotRange -> {{2.8, 15.2}, {0.205, 0.35}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black,PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "FO:" Superscript[a, "(2,0)"]}, Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.85}]], Inset[Style[Subscript[\[Alpha], s][Subscript[\[Sigma], max]]/\[Pi] == Round[10000 aAL]/10000., 12], Scaled[{0.8, 0.5}]]}]
a21FOa105=ListPlot[{Tab21D0FOa105, Tab21FOa105, ff21exp, ff21miexp, ff21plexp}, PlotRange -> {{2.8, 15.2}, {0.19, 0.24}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "FO:" Superscript[a, "(2,1)"]}, Epilog -> {Inset[Style["(a)", 13], Scaled[{0.15, 0.90}]], Inset[Style[Subscript[\[Alpha], s][Subscript[\[Sigma], max]]/\[Pi] == Round[10000 aAL]/10000., 12], Scaled[{0.8, 0.55}]]}]

 a20FOa105Zoom=ListPlot[{Tab20D0FOa105, Tab20FOa105, ff20exp, ff20miexp, ff20plexp}, PlotRange -> {{2.8, 12.2}, {0.235, 0.250}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "FO:" Superscript[a, "(2,0)"]}, Epilog -> {Inset[Style["(b)", 13], Scaled[{0.20, 0.85}]], Inset[Style[Subscript[\[Alpha], s][Subscript[\[Sigma], max]]/\[Pi] == Round[10000 aAL]/10000., 12], Scaled[{0.8, 0.8}]]}]
a21FOa105Zoom=ListPlot[{Tab21D0FOa105, Tab21FOa105, ff21exp, ff21miexp, ff21plexp}, PlotRange -> {{2.8, 12.2}, {0.200, 0.215}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "FO:" Superscript[a, "(2,1)"]}, Epilog -> {Inset[Style["(b)", 13], Scaled[{0.15, 0.90}]], Inset[Style[Subscript[\[Alpha], s][Subscript[\[Sigma], max]]/\[Pi] == Round[10000 aAL]/10000., 12], Scaled[{0.8, 0.18}]]}]
 *)
  
 (*
a10FOa105 = ListPlot[{Tab10D0FOa105, Tab10FOa105, ff10exp, ff10miexp, ff10plexp},PlotRange -> {{2.8, 15.2}, {0.18, 0.30}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black,PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "FO:" Superscript[a, "(1,0)"]}, Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.85}]], Inset[Style[Subscript[\[Alpha], s][Subscript[\[Sigma], max]]/\[Pi] == Round[10000 aAL]/10000., 12], Scaled[{0.22, 0.65}]]}]
 a10FOa105Zoom=ListPlot[{Tab10D0FOa105, Tab10FOa105, ff10exp, ff10miexp, ff10plexp}, PlotRange -> {{2.8, 12.2}, {0.195, 0.215}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {Subscript[N,t], "FO:" Superscript[a, "(1,0)"]}, Epilog -> {Inset[Style["(b)", 13], Scaled[{0.20, 0.85}]], Inset[Style[Subscript[\[Alpha], s][Subscript[\[Sigma], max]]/\[Pi] == Round[10000 aAL]/10000., 12], Scaled[{0.8, 0.2}]]}]
 *) 

 (* Note, when aALf = aAL (=0.104857) is FIXED (a105), then the red points in the above ListPlots represent somewhat weaker stabilization then in the case when aALF is varied (avar) *)
 (*---------------------------------------*)
 (* global FO: The above behaviour of a^{(2,1)}(aAL,O6,O8) and a^{(2,0)}(aAL,O4,O6) suggests that the truncation order Nt in the FO global approach (i.e., the approach of minimization with alpha_s variable) is Nt=8. *)

 
 (* Now the estimate of experimental uncertainty in this global approach with double-pinched FO Borel-Laplace (with Nt=8): *)

(* VBBexp[Mal2,Mbe2]= < (ReB[Mal2]-<ReB[Mbe2]>) (ReB[Mal2]-<ReB[Mbe2]>) > *)
 VBBexpFAux[Mal2_,Mbe2_]:=(2 Pi^2)^2 Sum[(1-sbin[[ii]]/sigmax)^2 (1-sbin[[jj]]/sigmax)^2 Re[Exp[-sbin[[ii]]/Mal2]/(Mal2)] Re[Exp[-sbin[[jj]]/Mbe2]/(Mbe2)]  dsbin[[ii]] dsbin[[jj]] (  covVV[ii,jj]+covAA[ii,jj]+covVA[ii,jj] + covAV[ii,jj]),{ii,1,NNAL},{jj,1,NNAL}];
(* Note: VBBexpFAux[M2,M2] = delReBPexpBinAL[M2]^2, as it should be *)
(* Further, automatically we have: VBBexpFAux[Mal2,Mbe2]=VBBexpFAux[Mbe2,Mal2] *)
(* VBBexpF[Mal2_,Mbe2_]:=If[Mal2<=Mbe2,VBBexpFAux[Psi,Mal2,Mbe2],VBBexpFAux[Psi,Mbe2,Mal2]]; this is probably not necessary; anyway, mal2, Mbe2 will be complex in general *)

(* Number of equidistant points Nm in the interval 0.9 =< |M^2| =< 1.5 GeV^2: *)
Nm=2; Nd=3 Nm;  
M2cov1F[ii_]:=0.90+(ii-1)*0.60/(Nm-1); (* ii=1,..,Nm; this gives M2covF[1]=0.90, ... M2covF[Nm]=1.5 *)
Do[M2covF[jj]=M2cov1F[jj],{jj,1,Nm}]; Do[M2covF[jj+Nm]=M2cov1F[jj] Exp[I Pi/6],{jj,1,Nm}]; Do[M2covF[jj+2 Nm]=M2cov1F[jj] Exp[I Pi/4],{jj,1,Nm}]; (* in this way we have 3 Nm=Nd points M^2 in the complex M^2-plane, three with Psi=0, three with Psi=Pi/6, and three with Psi=Pi/4 *)

(* For delO4 perhaps only Psi=Pi/6 points: Nm=2; Nd=Nm;  M2cov1F[ii_]:=0.90+(ii-1)*0.60/(Nm-1); Do[M2covF[jj]=M2cov1F[jj] Exp[I Pi/6],{jj,1,Nm}];  *)
(* Or Psi=0 & Pi/6: Nm=2; Nd=4; M2cov1F[ii_]:=0.90+(ii-1)*0.60/(Nm-1); Do[M2covF[jj]=M2cov1F[jj],{jj,1,Nm}]; Do[M2covF[jj+Nm]=M2cov1F[jj] Exp[I Pi/6],{jj,1,Nm}]; *)
(* or all Psi=0, Pi/6, Pi/4, but only with one (middle) point for each Psi: Nd=3; M2covF[1]=(0.9+1.5)/2;  M2covF[2]=M2covF[1] Exp[I Pi/6]; M2covF[3]=M2covF[1] Exp[I Pi/4]; *)

 
VBBexpMatr=Table[If[ii<=jj,VBBexpFAux[M2covF[ii],M2covF[jj]],VBBexpFAux[M2covF[jj],M2covF[ii]]],{ii,1,Nd},{jj,1,Nd}];
(* With such construction we ensure that VBBexpMatrPsi is exactly symmetric, as it should be; this allows then for a more stable investion of the matrix *)
VBBexpMatrRes=10^14 VBBexpMatr;
(* NOte, for Nd=9: 10^6 VBBexpMatr has all elements ~1, but Det[10^6 VBBexpMatr]=
 -1.55766*10^-62, practically zero, a degenerate system; *)

(* VBBexpMatr[[i,j]] = VBBexpF[M2covF[ii],M2covF[jj]], this is the Nd x Nd covariance matrix for Re BTs *)

IVBBexpMatrRes= LinearSolve[VBBexpMatrRes, IdentityMatrix[Nd]];
IVBBexpMatr=10^14 IVBBexpMatrRes;
(* IVBBexpMatr[[i,j]] is inverse of the ReBT-covariance matrix, NdxNd matrix again, for BTs *)

(* Instabilities in the Nd=9 case: IVBBexpMatr.VBBexpMatr not=IdentityMatrix[Nd] (some elements are ~10^-5-10^-4) and Det[VBBexpMatr]=app 3 10^-60 very small; however, when Nd=3, then IVBBexpMatr.VBBexpMatr=IdentityMatrix[Nd] to ~10^12 precision;  *)  
(*---*)
 (* Now estimation of delO4 with the (NdxNd) covariance matrix  ('varcov')
  (and using FO Nt=5 global analysis for theoretical values): *)
Nt0=8;
chi2o3O4[O4f_]:=Sum[(ReBPFOfast[M2covF[jj],Nt0,aALfFO[Nt0],O4f,O6FO[Nt0],O8FO[Nt0]] - ReBPexpBinAL[M2covF[jj]]) IVBBexpMatr[[jj,kk]] (ReBPFOfast[M2covF[kk],Nt0,aALfFO[Nt0],O4f,O6FO[Nt0],O8FO[Nt0]] - ReBPexpBinAL[M2covF[kk]]),{jj,1,Nd},{kk,1,Nd}];
O4FOvarcovfitMin=FindMinimum[chi2o3O4[O4fitf],{O4fitf,O4FO[Nt0]+0.0001}];
O4FOvarcovfit=O4fitf/.O4FOvarcovfitMin[[2]];
Xi2O4FOvarcovo77=O4FOvarcovfitMin[[1]]; 
 delO4FOcovpl= delO4f/.FindRoot[chi2o3O4[O4FOvarcovfit+delO4f]==Xi2FOvarcovo77+1,{delO4f, 1.6 10^-6}];
 delO4FOcovmi= delO4f/.FindRoot[chi2o3O4[O4FOvarcovfit+delO4f]==Xi2FOvarcovo77+1,{delO4f, -1.6 10^-6}];
delO4FOcov=Max[Abs[delO4FOcovpl],Abs[delO4FOcovmi]];
(* for Nm=2 (Nd=6) we get delO4FOcov =app 1.6*10^-6; for Nm=3 (Nd=6), but possible instabilities *)
(* For Nd=3  (or all Psi=0, Pi/6, Pi/4, but only with one (middle) point for each Psi: Nd=3; M2covF[1]=(0.9+1.5)/2;  M2covF[2]=M2covF[1] Exp[I Pi/6]; M2covF[3]=M2covF[1] Exp[I Pi/4]): delO4FOcov =app 6.2 10^-6; so, rather unstable (increased) result when Nd=9 -> Nd=3 *)

(* Now vary O4 in UNCORRELATED chi ('var'): *)
(* Note: VBBexpFAux[M2,M2] = delReBPexpBinAL[M2]^2, as it should be *)
Nt0=8;
chi2o2O4[O4f_]:=Sum[(ReBPFOfast[M2covF[jj],Nt0,aALfFO[Nt0],O4f,O6FO[Nt0],O8FO[Nt0]] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
O4FOvarfitMin=FindMinimum[chi2o2O4[O4fitf],{O4fitf,O4FO[Nt0]}];
O4FOvarfit=O4fitf/.O4FOvarfitMin[[2]];
Xi2O4FOvaro77=O4FOvarfitMin[[1]];                       
 delO4FO= delO4f/.FindRoot[chi2o2O4[O4FOvarfit+delO4f]==Xi2O4FOvaro77+1,{delO4f, 3. 10^-5}];
(* --> for Nm=2 (Nd=6) we obtain: delO4FO=0.0000304; note that O4FO[5]=-0.00277561, by global analysis *)
(* --> for Nm=2 & Nd=2 (and Psi=Pi/6 only), we obtain:  delO4FOcov=0.0000404 and delO4FO=0.0000566 (Psi=0 is not included, should be) *)
(* --> for Nm=2 & Nd=4 (Psi=0 and Pi/6):delO4FOcov=4.39*10^-6; delO4FO=0.00003147 *)
(* --> for Nd=3 (|M^2|=1.2; Psi=0, Pi/6, Pi/4): delO4FOcov =app 6.2*10^-6; delO4FO=0.0000461 *)
(* I will take uncorrelated uncertainty,  Nm=2 (Nd=6) delO4FO=0.0000304, to avoid possible subestimations (the correlated method gives very small uncertainties) *)

chi2o2O6[O6f_]:=Sum[(ReBPFOfast[M2covF[jj],Nt0,aALfFO[Nt0],O4FO[Nt0],O6f,O8FO[Nt0]] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
O6FOvarfitMin=FindMinimum[chi2o2O6[O6fitf],{O6fitf,O6FO[Nt0]}];
O6FOvarfit=O6fitf/.O6FOvarfitMin[[2]];
Xi2O6FOvaro77=O6FOvarfitMin[[1]];
 delO6FO= delO6f/.FindRoot[chi2o2O6[O6FOvarfit+delO6f]==Xi2O6FOvaro77+1,{delO6f, 3. 10^-5}];
(* Nm=2; Nd=6; delO6FO=0.0000451; *)

chi2o2O8[O8f_]:=Sum[(ReBPFOfast[M2covF[jj],Nt0,aALfFO[Nt0],O4FO[Nt0],O6FO[Nt0],O8f] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
O8FOvarfitMin=FindMinimum[chi2o2O8[O8fitf],{O8fitf,O8FO[Nt0]}];
O8FOvarfit=O8fitf/.O8FOvarfitMin[[2]];
Xi2O8FOvaro77=O8FOvarfitMin[[1]];
 delO8FO= delO8f/.FindRoot[chi2o2O8[O8FOvarfit+delO8f]==Xi2O8FOvaro77+1,{delO8f, 3. 10^-5}];
(* Nm=2; Nd=6; delO8FO=0.0000809; *)

chi2o2aAL[aALf_]:=Sum[(ReBPFOfast[M2covF[jj],Nt0,aALf,O4FO[Nt0],O6FO[Nt0],O8FO[Nt0]] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
aALFOvarfitMin=FindMinimum[chi2o2aAL[aALfitf],{aALfitf,aALfFO[Nt0]}];
aALFOvarfit=aALfitf/.aALFOvarfitMin[[2]];
Xi2aALFOvaro77=aALFOvarfitMin[[1]];
 delaALFO= delaALf/.FindRoot[chi2o2aAL[aALFOvarfit+delaALf]==Xi2aALFOvaro77+1,{delaALf, 3. 10^-5}];
(* Nm=2; Nd=6; Nt=8; delaALFO=0.000102 *)
(*-------*)
(* Together, the estimates of EXPERIMENTAL uncertainties in the FO global approach (with Nt=6) are (Nm=2; Nd=6), FO global:  *)
(* delO4FO= 0.000030; delO6FO=0.000045; delO8FO=0.000081; delaALFO=0.000102(=delta(a(sigmax))) *)
(* --> alpha_s(mtau^2)=0.307509+{^{+0.000296}_{-0.000296}}_{exp}; *)
(* 10^3 O4=-2.8+{^{+0.1}_{-0.0}}_{exp}; 10^3 O6=+2.1+{{+0.0}_{-0.1}}_{exp}; 10^3 O8=-0.8+{^{+0.1}_{-0.0}}_{exp}; *)
 (* 10^3 aGG= 6 (10^3 O4 + 10^3 ddel)=-14.7+{^{+0.2}_{-0.1}}_{exp}; *)

(* The precise central value result of the FO global fit:
 alO4O6O8fitPFOMinnum[8]={0.004287816184596373`, {aALf -> 0.10122255774076128`, O4fitf -> -0.0027756129809026844`, O6fitf -> 0.002062451844738742`, O8fitf -> -0.0007675526757783264`}}; *)

(* Variation of kappa, FO global: *)
(* kappa=2.0: *)
(* alO4O6O8fitPFOMinnum[8]={0.00267042, {aALf -> 0.085654, O4fitf -> -0.00168573, O6fitf -> 0.0015817, O8fitf -> -0.000606323}}; *)
(* kappa=1.0 (the central case of the global fit): *)
(* alO4O6O8fitPFOMinnum[8]={0.00428782, {aALf -> 0.101223, O4fitf -> -0.00277561, O6fitf -> 0.00206245, O8fitf -> -0.000767553}}; *)
(* kappa=0.5: *)
(* alO4O6O8fitPFOMinnum[8]={0.00565586, {aALf -> 0.124784, O4fitf -> -0.00465536, O6fitf -> 0.00265869, O8fitf -> -0.000932575}}; *)
(* Note that aALf=a(kappa*sigmax) *)
(* --> thus the variations: *)
(* alpha_s(mtau^2)=0.307509 + {^{+0.003560}_{-0.004360}}_{del kappa} *)
(* 10^3 O4=-2.8+{^{+1.1}_{-1.9}}_{del kappa}; 10^3 O6=2.1+{{-0.5}_{+0.6}}_{del kappa}; 10^3 O8=-0.8+{^{+0.2}_{-0.1}}_{delta kappa}; *)
(* 10^3 aGG= 6 (10^3 O4 + 10^3 ddel)=-14.7+{^{+6.6}_{-11.2}}_{del kappa}; *)

(* Variation of d4, FO global (note, now: Nt=5, not Nt=8): *)
(* d4=2 338.19 (tddtk[4,tkap]=37.77+338.19): *)
(* alO4O6O8fitPFOMinnum[5]={0.000845737, {aALf -> 0.102247509, O4fitf -> -0.000379651, O6fitf -> 0.000921817, O8fitf -> -0.00037025}}; *)
(* d4=338.19;  (tddtk[4,tkap]=37.77) (the central case of the global fit): *)
(* alO4O6O8fitPFOMinnum[5]={0.001214495, {aALf -> 0.103309303, O4fitf -> -0.000505641, O6fitf -> 0.00101641, O8fitf -> -0.000411327}}; *)
(* d4=0 (tddtk[4,tkap]=37.77-338.19): *)
(* alO4O6O8fitPFOMinnum[5]={0.00171109, {aALf -> 0.104473648,   O4fitf -> -0.00064827, O6fitf -> 0.00112337, O8fitf -> -0.000457745}}; *)
(* --> thus the variations: *)
(* alpha_s(mtau^2)=0.313575+{^{-0.003085}_{+0.003379}}_{del d4}; *)
(* 10^3 O4=-0.5+{^{+0.1}_{-0.1}}_{del d4}; 10^3 O6= +1.0+{{-0.1}_{+0.1}}_{del d4}; 10^3 O8=-0.4+{^{+0.0}_{-0.1}}_{del d4}; *)
(* 10^3 aGG= 6 (10^3 O4 + 10^3 ddel)=-1.0+{^{+0.7}_{-0.9}}_{del d4}; *)

(* Variation of Nt(truncation order, Nt=5+-1), FO global: *)
(* Nt=9: *)
(* alO4O6O8fitPFOMinnum[9]={0.00508361, {aALf -> 0.100646096, O4fitf -> -0.00366715, O6fitf -> 0.00234326, O8fitf -> -0.000848704}}; *)
(* Nt=8 (the central case): *)
(* alO4O6O8fitPFOMinnum[8]={0.00428782, {aALf -> 0.101222558, O4fitf -> -0.00277561, O6fitf -> 0.00206245, O8fitf -> -0.000767553}}; *)
    (* Nt=7: *)
(* alO4O6O8fitPFOMinnum[7]={0.00354388, {aALf -> 0.101838932, O4fitf -> -0.00200965, O6fitf -> 0.00177841, O8fitf -> -0.00068144}}; *)
(* alpha_s(mtau^2)=0.307509+{^{-0.001678}_{+0.001793}}_{del Nt} *)
(* 10^3 O4=-2.8+{^{-0.9}_{+0.8}}_{del Nt}; 10^3 O6= +2.1+{{+0.2}_{-0.3}}_{del Nt}; 10^3 O8=-0.8+{^{-0.0}_{+0.1}}_{del Nt}; *)
 (* 10^3 aGG= 6 (10^3 O4 + 10^3 ddel)=-14.7+{^{-5.3}_{+4.6}}_{del Nt}; *)
(*-----------------------------------------*)
(* Altogether, the FO global fit approach gives: *)
(* Nt=8; *)
(*
 alpha_s(mtau^2)=0.307509 + {^{+0.000296}_{-0.000296}}_{exp} +  {^{+0.003560}_{-0.004360}}_{del kappa} + {^{-0.003085}_{+0.003379}}_{del d4} + {^{-0.001678}_{+0.001793}}_{del Nt} = 0.307509 + {^{+0.005234}_{-0.005606}}  =app 0.3075 + {^{+0.0052}_{-0.0056}} =app 0.308 + {^{+0.005}_{-0.006};
10^3 aGG=-14.7 + {^{+0.2}_{-0.1}}_{exp} + {^{+6.6}_{-11.2}}_{del kappa} + {^{+0.7}_{-0.9}}_{del d4} + {^{-5.3}_{+4.6}}_{del Nt} = -14.7 + {^{+8.1}_{-12.4}} =app -15 + {^{+8}_{-12}};
10^3 O4= -2.8 + {^{+0.1}_{-0.0}}_{exp} + {^{+1.1}_{-1.9}}_{kappa} + {^{+0.1}_{-0.1}}_{del d4} + {^{-0.9}_{+0.8}}_{del Nt} = -2.8 + {^{+1.4}_{-2.1}}; 
10^3 O6= +2.1 + {{+0.0}_{-0.1}}_{exp} + {{-0.5}_{+0.6}}_{kappa} + {{-0.1}_{+0.1}}_{d4} + {{+0.2}_{-0.3}}_{del Nt} = +2.1 + {^{+0.6}_{-0.6}};
10^3 O8=-0.8 + {^{+0.1}_{-0.0}}_{exp} + {^{+0.2}_{-0.1}}_{delta kappa} + {^{+0.0}_{-0.1}}_{del d4} + {^{-0.0}_{+0.1}}_{del Nt} = -0.8 + {^{+0.2}_{-0.1}};
*)
 (* Checked twice *) 

(* End of FO global fit results *)
(*------------------------------------*)
(*------------------------------------*) 
 (* Now the FO approach based on a^{(2,5)}([Nt,FO])_{D=0}: *)
 
(* Note: aaFOD0fast[2,1,aALf][NN]=rtauFOD0fast[NN], as it should be *)
(* taba25[aALf_]:= Table[{nn, aaFOD0fast[2, 5,aALf][nn]}, {nn, 3, 15}]; ListPlot[taba25] *)
(* deltab25[aALf_]:=Table[{nn, taba25[[nn-2,aALf]][[2]]-taba25[aALf][[nn-3]][[2]]}, {nn, 4, 15}]; *)
 (*--------*)
 nn0= 5;  (* This is the case a^{(2,nn0)}(sigmax) *)
 solaALFOc[2,nn0][Nn_]:=FindRoot[ aaFOD0fast[2,nn0,aALf][Nn]==aexpBin77[2,nn0],{aALf,0.1}];
 Clear[aALFOc]; aALFOc[2,nn0][Nn_]:=aALf/.solaALFOc[2,nn0][Nn];
 Clear[alsmtauFO]; alsmtauFO[2,nn0][Nn_]:=aMSext[mtauphys^2/(kappa sigmax),aALFOc[2,nn0][Nn]] Pi;
 (* alsmtauFO=alpha_s(mtau^2;MSbar) such that the a^{(2,nn0}} theoretical moment (in FO with D=0) with Nn truncation reproduces the experimental value moment aexpBin77[2,5] *)

solaALFOp[2, nn0][Nn_] := FindRoot[aaFOD0fast[2, nn0, aALf][Nn] == aexpBin77[2, nn0] + delaexpBin77[2, nn0], {aALf, 0.1}]; aALFOp[2, nn0][Nn_] := aALf /. solaALFOp[2, nn0][Nn]; alsmtauFOp[2, nn0][Nn_] := aMSext[mtauphys^2/(kappa sigmax), aALFOp[2, nn0][Nn]] Pi;
solaALFOn[2, nn0][Nn_] := FindRoot[aaFOD0fast[2, nn0, aALf][Nn] == aexpBin77[2, nn0] - delaexpBin77[2, nn0], {aALf, 0.1}]; aALFOn[2, nn0][Nn_] := aALf /. solaALFOn[2, nn0][Nn]; alsmtauFOn[2, nn0][Nn_] := aMSext[mtauphys^2/(kappa sigmax), aALFOn[2, nn0][Nn]] Pi;

 (* kappa=1: *)
 (* alsmtauFO[2, 5][4]=0.319837 *)
 (* alsmtauFO[2,5][5]=0.318600 (^0.00390386 _-0.00396467)_exp *)
 (* alsmtauFO[2,5][6]=0.318064 (^+0.00387 _-0.00393)_exp *) (* alsmtauFO[2,5][6]=0.104857 *)
 (* alsmtauFO[2, 5][7]=0.317125 *)
 (* alsmtauFO[2, 5][8]=0.315716 *)
 (* alsmtauFO[2, 5][9]=0.314448 *)
 (* alsmtauFO[2, 5][10]=0.313554 *)
(* alsmtauFO[2, 5][11]=0.313946 *)
(* alsmtauFO[2, 5][12]=0.314344 *)
(* alsmtauFO[2, 5][13]=0.317427 *)
(* alsmtauFO[2, 5][14]=0.312701 *)

 (* note: alpha_s(MZ^2;MSbar)=0.1179 (world average) -> alpha_s(mtau^2,MSbar;nf=3)=0.313631 *)
 
 (* tabalsmtauFO = Table[{Nn, alsmtauFO[2, 5][Nn]}, {Nn, 4, 14}]; ListPlot[tabalsmtauFO] *)
 (* tabdelalsmtauFO=Table[{Nn, alsmtauFO[2, 5][Nn] - alsmtauFO[2, 5][Nn - 1]}, {Nn, 5, 14}]={{5, -0.00123708}, {6, -0.000535431}, {7, -0.00093982}, {8, -0.00140899}, {9, -0.00126756}, {10, -0.00089408}, {11, 0.000392355}, {12, 0.000397859}, {13, 0.00308321}, {14, -0.00472627}}; ListPlot[tabdelalsmtauFO] *)

 (* If alsmtauFO is taken fixed: alsmtauFO=0.318064 (-> a(sigmax)=aALFO=0.104857 (=aALFOc[2, 5][6])): *)
 (* Taba25FOvsNn = Table[{Nn, aaFOD0fast[2, 5, aALFOc[2, 5][6]][Nn]}, {Nn, 4, 15}]; ListPlot[Taba25FOvsNn]; Tabdela25FOvsNn=Table[{Nn, Taba25FOvsNn[[Nn - 3]][[2]] - Taba25FOvsNn[[Nn - 4]][[2]]}, {Nn, 5,15}]; ListPlot[Tabdela25FOvsNn];
ff25exp=Table[{NN,aexpBin77[2,5]},{NN,4,15}];  ff25plexp=Table[{NN,aexpBin77[2,5]+delaexpBin77[2,5]},{NN,4,15}]; ff25miexp=Table[{NN,aexpBin77[2,5]-delaexpBin77[2,5]},{NN,4,15}];
Taba25FOvsNnIR2= Table[{Nn, aaFOD0fastIR2[2, 5, aALFOc[2, 5][6]][Nn]}, {Nn, 4, 15}]; Taba25FOvsNnIR3= Table[{Nn, aaFOD0fastIR3[2, 5, aALFOc[2, 5][6]][Nn]}, {Nn, 4, 15}]; Taba25FOvsNnUV1= Table[{Nn, aaFOD0fastUV1[2, 5, aALFOc[2, 5][6]][Nn]}, {Nn, 4, 15}];
a25FOavar= ListPlot[{Taba25FOvsNn, ff25exp, ff25miexp, ff25plexp}, PlotRange -> {{3.8, 15.2}, {0.17, 0.190}}, PlotStyle -> {Black, {Blue, PointSize[0.003]}, {Blue, PointSize[0.003]}, {Blue, PointSize[0.003]}}, Filling -> {3 -> {4}}, AxesLabel -> {Style[Subscript[N, t], 13], "FO:" Style[Superscript[a, "(2,5)"], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtauFO[2, 5][6] 10000]/10000., 12], Scaled[{0.30, 0.15}]]}];
a25FOavarIR2= ListPlot[{Taba25FOvsNnIR2}, PlotRange -> {{3.8, 15.2}, {0.31, 0.322}}, PlotStyle -> Black, AxesLabel -> {Style[Subscript[N, t], 13], "FO:" Style[Superscript[a, "(2,5)"], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtauFO[2, 5][6] 10000]/10000., 12], Scaled[{0.30, 0.15}]]}];
a25FOavarIR3= ListPlot[Taba25FOvsNnIR3, PlotRange -> {{3.8, 15.2}, {-0.14, -0.12}},PlotStyle -> Black, AxesLabel -> {Style[Subscript[N, t], 13], "FO:" Style[Superscript[a, "(2,5)"], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtauFO[2, 5][6] 10000]/10000., 12], Scaled[{0.30, 0.15}]]}];
a25FOavarUV1= ListPlot[Taba25FOvsNnUV1, PlotRange -> {{3.8, 15.2}, {-0.02, 0.002}}, PlotStyle -> Black, AxesLabel -> {Style[Subscript[N, t], 13], "FO:" Style[Superscript[a, "(2,5)"], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtauFO[2, 5][6] 10000]/10000., 12], Scaled[{0.30, 0.15}]]}];
*)
 (* so we could take Nn=6 (order of truncation in FO for a^{(2,5}} where relative stability occurs for the first time; Nn=11 could be effects of IR and UV instabilities cancelling (coincidental);  *)
  (* on the other hand, at Nt=11 we have a stationary point; if we look separately at IR2 and IR3 contributions to a^{(2,5)} (UV1 contribution is negligible), we see that at Nt=6+-1 we have very strong Nt-dependsence of each of the two contributions, but these two contributions tend to cancel each other; THEREFORE, Nt=6 IS NOT THE GOOD CHOICE; WE WILL THUS CHOOSE Nt=11 (in the FO approach to a^{(2,5)}): *)

  (* Note, even Nt=11 is not the best choice, because   a^{(2,5)}(IR2) has a minimum at Nt=9, and a^{(2,5)}(Ir3) has a maximum (plateaux) at Nt=9-10; SO, THE BEST CHOICE IS Nt=9. *) 
  (*----------*)
  (* First FO approach for a^{(2,5)} with Nt=6: *)
  (* Variation of kappa (with Nt=6): *)
  (*  kappa=2.0: alsmtauFO[2, 5][6]=0.321511 *)
  (*  kappa=1:   alsmtauFO[2, 5][6]=0.318064 *)
  (*  kappa=0.5: alsmtauFO[2, 5][6]=0.317749 *)
  (* --> variation of alpha_s(mtau^2) due to kappa=1 +{^{+1}_{-0.5}} is: *)
  (* +{^{+0.003447}_{-0.000315}}_{kappa} *)
  
(* Variation of d4 (with Nt=5 (not 6), kappa=1: *)
(* tddtk[4,tkap] =tddtk[4,tkap]_{original}+338.19 =375.962: alsmtauFO[2, 5][5]=0.314412; *)
 (* tddtk[4,tkap]=ddtk[4,tkap]_{original}=37.7719 (for which ddtk[4,tkap]=338.19):  alsmtauFO[2, 5][5]=0.318600; *)
 (* tddtk[4,tkap]=tddtk[4,tkap]_{original}-338.19: alsmtauFO[2, 5][5]=0.323366;  (but alsmtauFO[2, 5][4]=0.319837, which is different) *)
 (* --> variation of alpha_s(mtau^2) due to d4=338.19 +-338.18: *)
 (* + {^{-0.004188}_{+0.004766}}_{del d4} *)
  
  (*  alpha_s(mtau^2)=0.318+-0.004_{exp} +-0.001_{trunc} +-0.001_{(2,n): n->5+-1} +{^{+0.003}_{0.000}}_{kappa}+{^-0.004_+0.005}_{del d4}   *)

 (* Thus: FO a^{(2,5)}_{D=0} approach, to 6-digits:  alpha_s(mtau^2)=0.318064 + {^{+0.003870}_{-0.003932}}_{exp} + {^{-0.000940}_{+0.0005354}}_{tr:Nn=6 \pm 1} + {^{+0.003446}_{-0.0003154}}_{del kappa} +  {^{-0.004188}_{+0.004766}}_{del d4} + {^{+0.000932}_{-0.001155}}_{(2,n): n->5+-1} = 0.318064+{^{+0.007122}_{-0.005943}} =appr 0.318 + {^{+0.007}_{-0.006}}; (adding in quadrature separately the increases and the decreases); Cesar has the same results *)

(* This corresponds to: aAL(=a(sigmax))= 0.104857+{^{+0.002460}_{-0.002048}} (and truncation Nn=6) *) 
(* For these values of aAL we get: *)
(* aAL(=a(sigmax))= 0.104857+0.002460=0.107317: *)
(* O4O6O8fitPFOMinnumP[6]={1.92114, {O4fitf -> -0.00339158, O6fitf -> 0.00391816, O8fitf -> -0.00220585}};
(* aAL(=a(sigmax))= 0.104857: *)
(* O4O6O8fitPFOMinnumC[6]={0.450355, {O4fitf -> -0.00228438, O6fitf -> 0.00263102, O8fitf -> -0.00135686}}; *)
(* aAL(=a(sigmax))= 0.104857-0.002048=0.102809: *)
 (* O4O6O8fitPFOMinnumM[6]={0.0113273, {O4fitf -> -0.00141012, O6fitf -> 0.00160644, O8fitf -> -0.00067846}}; *)
 
 (* Thus, in this a^{(2,5)}[6,FO]+Borel-Laplace[6] approach we get: *)
 (* Nt=6 *)
 (* alpha_s(mtau^2)=0.3181+{^{+0.0071}_{-0.0060}} =appr =0.318+{^{+0.007}_{-0.006}}; *)
 (* and: 10^3 O4=-2.3+{^{-1.1}_{+0.9}}, 10^3 O6= 2.6+{^{+1.3}_{-1.0}, 10^3 O8= -1.4+{^{-0.8}_{+0.7}} *)
 (* aGG= 6 (O4+ddel) -> 10^3 aGG= 6 (10^3 O4 + 10^3 ddel)=-12+{^{-6}_{+6} *)  
 
  (* End of  FO a^{(2,5)}_{D=0} approach with Nt=6 *)
  (*----------*)
  (* Now FO approach for a^{(2,5)} with Nt=11: *)

  (* Variation of experimental values: *)
  (* aAL=0.103437 + {^{+0.001214}_{-0.001239}}_{exp} --> *)
  (* alpha_s(mtau^2)=0.313946 + {^{+ 0.003521}_{-0.003599})_{exp} *)

  (* Variation of kappa (with Nt=11): *)
  (*  kappa=2.0: alsmtauFO[2, 5][11]=0.315025 *)
  (*  kappa=1:   alsmtauFO[2, 5][11]=0.313946 *)
  (*  kappa=0.5: alsmtauFO[2, 5][11]=no solution, aaFOD0fast[2, 5, aAL][11]<0.173 for all aAL(=a(0.5 sigmax)) *)
  (* kappa=0.55:  alsmtauFO[2, 5][11]=0.32636  (aaFOD0fast[2, 5, aAL][11]<0.186) *)
  (* --> variation of alpha_s(mtau^2) due to kappa=1 +{^{+1}_{-0.5}} is: *)
  (* alpha_s(mtau^2)=0.313946 + {^{+0.001079}_{+0.012414}}_{kappa} *)

(* Variation of d4 (with Nt=5 (not 11), kappa=1: *)
(* tddtk[4,tkap] =tddtk[4,tkap]_{original}+338.19 =375.962: alsmtauFO[2, 5][5]=0.314412; *)
 (* tddtk[4,tkap]=ddtk[4,tkap]_{original}=37.7719 (for which ddtk[4,tkap]=338.19):  alsmtauFO[2, 5][5]=0.318600; *)
 (* tddtk[4,tkap]=tddtk[4,tkap]_{original}-338.19: alsmtauFO[2, 5][5]=0.323366;  (but alsmtauFO[2, 5][4]=0.319837, which is different) *)
 (* --> variation of alpha_s(mtau^2) due to d4=338.19 +-338.18: *)
 (* + {^{-0.004188}_{+0.004766}}_{d4} *)

 (* Variation of Nt=11 +-1  (at kappa=1): *)
 (* Nt=12:  alpha_s(mtau^2)=alsmtauFO[2, 5][12]=0.314344 *)
 (* Nt=11:  alpha_s(mtau^2)=alsmtauFO[2, 5][11]=0.313946 *)
 (* Nt=10:  alpha_s(mtau^2)=alsmtauFO[2, 5][10]=0.313554 *)
 (* --> variation of alpha_s(mtau^2) due to Nt=11+-1: *)
 (* alpha_s(mtau^2)=0.313946 + {^{+0.000398}_{-0.000392}}_{Nt} *)

 (* Variation of n=5+-1 (at kappa=1 and Nt=11): *)
 (* solaALFOc[2, 6][Nn_] := FindRoot[aaFOD0fast[2, 6, aALf][Nn] == aexpBin77[2, 6], {aALf, 0.1}]; Clear[aALFOc]; aALFOc[2, 6][Nn_] := aALf /. solaALFOc[2, 6][Nn]; Clear[alsmtauFO]; alsmtauFO[2, 6][Nn_] := aMSext[mtauphys^2/(kappa sigmax), aALFOc[2, 6][Nn]] Pi; *)
 (* --> n=6: alpha_s(mtau^2)=alsmtauFO[2, 6][11]=0.315213 *)
 (*     n=5: alpha_s(mtau^2)=alsmtauFO[2, 5][11]=0.313946 *)
 (* analogously: n=4:  alpha_s(mtau^2)=alsmtauFO[2, 4][11]=0.31228 *)
 (* variation of alpha_s(mtau^2) due to n=5+-1 (in a^{(2,n)}) : *)
 (* alpha_s(mtau^2)=0.313946 + {^{+0.001267}_{-0.001666}}_{n} *)

 (* Combining: *)
 (* Nt=11, from a^{(2,5)}: *)
 (* alpha_s(mtau^2)=0.313946 + {^{+ 0.003521}_{-0.003599})_{exp} + {^{+0.001079}_{+0.012414}}_{kappa} +  {^{-0.004188}_{+0.004766}}_{d4} + {^{+0.000398}_{-0.000392}}_{Nt}  + {^{+0.001267}_{-0.001666}}_{n} = 0.313946 + {^{+0.0138197}_{-0.005781}} =app  0.3139 + {^{+0.0139}_{-0.0057}} =app 0.314 + {^{+0.014}_{-0.006}} *)
(* Note: kappa_min=0.55; cannot go to kappa=0.5 *)

 (* End of FO a^{(2,5)}(D=0) approach with Nt=11 *)

 (* Follow some graphs with a^{(2,5)} for Nt=11 cental value of alpha_s: *)
 
(* Taba25FOvsNn = Table[{Nn, aaFOD0fast[2, 5, aALFOc[2, 5][11]][Nn]}, {Nn, 4, 15}]; ListPlot[Taba25FOvsNn]; Tabdela25FOvsNn=Table[{Nn, Taba25FOvsNn[[Nn - 3]][[2]] - Taba25FOvsNn[[Nn - 4]][[2]]}, {Nn, 5,15}]; ListPlot[Tabdela25FOvsNn];
ff25exp=Table[{NN,aexpBin77[2,5]},{NN,4,15}];  ff25plexp=Table[{NN,aexpBin77[2,5]+delaexpBin77[2,5]},{NN,4,15}]; ff25miexp=Table[{NN,aexpBin77[2,5]-delaexpBin77[2,5]},{NN,4,15}];
Taba25FOvsNnIR2= Table[{Nn, aaFOD0fastIR2[2, 5, aALFOc[2, 5][11]][Nn]}, {Nn, 4, 15}]; Taba25FOvsNnIR3= Table[{Nn, aaFOD0fastIR3[2, 5, aALFOc[2, 5][11]][Nn]}, {Nn, 4, 15}]; Taba25FOvsNnUV1= Table[{Nn, aaFOD0fastUV1[2, 5, aALFOc[2, 5][11]][Nn]}, {Nn, 4, 15}];
 a25FOavar= ListPlot[{Taba25FOvsNn, ff25exp, ff25miexp, ff25plexp}, PlotRange -> {{3.8, 15.2}, {0.175, 0.190}}, PlotStyle -> {Black, {Blue, PointSize[0.003]}, {Blue, PointSize[0.003]}, {Blue, PointSize[0.003]}}, Filling -> {3 -> {4}}, AxesLabel -> {Style[Subscript[N, t], 13], "FO:" Style[Superscript[a, "(2,5)"]["all"], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtauFO[2, 5][11] 10000]/10000., 12], Scaled[{0.70, 0.90}]], Inset[Style["(d)", 13], Scaled[{0.3, 0.93}]]}];
a25FOavarIR2= ListPlot[{Taba25FOvsNnIR2}, PlotRange -> {{3.8, 15.2}, {0.300, 0.315}}, PlotStyle -> Black, AxesLabel -> {Style[Subscript[N, t], 13], "FO:" Style[Superscript[a, "(2,5)"][IR2], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtauFO[2, 5][11] 10000]/10000., 12],Scaled[{0.70, 0.90}]], Inset[Style["(a)", 13], Scaled[{0.3, 0.9}]]}];
a25FOavarIR3= ListPlot[Taba25FOvsNnIR3, PlotRange -> {{3.8, 15.2}, {-0.135, -0.120}}, AxesOrigin -> {3.8, -0.135}, PlotStyle -> Black, AxesLabel -> {Style[Subscript[N, t], 13], "FO:" Style[Superscript[a, "(2,5)"][IR3], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtauFO[2, 5][11] 10000]/10000., 12], Scaled[{0.70, 0.15}]], Inset[Style["(b)", 13], Scaled[{0.5, 0.5}]]}];
a25FOavarUV1= ListPlot[Taba25FOvsNnUV1, PlotRange -> {{3.8, 15.2}, {-0.02, 0.002}}, AxesOrigin -> {3.8, -0.02}, PlotStyle -> Black, AxesLabel -> {Style[Subscript[N, t], 13], "FO:" Style[Superscript[a, "(2,5)"][UV1], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtauFO[2, 5][11] 10000]/10000., 12], Scaled[{0.70, 0.15}]], Inset[Style["(c)", 13], Scaled[{0.5, 0.5}]]}];
*)
  (*----------*)
  (* Now FO approach for a^{(2,5)}(D=0) with Nt=9 (Nt=9 is aguably the BEST choice, because stationary IR2 and approaximately stationary IR3 contribution there) *)

  (* Variation of experimental values: *)
  (* alpha_s(mtau^2)=0.314448 + {^{+0.003566}_{-0.003642}}_{exp} *)

  (* Variation of kappa (with Nt=9): *)
  (*  kappa=2.0: alsmtauFO[2, 5][9]=0.316805 *)
  (*  kappa=1:   alsmtauFO[2, 5][9]=0.314448 *)
  (*  kappa=0.5: alsmtauFO[2, 5][9]=0.311387 *)
  (* --> variation of alpha_s(mtau^2) due to kappa=1 +{^{+1}_{-0.5}} is: *)
  (* alpha_s(mtau^2)=0.314448 + {^{+0.002357}_{-0.003061}}_{kappa} *)

(* Variation of d4 (with Nt=5 (not 11), kappa=1: *)
(* tddtk[4,tkap] =tddtk[4,tkap]_{original}+338.19 =375.962: alsmtauFO[2, 5][5]=0.314412; *)
 (* tddtk[4,tkap]=ddtk[4,tkap]_{original}=37.7719 (for which ddtk[4,tkap]=338.19):  alsmtauFO[2, 5][5]=0.318600; *)
 (* tddtk[4,tkap]=tddtk[4,tkap]_{original}-338.19: alsmtauFO[2, 5][5]=0.323366;  (but alsmtauFO[2, 5][4]=0.319837, which is different) *)
 (* --> variation of alpha_s(mtau^2) due to d4=338.19 +-338.18: *)
 (* + {^{-0.004188}_{+0.004766}}_{d4} *)

 (* Variation of Nt=9 +-1  (at kappa=1): *)
 (* Nt=10:  alpha_s(mtau^2)=alsmtauFO[2, 5][10]=0.313554 *)
 (* Nt= 9:  alpha_s(mtau^2)=alsmtauFO[2, 5][9]=0.314448 *)
 (* Nt= 8:  alpha_s(mtau^2)=alsmtauFO[2, 5][8]=0.315716 *)
 (* --> variation of alpha_s(mtau^2) due to Nt=9+-1: *)
 (* alpha_s(mtau^2)=0.314448 + {^{-0.000894}_{+0.001268}}_{Nt} *)

 (* Variation of n=5+-1 (at kappa=1 and Nt=9): *)
 (* solaALFOc[2, 6][Nn_] := FindRoot[aaFOD0fast[2, 6, aALf][Nn] == aexpBin77[2, 6], {aALf, 0.1}]; Clear[aALFOc]; aALFOc[2, 6][Nn_] := aALf /. solaALFOc[2, 6][Nn]; Clear[alsmtauFO]; alsmtauFO[2, 6][Nn_] := aMSext[mtauphys^2/(kappa sigmax), aALFOc[2, 6][Nn]] Pi; *)
 (* --> n=6: alpha_s(mtau^2)=alsmtauFO[2, 6][9]=0.31548 *)
 (*     n=5: alpha_s(mtau^2)=alsmtauFO[2, 5][9]=0.314448 *)
 (* analogously: n=4:  alpha_s(mtau^2)=alsmtauFO[2, 4][9]=0.313098 *)
 (* variation of alpha_s(mtau^2) due to n=5+-1 (in a^{(2,n)}) (at Nt=9) : *)
 (* alpha_s(mtau^2)=0.314448 + {^{+0.001032}_{-0.00135}}_{n} *)

 (* Combining: *)
 (* Nt=9, from a^{(2,5)}(D=0) FO: *)
 (* alpha_s(mtau^2)=0.314448 + {^{+0.003566}_{-0.003642}}_{exp} + {^{+0.002357}_{-0.003061}}_{kappa} + {^{-0.004188}_{+0.004766}}_{d4}  + {^{-0.000894}_{+0.001268}}_{Nt} + {^{+0.001032}_{-0.00135}}_{n} = 0.314448 + {^{+0.006608}_{-0.006542}} =app 0.3144 + {^{+0.0067}_{-0.0065}} =app 0.314  + {^{+0.007}_{-0.006}} *)

 (* End of FO a^{(2,5)}(D=0) approach with Nt=9 *)


 (* Follow some graphs with a^{(2,5)} for Nt=9 cental value of alpha_s: *)
 
(* Taba25FOvsNn = Table[{Nn, aaFOD0fast[2, 5, aALFOc[2, 5][9]][Nn]}, {Nn, 4, 15}]; ListPlot[Taba25FOvsNn]; Tabdela25FOvsNn=Table[{Nn, Taba25FOvsNn[[Nn - 3]][[2]] - Taba25FOvsNn[[Nn - 4]][[2]]}, {Nn, 5,15}]; ListPlot[Tabdela25FOvsNn];
ff25exp=Table[{NN,aexpBin77[2,5]},{NN,4,15}];  ff25plexp=Table[{NN,aexpBin77[2,5]+delaexpBin77[2,5]},{NN,4,15}]; ff25miexp=Table[{NN,aexpBin77[2,5]-delaexpBin77[2,5]},{NN,4,15}];
Taba25FOvsNnIR2= Table[{Nn, aaFOD0fastIR2[2, 5, aALFOc[2, 5][9]][Nn]}, {Nn, 4, 15}]; Taba25FOvsNnIR3= Table[{Nn, aaFOD0fastIR3[2, 5, aALFOc[2, 5][9]][Nn]}, {Nn, 4, 15}]; Taba25FOvsNnUV1= Table[{Nn, aaFOD0fastUV1[2, 5, aALFOc[2, 5][9]][Nn]}, {Nn, 4, 15}];
 a25FOavar= ListPlot[{Taba25FOvsNn, ff25exp, ff25miexp, ff25plexp}, PlotRange -> {{3.8, 15.2}, {0.175, 0.190}}, PlotStyle -> {Black, {Blue, PointSize[0.003]}, {Blue, PointSize[0.003]}, {Blue, PointSize[0.003]}}, Filling -> {3 -> {4}}, AxesLabel -> {Style[Subscript[N, t], 13], "FO:" Style[Superscript[a, "(2,5)"]["all"], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtauFO[2, 5][9] 10000]/10000., 12], Scaled[{0.70, 0.90}]], Inset[Style["(d)", 13], Scaled[{0.3, 0.93}]]}];
a25FOavarIR2= ListPlot[{Taba25FOvsNnIR2}, PlotRange -> {{3.8, 15.2}, {0.300, 0.315}}, PlotStyle -> Black, AxesLabel -> {Style[Subscript[N, t], 13], "FO:" Style[Superscript[a, "(2,5)"][IR2], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtauFO[2, 5][9] 10000]/10000., 12],Scaled[{0.70, 0.90}]], Inset[Style["(a)", 13], Scaled[{0.3, 0.9}]]}];
a25FOavarIR3= ListPlot[Taba25FOvsNnIR3, PlotRange -> {{3.8, 15.2}, {-0.135, -0.120}}, AxesOrigin -> {3.8, -0.135}, PlotStyle -> Black, AxesLabel -> {Style[Subscript[N, t], 13], "FO:" Style[Superscript[a, "(2,5)"][IR3], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtauFO[2, 5][9] 10000]/10000., 12], Scaled[{0.70, 0.15}]], Inset[Style["(b)", 13], Scaled[{0.5, 0.5}]]}];
a25FOavarUV1= ListPlot[Taba25FOvsNnUV1, PlotRange -> {{3.8, 15.2}, {-0.02, 0.002}}, AxesOrigin -> {3.8, -0.02}, PlotStyle -> Black, AxesLabel -> {Style[Subscript[N, t], 13], "FO:" Style[Superscript[a, "(2,5)"][UV1], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtauFO[2, 5][9] 10000]/10000., 12], Scaled[{0.70, 0.15}]], Inset[Style["(c)", 13], Scaled[{0.5, 0.5}]]}];
 (* Export["a25FOavarIR2.pdf",a25FOavarIR2]; Export["a25FOavarIR3.pdf",a25FOavarIR3]; Export["a25FOavarUV1.pdf",a25FOavarUV1]; Export["a25FOavar.pdf",a25FOavar]; *)

 (*-------------------------------------_*)
(*---------------------------------------*)
 (* global tFO: The above behaviour of a^{(2,1)}(aAL,O6,O8) and a^{(2,0)}(aAL,O4,O6) suggests that the truncation order Nt in the FtO global approach (i.e., the approach of minimization with alpha_s variable) is Nt=6. *)

  (* Now the estimate of experimental uncertainty in this global approach with double-pinched FO Borel-Laplace (with Nt=8): *)

(* Number of equidistant points Nm in the interval 0.9 =< |M^2| =< 1.5 GeV^2: *)
Nm=2; Nd=3 Nm;  
M2cov1F[ii_]:=0.90+(ii-1)*0.60/(Nm-1); (* ii=1,..,Nm; this gives M2covF[1]=0.90, ... M2covF[Nm]=1.5 *)
Do[M2covF[jj]=M2cov1F[jj],{jj,1,Nm}]; Do[M2covF[jj+Nm]=M2cov1F[jj] Exp[I Pi/6],{jj,1,Nm}]; Do[M2covF[jj+2 Nm]=M2cov1F[jj] Exp[I Pi/4],{jj,1,Nm}]; (* in this way we have 3 Nm=Nd points M^2 in the complex M^2-plane, three with Psi=0, three with Psi=Pi/6, and three with Psi=Pi/4 *)

 (* Now estimation of delO4 with the (NdxNd) covariance matrix  ('varcov')
  (and using FO Nt=5 global analysis for theoretical values): *)
Nt0=6;
(* We vary O4 in UNCORRELATED chi ('var'): *)
chi2o2O4[O4f_]:=Sum[(ReBPtFO[M2covF[jj],Nt0,aALftFO[Nt0],O4f,O6tFO[Nt0],O8tFO[Nt0]] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
O4tFOvarfitMin=FindMinimum[chi2o2O4[O4fitf],{O4fitf,O4tFO[Nt0]}];
O4tFOvarfit=O4fitf/.O4tFOvarfitMin[[2]];
Xi2O4tFOvaro77=O4tFOvarfitMin[[1]];                       
 delO4tFO= delO4f/.FindRoot[chi2o2O4[O4tFOvarfit+delO4f]==Xi2O4tFOvaro77+1,{delO4f, 3. 10^-5}];
(* --> for Nm=2 (Nd=6) we obtain: delO4tFO=0.0000304; note that O4tFO[6]=-0.00323869, by global tFO analysis *)

chi2o2O6[O6f_]:=Sum[(ReBPtFO[M2covF[jj],Nt0,aALftFO[Nt0],O4tFO[Nt0],O6f,O8tFO[Nt0]] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
O6tFOvarfitMin=FindMinimum[chi2o2O6[O6fitf],{O6fitf,O6tFO[Nt0]}];
O6tFOvarfit=O6fitf/.O6tFOvarfitMin[[2]];
Xi2O6tFOvaro77=O6tFOvarfitMin[[1]];
 delO6tFO= delO6f/.FindRoot[chi2o2O6[O6tFOvarfit+delO6f]==Xi2O6tFOvaro77+1,{delO6f, 3. 10^-5}];
(* Nm=2; Nd=6; delO6tFO=0.0000451; *)

chi2o2O8[O8f_]:=Sum[(ReBPtFO[M2covF[jj],Nt0,aALftFO[Nt0],O4tFO[Nt0],O6tFO[Nt0],O8f] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
O8tFOvarfitMin=FindMinimum[chi2o2O8[O8fitf],{O8fitf,O8tFO[Nt0]}];
O8tFOvarfit=O8fitf/.O8tFOvarfitMin[[2]];
Xi2O8tFOvaro77=O8tFOvarfitMin[[1]];
 delO8tFO= delO8f/.FindRoot[chi2o2O8[O8tFOvarfit+delO8f]==Xi2O8tFOvaro77+1,{delO8f, 3. 10^-5}];
(* Nm=2; Nd=6; delO8tFO=0.0000809; *)

chi2o2aAL[aALf_]:=Sum[(ReBPtFO[M2covF[jj],Nt0,aALf,O4tFO[Nt0],O6tFO[Nt0],O8tFO[Nt0]] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
aALtFOvarfitMin=FindMinimum[chi2o2aAL[aALfitf],{aALfitf,aALftFO[Nt0]}];
aALtFOvarfit=aALfitf/.aALtFOvarfitMin[[2]];
Xi2aALtFOvaro77=aALtFOvarfitMin[[1]];
 delaALtFO= delaALf/.FindRoot[chi2o2aAL[aALtFOvarfit+delaALf]==Xi2aALtFOvaro77+1,{delaALf, 3. 10^-5}];
(* Nm=2; Nd=6; Nt0=6; delaALtFO=0.000088 *)
(*-------*)
(* Together, the estimates of EXPERIMENTAL uncertainties in the tFO global approach (with Nt=6) are (Nm=2; Nd=6), tFO global:  *)
(* delO4tFO= 0.000030; delO6tFO=0.000045; delO8tFO=0.000081; delaALtFO=0.000088; (=delta(a(sigmax))) *)
(* --> alpha_s(mtau^2)=0.307509+{^{+0.000256}_{-0.000257}}_{exp}; *)
(* 10^3 O4=-3.2+{^{+0.0}_{-0.1}}_{exp}; 10^3 O6=+2.3+{{+0.0}_{-0.1}}_{exp}; 10^3 O8=-0.8+{^{+0.1}_{-0.1}}_{exp}; *)
 (* 10^3 aGG= 6 (10^3 O4 + 10^3 ddel)=-17.4+{^{+0.1}_{-0.2}}_{exp}; *)

(* The precise central value result of the tFO global fit:
 alO4O6O8fitPtFOMinnum[6]={0.00411835, {aALf -> 0.101191432, O4fitf -> -0.00323869, O6fitf -> 0.00228238, O8fitf -> -0.000827757}}; *)
(*----*)
(* Variation of kappa, tFO global: *)
(* kappa=2.0: *)
(*  alO4O6O8fitPtFOMinnum[6]={0.00344031,   {aALf -> 0.085516948, O4fitf -> -0.0017706, O6fitf -> 0.00170187, O8fitf -> -0.000661299}}; *)
(* kappa=1.0 (the central case of the global fit): *)
(* alO4O6O8fitPtFOMinnum[6]={0.00411835,    {aALf -> 0.101191432, O4fitf -> -0.00323869, O6fitf -> 0.00228238, O8fitf -> -0.000827757}}; *)
(* kappa=0.5: *)
(* alO4O6O8fitPtFOMinnum[6]={6.85666*10^-6, {aALf -> 0.117405637, O4fitf -> -0.00297625, O6fitf -> 0.00141867, O8fitf -> -0.000386832}}; *)
(* Note that aALf=a(kappa*sigmax) *)
(* --> thus the variations: *)
(* alpha_s(mtau^2)=0.307419 + {^{+0.003054}_{-0.017307}}_{del kappa} *)
(* 10^3 O4=-3.2+{^{+1.4}_{+0.2}}_{del kappa}; 10^3 O6=2.3+{{-0.6}_{-0.9}}_{del kappa}; 10^3 O8=-0.8+{^{+0.1}_{+0.4}}_{delta kappa}; *)
(* 10^3 aGG= 6 10^3 (O4 + ddel)=-17.4+{^{+8.8}_{+1.5}}_{del kappa}; *)
(*----*)
(* Variation of d4, tFO global (note, now: Nt=5, not Nt=6): *)
(* d4=2 338.19 (tddtk[4,tkap]=37.77+338.19=375.962): *)
(* alO4O6O8fitPtFOMinN[5]={0.00223823, {aALf -> 0.098528739, O4fitf -> -0.0014034, O6fitf -> 0.00149346, O8fitf -> -0.000578109}}; *)
(* d4=338.19;  (tddtk[4,tkap]=37.77) (the central case of the global fit): *)
(* alO4O6O8fitPtFOMinN[5]={0.00627679, {aALf -> 0.102449417, O4fitf -> -0.00231109, O6fitf -> 0.00210775, O8fitf -> -0.000830984}}; *)
(* d4=0 (tddtk[4,tkap]=37.77-338.19=-300.418): *)
(* alO4O6O8fitPtFOMinN[5]={0.0269871, {aALf -> 0.110566952, O4fitf -> -0.0048283, O6fitf -> 0.00377848, O8fitf -> -0.00150944}}; *)
(* --> thus the variations: *)
(* alpha_s(mtau^2)=0.311077+{^{-0.011419}_{+0.023485}}_{del d4}; *)
(* 10^3 O4=-2.3+{^{+0.9}_{-2.5}}_{del d4}; 10^3 O6= +2.1+{{-0.6}_{+1.7}}_{del d4}; 10^3 O8=-0.8+{^{+0.2}_{-0.7}}_{del d4}; *)
(* 10^3 aGG= 6 10^3 (O4 + ddel)=-11.9+{^{+5.5}_{-15.1}}_{del d4}; *)
(*----*)
(* Variation of Nt(truncation order, Nt=Nt0+-1=6+-1), tFO global: *)
(* Nt=7: *)
(* alO4O6O8fitPtFOMinnum[7] = {0.0041745, {aALf -> 0.0993438809, O4fitf -> -0.00414978, O6fitf -> 0.00241138, O8fitf -> -0.000836931}}; *)
(* Nt=6 (the central case): *)
(* alO4O6O8fitPtFOMinnum[6]={0.00411835, {aALf -> 0.101191432, O4fitf -> -0.00323869, O6fitf -> 0.00228238, O8fitf -> -0.000827757}}; *)
 (* Nt=5: *)
(* alO4O6O8fitPtFOMinnum[5] = {0.00627679, {aALf -> 0.102449417, O4fitf -> -0.00231109, O6fitf -> 0.00210775, O8fitf -> -0.000830984}}; *)
(* alpha_s(mtau^2)=0.307419+{^{-0.005383}_{+0.003658}}_{del Nt} *)
(* 10^3 O4=-3.2+{^{-0.9}_{+0.9}}_{del Nt}; 10^3 O6= +2.3+{{+0.1}_{-0.2}}_{del Nt}; 10^3 O8=-0.8+{^{-0.0}_{+0.0}}_{del Nt}; *)
 (* 10^3 aGG= 6 10^3 (O4 + ddel)=-17.4+{^{-5.5}_{+5.5}}_{del Nt}; *)
(*-----------------------------------------*)
(* Altogether, the tFO global fit approach gives: *)
(* Nt=6; *)
(*
 alpha_s(mtau^2)=0.307419 + {^{+0.000256}_{-0.000257}}_{exp} +  {^{+0.003054}_{-0.017307}}_{del kappa} + {^{-0.011419}_{+0.023485}}_{del d4} + {^{-0.005383}_{+0.003658}}_{del Nt} = 0.307419 + {^{+0.023965}_{-0.021424} =app 0.3074 + {^{+0.0240}_{-0.0214} =app 0.307 + {^{+0.024}_{-0.021};
 10^3 aGG=-17.4 + {^{+0.1}_{-0.2}}_{exp} + {^{+8.8}_{+1.5}}_{del kappa} + {^{+5.5}_{-15.1}}_{del d4} + {^{-5.5}_{+5.5}}_{del Nt} = -17.4 + {^{+11.7}_{-16.1}} =app -17 + {^{+11}_{-16}};
 10^3 O4=-3.2 + {^{+0.0}_{-0.1}}_{exp} + {^{+1.4}_{+0.2}}_{del kappa} + {^{+0.9}_{-2.5}}_{del d4} + {^{-0.9}_{+0.9}}_{del Nt} -3.2 + {^{+1.9}_{-2.7}};
 10^3 O6=+2.3 + {{+0.0}_{-0.1}}_{exp} + {{-0.6}_{-0.9}}_{del kappa} + {{-0.6}_{+1.7}}_{del d4} + {{+0.1}_{-0.2}}_{del Nt} = +2.3 + {^{+1.7}_{-1.1}};
 10^3 O8=-0.8 + {^{+0.1}_{-0.1}}_{exp} + {^{+0.1}_{+0.4}}_{delta kappa} + {^{+0.2}_{-0.7}}_{del d4} + {^{-0.0}_{+0.0}}_{del Nt} = -0.8 + {^{+0.5}_{-0.7}};
 *)
 (* End of tFO global fit results *)
(*------------------------------------*)
(*------------------------------------*)
(*------------------------------------*)
 (* Now the tFO approach based on a^{(2,5)}([Nt,tFO])_{D=0}: *)
 
(* Note: aatFOD0[2,1,aALf][NN]=rtautFOD0[NN], as it should be *)
(* taba25tFO[aALf_]: = Table[{nn, aatFOD0[2, 5,aALf][nn]}, {nn, 3, 12}]; ListPlot[taba25tFO] *)
(* deltab25tFO[aALf_]:=Table[{nn, taba25tFO[[nn-2,aALf]][[2]]-taba25tFO[aALf][[nn-3]][[2]]}, {nn, 4, 12}]; *)
 (*--------*)
 (* (aALFOc[2, 5][11]=0.10343717517966337): Taba25tFOvsNnIR2= Table[{Nn, aatFOD0IR2[2, 5, aALFOc[2, 5][11]][Nn]}, {Nn, 4, 15}];  Taba25tFOvsNnIR3= Table[{Nn, aatFOD0IR3[2, 5, aALFOc[2, 5][11]][Nn]}, {Nn, 4, 15}]; Taba25tFOvsNnUV1= Table[{Nn, aatFOD0UV1[2, 5, aALFOc[2, 5][11]][Nn]}, {Nn, 4, 15}]; Taba25tFOvsNn= Table[{Nn, aatFOD0[2, 5, aALFOc[2, 5][11]][Nn]}, {Nn, 4, 15}]; ListPlot[Taba25tFOvsNnIR2]; ListPlot[Taba25tFOvsNnIR3]; ListPlot[Taba25tFOvsNnUV1]; *)
 (* This shows: aatFOD0IR2[2, 5, aALFOc[2, 5][11]][Nn] has a local minimu at Nt=6; aatFOD0IR3[2, 5, aALFOc[2, 5][11]][Nn] has a local maximum at Nt=6; aatFOD0UV1[2, 5, aALFOc[2, 5][11]][Nn] is neglegible (as it should be by theory); this suggests that Nt=6 is the most reasonable choice for a^{(2,5)} in the tFO a^{(2,5)(D=0) approach *)


solaALtFOc[2,5][Nn_]:=FindRoot[aatFOD0[2,5,aALf][Nn]==aexpBin77[2,5],{aALf,0.102}];
 Clear[aALtFOc];
 aALtFOc[2,5][Nn_]:=aALf/.solaALtFOc[2,5][Nn];
 Clear[alsmtautFO]; alsmtautFO[2,5][Nn_]:=aMSext[mtauphys^2/(kappa sigmax),aALtFOc[2,5][Nn]] Pi;
 (* alsmtautFO=alpha_s(mtau^2;MSbar) such that the a^{(2,5}} theoretical moment (in tFO with D=0) with Nn truncation reproduces the experimental value moment aexpBin77[2,5] *)

 (* solaALtFOp[2, 5][Nn_] := FindRoot[aatFOD0[2, 5, aALf][Nn] == aexpBin77[2, 5] + delaexpBin77[2, 5], {aALf, 0.1}]; aALtFOp[2, 5][Nn_] := aALf /. solaALtFOp[2, 5][Nn]; alsmtautFOp[2, 5][Nn_] := aMSext[mtauphys^2/(kappa sigmax), aALtFOp[2, 5][Nn]] Pi;
solaALtFOn[2, 5][Nn_] := FindRoot[aatFOD0[2, 5, aALf][Nn] == aexpBin77[2, 5] - delaexpBin77[2, 5], {aALf, 0.1}]; aALtFOn[2, 5][Nn_] := aALf /. solaALtFOn[2, 5][Nn]; alsmtautFOn[2, 5][Nn_] := aMSext[mtauphys^2/(kappa sigmax), aALtFOn[2, 5][Nn]] Pi; *)

 (* kappa=1: *)
  (* Do[alsmtautFOnum[2, 5][Nn]=alsmtautFO[2, 5][Nn],{Nn,3,12}]; *)
  (* alsmtautFOnum[2, 5][3]=0.312919 *)
  (* alsmtautFOnum[2, 5][4]=0.316802 *)
  (* alsmtautFOnum[2, 5][5]=0.322977 *)
  (* alsmtautFOnum[2, 5][6]=0.314405 *)
  (* alsmtautFOnum[2, 5][7]=0.308547 *)
  (* alsmtautFOnum[2, 5][8]=0.308607 *)
  (* alsmtautFOnum[2, 5][9]=NO SOLUTION *)
  (* alsmtautFOnum[2, 5][10]=0.296181 *)
  (* alsmtautFOnum[2, 5][11]=NO SOLUTION *)
  (* alsmtautFOnum[2, 5][12]=0.262334 *)

 (* note: alpha_s(MZ^2;MSbar)=0.1179 (world average) -> alpha_s(mtau^2,MSbar;nf=3)=0.313631 *)
 
 (* tabalsmtautFO = Table[{Nn, alsmtautFOnum[2, 5][Nn]}, {Nn, 3, 8}]; ListPlot[tabalsmtautFO] *)
 (* tabdelalsmtautFO=Table[{Nn, alsmtautFOnum[2, 5][Nn] - alsmtautFOnum[2, 5][Nn - 1]}, {Nn, 4, 8}]={{4, 0.00388271}, {5, 0.00617496}, {6, -0.00857199}, {7, -0.00585796}, {8, 0.0000602708}}; ListPlot[tabdelalsmtauFO] *)

  (* If alsmtautFO is taken fixed: alsmtau=0.320; -> aALtFO=aMSext[sigmax/mtau^2,alsmtau/Pi] (=a(sigmax)=0.1038002): taba25tFOvsNn = Table[{Nn, aatFOD0[2, 5, aALtFO][Nn]}, {Nn, 3, 12}]; ListPlot[taba25tFOvsNn,PlotRange -> {0.17, 0.22}]; tabdela25tFOvsNn=Table[{Nn, taba25tFOvsNn[[Nn - 2]][[2]] - taba25tFOvsNn[[Nn - 3]][[2]]}, {Nn, 4,12}]; ListPlot[tabdela25tFOvsNn,PlotRange -> {-0.05, 0.05}]; *)
   (* so we take Nt=5 (order of truncation in tFO for a^{(2,5}}_{D=0}[Nt] where relative stability (minimum) occurs for the first time (Nt=4 could also be acceptable); even if  alsmtautFO is varied between 0.300 and 0.330, the same result: local minimum of a^{(2,5)}_{D=0}[Nt] at Nt=5; Nt=8 could be effects of IR and UV instabilities cancelling (coincidental);  *)

(* Thus: Nt=5 we take in the tFO a^{(2,5)}_{D=0) approach: --> *)

    (* EXPERIMENTAL uncertainties: *)
    (* alpha_s(mtau^2)=alsmtautFO[2, 5][5]+{^{+alsmtautFOp[2, 5][5]-alsmtautFO[2, 5][5]}_{+alsmtautFOn[2, 5][5]-alsmtautFO[2, 5][5]}}_{exp}: *)
      alpha_s(mtau^2)= alsmtautFOnum[2, 5][5]=0.322977+{^{+0.004362}_{-0.0043851}}_{exp} =app 0.3230+{^{+0.0043}_{-0.0044}}_{exp} =app 0.323+{^{0.004}_{-0.004}}_{exp} *)
    (*----*)
  (* Variation of kappa (with Nt=5): *)
  (*  kappa=2.0: alsmtautFO[2, 5][5]=0.319026 *)
  (*  kappa=1:   alsmtautFO[2, 5][5]=0.322977 *)
  (*  kappa=0.5: alsmtautFO[2, 5][5]=0.318623 *)
  (* --> variation of alpha_s(mtau^2) due to kappa=1 +{^{+1}_{-0.5}} is: *)
  (* 0.322977+{^{-0.003951}_{-0.004354}}_{del kappa} *)
  (*---*) 
(* Variation of d4 (with Nt=5 (not 6), kappa=1: *)
 (* tddtk[4,tkap] =tddtk[4,tkap]_{original}+338.19 =375.962: alsmtautFO[2, 5][5]=0.304502; *)
 (* tddtk[4,tkap]=ddtk[4,tkap]_{original}=37.7719 (for which ddtk[4,tkap]=338.19):  alsmtautFO[2, 5][5]=0.322977; *)
 (* tddtk[4,tkap]=tddtk[4,tkap]_{original}-338.19=-300.418: alsmtauFO[2, 5][5]=NO SOLUTION (the experimental value is not achieved, always below it); *)
 (* --> variation of alpha_s(mtau^2) due to d4=338.19 +-338.18: *)
 (* 0.322977+ {^{-0.018475}_{...}}_{del d4} *)
  (*---*) 
 (* Variation of truncation order Nt=5 +-1: *)
 (* Nt=6: alpha_s(mtau^2)=alsmtautFO[2, 5][6]=0.314405; *)
 (* Nt=5: alpha_s(mtau^2)=alsmtautFO[2, 5][5]=0.322977; *)
 (* Nt=4: alpha_s(mtau^2)=alsmtautFO[2, 5][4]=0.316802; *)
 (* -->  alpha_s(mtau^2)=0.322977+{^{-0.008572}_{-0.006175}}_{del Nt} *)
 
 (* Thus: tFO a^{(2,5)}_{D=0} approach (Nt=5):  *)
 (* alpha_s(mtau^2)=0.322977 + {^{+0.004362}_{-0.0043851}}_{exp} + {^{-0.003951}_{-0.004354}}_{del kappa} +  {^{-0.018475}_{...}}_{del d4} + {^{-0.008572}_{-0.006175}}_{del Nt} = 0.322977 + {^{+0.004362}_{-0.021284}} =app 0.3230 + {^{+0.0043}_{-0.0213}} =app 0.323 + {^{0.004}_{-0.021}}; *)
 (adding in quadrature separately the increases and the decreases); there is a strong theor. uncertainty here, due to (del d4), when d4=338.19 -> d4=0 (and due to del Nt=5 -> 6) *)
 
(* This corresponds to: aAL(=a(sigmax))= 0.106553+{^{+0.001509}_{-0.007327}} (and truncation Nt=5) *) 
(* For these values of aAL we get: *)
(* aAL(=a(sigmax))= 0.106553+0.001509=0.108062: *)
(* O4O6O8fitPtFOMinnumP[5]={2.60954,  {O4fitf -> -0.00538741, O6fitf -> 0.00536912, O8fitf -> -0.00288411}}; *)
 (* aAL(=a(sigmax))= 0.106553: *)
(* O4O6O8fitPtFOMinnumC[5]={1.36541,  {O4fitf -> -0.0045036, O6fitf -> 0.00444566, O8fitf -> -0.00230725}}; *)
(* aAL(=a(sigmax))= 0.106553 - 0.007327=0.099226: *)
 (* O4O6O8fitPtFOMinnumM[5]={0.755317, {O4fitf -> -0.000780499, O6fitf -> 0.000432127, O8fitf -> 0.000241563}}; *)
 (* Thus, in this a^{(2,5)}[5,tFO]+Borel-Laplace[6] approach we get: *)
 (* Nt=5 *)
    (* alpha_s(mtau^2)==app 0.3230 + {^{+0.0043}_{-0.0213}} =app 0.323 + {^{+0.004}_{-0.021}}; *)
 (* and: 10^3 O4=-4.5+{^{-0.9}_{+3.7}}, 10^3 O6= 4.4+{^{+1.0}_{-4.0}, 10^3 O8= -2.3+{^{-0.6}_{+2.5}} *)
 (* aGG= 6 (O4+ddel) -> 10^3 aGG= 6 (10^3 O4 + 10^3 ddel)=-25+{^{-5}_{+22} *)  
  (*----------------*)
    (* NO. AS ARGUED ABOVE, the IR2 and IR3 parts of a^{(2,5)}(D=0) at fixed aAL=a(sigmax) in the TFO approach indicate that Nt=6 is more reasonable choice: *)

    (* So, I take Nt=6 in the tFO a^{(2,5)}_{D=0) approach: --> *)

  (* EXPERIMENTAL uncertainties: *)
    (* alpha_s(mtau^2)=alsmtautFO[2, 5][6]+{^{+alsmtautFOp[2, 5][6]-alsmtautFO[2, 5][6]}_{+alsmtautFOn[2, 5][6]-alsmtautFO[2, 5][6]}}_{exp}: *)
  alpha_s(mtau^2)= alsmtautFOnum[2, 5][6]=0.314405+{^{+0.003486}_{-0.003574}}_{exp} =app 0.3144+{^{+0.0035}_{-0.0036}}_{exp} *)
    (*----*)
  (* Variation of kappa (with Nt=6): *)
  (*  kappa=2.0: alsmtautFO[2, 5][6]=0.318416 *)
  (*  kappa=1:   alsmtautFO[2, 5][6]=0.314405 *)
  (*  kappa=0.5: alsmtautFO[2, 5][6]=0.289634 *)
  (* --> variation of alpha_s(mtau^2) due to kappa=1 +{^{+1}_{-0.5}} is: *)
  (*  alpha_s(mtau^2)=0.314405+{^{+0.004011}_{-0.024771}}_{kappa} *)
  (*---*) 
(* Variation of d4 (with Nt=5 (not 6), kappa=1: *)
 (* tddtk[4,tkap] =tddtk[4,tkap]_{original}+338.19 =375.962: alsmtautFO[2, 5][5]=0.304502; *)
 (* tddtk[4,tkap]=ddtk[4,tkap]_{original}=37.7719 (for which ddtk[4,tkap]=338.19):  alsmtautFO[2, 5][5]=0.322977; *)
 (* tddtk[4,tkap]=tddtk[4,tkap]_{original}-338.19=-300.418: alsmtauFO[2, 5][5]=NO SOLUTION (the experimental value is not achieved, always below it); *)
 (* --> variation of alpha_s(mtau^2) due to d4=338.19 +-338.18: *)
 (* 0.322977+ {^{-0.018475}_{...}}_{d4} *)
  (*---*)     
 (* Variation of truncation order Nt=6 +-1: *)
 (* Nt=7: alpha_s(mtau^2)=alsmtautFO[2, 5][7]=0.308547; *)
 (* Nt=6: alpha_s(mtau^2)=alsmtautFO[2, 5][6]=0.314405; *)
 (* Nt=5: alpha_s(mtau^2)=alsmtautFO[2, 5][5]=0.322977; *)
 (* -->  alpha_s(mtau^2)=0.314405+{^{-0.005858}_{+0.008572}}_{Nt} *)
 (*---*)
 (* Variation of n=5 in a^{(2,n)}(D=0) -> n=5+-1 (kappa=1; Nt=6): *)
 (* n=6: solaALtFOc[2,6][Nn_]:=FindRoot[aatFOD0[2,6,aALf][Nn]==aexpBin77[2,6],{aALf,0.102}]; Clear[aALtFOc]; aALtFOc[2,6][Nn_]:=aALf/.solaALtFOc[2,6][Nn]; Clear[alsmtautFO]; alsmtautFO[2,6][Nn_]:=aMSext[mtau^2/(kappa sigmax),aALtFOc[2,6][Nn]] Pi; : *)
 (* n=6: alpha_s(mtau^2)=alsmtautFO[2, 6][6]=0.315027; *)
 (* n=5: alpha_s(mtau^2)=alsmtautFO[2, 5][6]=0.314405; *)
 (* n=4: solaALtFOc[2,4][Nn_]:=FindRoot[aatFOD0[2,4,aALf][Nn]==aexpBin77[2,4],{aALf,0.102}]; Clear[aALtFOc]; aALtFOc[2,4][Nn_]:=aALf/.solaALtFOc[2,4][Nn]; Clear[alsmtautFO]; alsmtautFO[2,4][Nn_]:=aMSext[mtau^2/(kappa sigmax),aALtFOc[2,4][Nn]] Pi; : *)
 (* n=4:  alpha_s(mtau^2)=alsmtautFO[2, 4][6]=0.313503; *)
 (* -->  alpha_s(mtau^2)=0.314405+{^{+0.000622}_{-0.000902}}_{n}
(*----*)
(* Combining, for Nt=6 a^{(2,5)}(D=0) tFO approach: *)
(* alpha_s(mtau^2)=0.314405+{^{+0.003486}_{-0.003574}}_{exp}+{^{+0.004011}_{-0.024771}}_{kappa}+{^{-0.018475}_{...}}_{d4}+{^{-0.005858}_{+0.008572}}_{Nt}+{^{+0.000622}_{-0.000902}}_{n}  = 0.314405 + {^{+0.0101048}_{-0.0316646}} =app 0.3144 +  {^{+0.0101}_{-0.0317}} =app 0.314 +  {^{+0.011}_{-0.031}} *)

 (* End of  tFO a^{(2,5)}_{D=0} approach, Nt=6 *)

 (* Now some graphs (a^{(2,5)}_{D=0} vs Nt) for tFO a^{(2,5)}_{D=0} approach, using alpha_s(mtau^2)=alsmtautFO[2, 5][6]=0.314405 *)
(* i.e., a(sigmax) = aALtFOc[2, 5][6]=0.103595236574454: *)
 Taba25tFOvsNnIR2 (* =Table[{Nn, aatFOD0IR2[2, 5, aALtFOc[2, 5][6]][Nn]}, {Nn, 4, 15}] *) ={{4, 0.320295}, {5, 0.302241}, {6, 0.30024}, {7, 0.313152}, {8, 0.317893}, {9, 0.303391}, {10, 0.292865}, {11, 0.31408}, {12, 0.346172}, {13, 0.333396}, {14, 0.288018}, {15, 0.346733}};
 Taba25tFOvsNnIR3 (* =Table[{Nn, aatFOD0IR3[2, 5, aALtFOc[2, 5][6]][Nn]}, {Nn, 4, 15}] *) = {{4, -0.137125}, {5, -0.123764}, {6, -0.114915}, {7, -0.118486}, {8, -0.128727}, {9, -0.131885}, {10, -0.122042}, {11, -0.110535}, {12, -0.113654}, {13, -0.128198}, {14, -0.127567}, {15, -0.0930696}};
 Taba25tFOvsNnUV1 (* =Table[{Nn, aatFOD0UV1[2, 5, aALtFOc[2, 5][6]][Nn]}, {Nn, 4, 15}] *) = {{4, -0.00325067}, {5, -0.00363718}, {6, -0.00303629}, {7, -0.00472566}, {8, 0.000678484}, {9, -0.0187994}, {10, 0.0621677}, {11, -0.316775}, {12, 1.65157}, {13, -9.59061}, {14, 60.4287}, {15, -411.814}};
 Taba25tFOvsNn (* =Table[{Nn, aatFOD0[2, 5, aALtFOc[2, 5][6]][Nn]}, {Nn, 4, 15}] *) = {{4, 0.179919}, {5, 0.17484}, {6, 0.182289}, {7, 0.189941}, {8, 0.189844}, {9, 0.152706}, {10, 0.232991}, {11, -0.11323}, {12, 1.88409}, {13, -9.38541}, {14, 60.5891}, {15, -411.56}}; ListPlot[Taba25tFOvsNnIR2]; ListPlot[Taba25tFOvsNnIR3]; ListPlot[Taba25tFOvsNnUV1]; ListPlot[Taba25tFOvsNn];*)
 (*  a25tFOavarIR2=ListPlot[{Taba25tFOvsNnIR2}, PlotRange -> {{3.8, 15.2}, {0.285, 0.325}}, PlotStyle -> Black, AxesLabel -> {Style[Subscript[N, t], 13], "tFO:" Style[Superscript[a, "(2,5)"][IR2], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtautFO[2, 5][6] 10000]/10000., 12],Scaled[{0.80, 0.90}]], Inset[Style["(a)", 13], Scaled[{0.2, 0.9}]]}];
a25tFOavarIR3= ListPlot[Taba25tFOvsNnIR3, PlotRange -> {{3.8, 15.2}, {-0.14, -0.10}}, AxesOrigin -> {3.8, -0.14}, PlotStyle -> Black, AxesLabel -> {Style[Subscript[N, t], 13], "tFO:" Style[Superscript[a, "(2,5)"][IR3], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtautFO[2, 5][6] 10000]/10000., 12], Scaled[{0.75, 0.07}]], Inset[Style["(b)", 13], Scaled[{0.3, 0.9}]]}];
a25tFOavarUV1= ListPlot[Taba25tFOvsNnUV1, PlotRange -> {{3.8, 15.2}, {-0.020, 0.020}}, AxesOrigin -> {3.8, 0.000}, PlotStyle -> Black, AxesLabel -> {Style[Subscript[N, t], 13], "tFO:" Style[Superscript[a, "(2,5)"][UV1], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtautFO[2, 5][6] 10000]/10000., 12], Scaled[{0.75, 0.60}]], Inset[Style["(c)", 13], Scaled[{0.5, 0.9}]]}];
a25tFOavar= ListPlot[{Taba25tFOvsNn, ff25exp, ff25miexp, ff25plexp}, PlotRange -> {{3.8, 15.2}, {0.150, 0.235}}, PlotStyle -> {Black, {Blue, PointSize[0.003]}, {Blue, PointSize[0.003]}, {Blue, PointSize[0.003]}}, Filling -> {3 -> {4}}, AxesLabel -> {Style[Subscript[N, t], 13], "tFO:" Style[Superscript[a, "(2,5)"]["all"], 13]}, Epilog -> {Inset[Style[Subscript[\[Alpha], s][Subsuperscript[m, \[Tau], 2]] == Round[alsmtautFO[2, 5][6] 10000]/10000., 12], Scaled[{0.80, 0.10}]], Inset[Style["(d)", 13], Scaled[{0.3, 0.93}]]}];

 (* Export["a25tFOavarIR2.pdf",a25tFOavarIR2]; Export["a25tFOavarIR3.pdf",a25tFOavarIR3]; Export["a25tFOavarUV1.pdf",a25tFOavarUV1]; Export["a25tFOavar.pdf",a25FOavar]; *)
 (*------------------------------------------------------------------*)
 (*------------------------------------------------------------------*)
  (* End of  FO and tFO approaches *)
  (*------------------------------------------------------------------*)
 (*------------------------------------------------------------------*)
   (*------------------------------------------------------------------*)
 (*------------------------------------------------------------------*) 
    (* (Double-)Pinched ('P') Borel-Laplace in CI approach (PCI): *)


  kappa=1;  (* kappa = mu^2/Q^2, where mu^2 is RScl *)
  tkap=kappa Exp[tKK];
 
 (* Now (double) pinched ('P') Re[BPCI]: *)

(* Integration of 5-loop MSbar RGE in the circle with |Q^2|=kappa sigmax: *)
(* x=Log[kappa sigmax Exp[I th]]; dx= I dth = I dth;  *)
(* a[kappa sigmax Exp[I th]] = y[yh]; *) 
 (* sol1a[aALf_? NumberQ]:=NDSolve[{-I y'[th]==bta[y[th]], y[0]==aALf}, y, {th,-Pi,+Pi}]; *)
sol1a[aALf_]:= NDSolve[{-I y'[th] == bta[y[th]], y[0] == aALf}, y, {th, -Pi, +Pi}];
 aCI[th_, aALf_] := First[y[th] /. sol1a[aALf]];
(* aALf=a(kappa sigmax); aCI[th,aALf]=a(Q2=kappa sigma Exp[I th]) *)
 
  (*  aMSp[Q2f_, fif_, alsinf_] := Module[{Q2ff = Q2f, fiff = fif, alsinff = alsinf}, Clear[alsin] ; alsin = alsinff; <</home/gorazd/3danQCD.dir/aMSQ2complS_almtauinput.m; aMSpert[Q2ff, fiff]]; such that aMSp[Q2,fi,als] = a(Q2 Exp[I*fi]) such that alpha_s(mtau^2)=als *)

     dff[th_, Nn_, aALf_] := Module[{aa}, aa = aCI[th, aALf]; Sum[ddtk[nn - 1,tkap] aa^nn, {nn, 1, Nn}]]; (* = d_{D=0}(Q^2=sigmax Exp[I th])^{[Nn]} (TPS [Nn}) such that a[sigmax]=aALf *)

   BPCID0[M2_?NumberQ, Nn_, aALf_]:= (1/(2 Pi)) NIntegrate[(((1 + Exp[I th])^2 - 2 (M2/sigmax) (1 + Exp[I th]) + 2 (M2/sigmax)^2) Exp[(sigmax/M2) Exp[I th]] - 2 (M2/sigmax)^2 Exp[-(sigmax/M2)]) dff[th,Nn,aALf], {th, -Pi, Pi}];  
   (* aALf= a(kappa sigmax) *)

   ReBPCI[M2f_,Nn_,aALf_,O4_,O6_,O8_]:=Re[((1- 2 M2f/sigmax) + 2 (M2f/sigmax)^2 (1 - Exp[-sigmax/M2f]))+BPCID0[M2f,Nn,aALf]+  2 Pi^2 ( (1/(M2f sigmax))(2 O4 + O6/sigmax) + (1/M2f^2) (O4 + 2 (O6/sigmax) + (O8/sigmax^2)) + (1/M2f^3) (1/2)(O6 + 2 O8/sigmax) + (1/M2f^4) (1/6) O8 )]; (* Re[B[M2,Nn,O4,O6,O8]] for CIPT truncated at a^Nn, RScl kap=1 *)
    (* aALf= a(kappa sigmax) *)
  
(* Now search for condensate values with this Borel-Laplace (double) pinched ('P') approach, with FO method for D=0 part: *)
NchP=10; (* number of intervals in: (M2min < |M^2} < 1.5) *)
M2FP[ii_]:=M2min+ii*(1.5-M2min)/NchP; (* ii=0,1,2,...,NchP *)
(* We will use sum of squares minimization in this interval, for M^2=|M^2| Exp[I Psi] with Psi=0, Pi/6, Pi/4 one after another in the sum (it turns out that it is not good to include Psi=Pi/3, this value appears to be too large, and xi^2 become large): *)

O4init = -0.0030; O6init = 0.00073; O8init = -0.0010; aALfinit = 0.1100;
alO4O6O8fitPCIMinN[Nn_]:= FindMinimum[Sum[(ReBPCI[M2FP[jj] Exp[I Pi/6], Nn, aALf,O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/6]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/6]]^2, {jj, 0, NchP}]+Sum[(ReBPCI[M2FP[jj] Exp[I Pi/4], Nn, aALf, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/4]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/4]]^2, {jj, 0, NchP}]+Sum[(ReBPCI[M2FP[jj], Nn, aALf, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj]])^2/delReBPexpBinAL[M2FP[jj]]^2, {jj, 0, NchP}], {{aALf,aALfinit},{O4fitf, O4init},{O6fitf, O6init},{O8fitf, O8init}}];
(* aALf=alpha_s(kappa*sigmax)/Pi *)

  (* Do[alO4O6O8fitPCIMinnum[nn]=alO4O6O8fitPCIMinN[nn], {nn, 3, 9}]; *)
(* Save["O4O6fitMinALEPH1179090.save", {M2min, NchP, alO4O6O8fitPCIMinnum}]; *)
  (* NchP = 10; kappa=1; aALf=alpha_s(sigmax)/Pi is VARIED, PCI approach: *)
  (*
 alO4O6O8fitPCIMinnum[3]={0.000221563, {aALf -> 0.117035, O4fitf -> -0.00186963, O6fitf -> 0.000772341, O8fitf -> -0.000578283}};
alO4O6O8fitPCIMinnum[4]={0.00028700975033112906`, {aALf -> 0.11274158685352208`, O4fitf -> -0.0021784893079573107`, O6fitf -> 0.0007836556746995963`, O8fitf -> -0.0006544488116004706`}};
alO4O6O8fitPCIMinnum[5]={0.00023087384541395543`, {aALf -> 0.11068523409892024`, O4fitf -> -0.0025578308620901797`, O6fitf -> 0.0007549465433464493`, O8fitf -> -0.0008047841334926128`}};
alO4O6O8fitPCIMinnum[6] = {0.00003536255740286532`, {aALf -> 0.10932911592318846`, O4fitf -> -0.0031821822981273683`, O6fitf -> 0.0006679484352300046`, O8fitf -> -0.0011746409367742357`}}; 
   (* kappa=0.5 (and aALfinit= 0.110; [or aALfinit= 0.140; Timing=2286 in this case]): Timing[alO4O6O8fitPCIMinN[6]]={2481.58063`, {3.1184446691473835`, {aALf -> 0.13227417805860628`, O4fitf -> -0.0026452809945032864`, O6fitf -> -0.0007920791021445206`, O8fitf -> -0.002319912265885921`}}}, need very large time; aALF=a(0.5 sigmax)=0.13227417805860628 -> a(sigmax)=0.10406754 *)
   (* kappa=2.0 (and aALfinit= 0.095): Timing[alO4O6O8fitPCIMinN[6]]={401.479, {0.000675089, {aALf -> 0.0908428, O4fitf -> -0.00221542, O6fitf -> 0.000844018, O8fitf -> -0.000509738}}}; aALF=a(2 sigma)=0.0908428 -> a(sigmax)=-0.110378 *)   
   (* when here varying del(aALF)=+-10.^-6 -> xi^2=0.0444; del(O4)=+-10.^6 -> xi^2=0.0055; del(O6)=+-10.^-4 -> xi^2=0.0022; del(O8)=+-10.^-6 -> xi^2=0.0006;*)
   alO4O6O8fitPCIMinnum[7]={0.000483966, {aALf -> 0.109126, O4fitf -> -0.00391132, O6fitf -> 0.00059628, O8fitf -> -0.00182125}};
alO4O6O8fitPCIMinnum[8]={0.0472051, {aALf -> 0.11145, O4fitf -> -0.00628906, O6fitf -> 0.000838243, O8fitf -> -0.00491111}};
alO4O6O8fitPCIMinnum[9]={0.747966, {aALf -> 0.108581, O4fitf -> -0.00554317, O6fitf -> -0.000168577, O8fitf -> -0.00483238}};
alO4O6O8fitPCIMinnum[10]={4.7644034346336595`, {aALf -> 0.10121996689194891`, O4fitf -> -0.002873408334100184`, O6fitf -> -0.0025728696722904926`, O8fitf -> -0.0029370280764395755`}};
Clear[Nn]; Do[Module[{}, xi2CI[Nn]=alO4O6O8fitPCIMinnum[Nn][[1]]; aALfCI[Nn]=aALf/.alO4O6O8fitPCIMinnum[Nn][[2]]; alsmtauCI[Nn]=aMSext[mtauphys^2/(kappa sigmax),aALfCI[Nn]] Pi;  O4CI[Nn]=O4fitf/.alO4O6O8fitPCIMinnum[Nn][[2]]; O6CI[Nn]=O6fitf/.alO4O6O8fitPCIMinnum[Nn][[2]]; O8CI[Nn]=O8fitf/.alO4O6O8fitPCIMinnum[Nn][[2]]],{Nn,3,10}];
*)
(*----------------*)		     
  (* Now with FIXED ('af', 'a108') aALf=aALCIc[2, 5][10]=0.108366  (alpha_s(mtau^2)=0.3282) as suggested by a^{(2,5}}_{th} = a^{(2,5}_{exp}, see below *)
O4init = -0.0020; O6init = 0.001; O8init = -0.0010; aAL=0.108366;
O4O6O8fitPCIMinN[Nn_]:= FindMinimum[Sum[(ReBPCI[M2FP[jj] Exp[I Pi/6], Nn, aAL,O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/6]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/6]]^2, {jj, 0, NchP}]+Sum[(ReBPCI[M2FP[jj] Exp[I Pi/4], Nn, aAL, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/4]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/4]]^2, {jj, 0, NchP}]+Sum[(ReBPCI[M2FP[jj], Nn, aAL, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj]])^2/delReBPexpBinAL[M2FP[jj]]^2, {jj, 0, NchP}], {{O4fitf, O4init},{O6fitf, O6init},{O8fitf, O8init}}];
(* aALf=alpha_s(kappa*sigmax)/Pi *)
(* NchP=10; kappa=1; aALf=aAL=0.108366: *)
(* Do[O4O6O8fitPCIMinnum[nn]=O4O6O8fitPCIMinN[nn], {nn, 3, 9}]; *)
 (*
  aAL=0.108366;
 O4O6O8fitPCIMinnum[3]={1.8716408772458926`, {O4fitf -> 0.0003898429489216285`, O6fitf -> -0.0013964044571519558`, O8fitf -> 0.0010994221082827732`}};
O4O6O8fitPCIMinnum[4]={0.5747823360367895`, {O4fitf -> -0.0008506171990349143`, O6fitf -> -0.0004107356261188256`, O8fitf -> 0.0003139186252932559`}};
O4O6O8fitPCIMinnum[5]={0.17489570447309233`, {O4fitf -> -0.0017695579675988512`, O6fitf -> 0.00010151674248448584`, O8fitf -> -0.00022842909549841873`}};
O4O6O8fitPCIMinnum[6]={0.02972729382200754`, {O4fitf -> -0.002809675524352654`, O6fitf -> 0.0003988358258126109`, O8fitf -> -0.0008884921111485519`}};
O4O6O8fitPCIMinnum[7]={0.01594025734089721`, {O4fitf -> -0.003586256125394526`, O6fitf -> 0.0003927691890405307`, O8fitf -> -0.0015436294420933775`}};
O4O6O8fitPCIMinnum[8]={0.14174156565212348`, {O4fitf -> -0.004711539842482837`, O6fitf -> 0.00007957712999136704`, O8fitf -> -0.0030511612418070697`}};
O4O6O8fitPCIMinnum[9]={0.7492268611860113`, {O4fitf -> -0.005425191389137822`, O6fitf -> -0.00022073649829662225`, O8fitf -> -0.004668031353404288`}};
O4O6O8fitPCIMinnum[10]={12.476780615320635`, {O4fitf -> -0.0073119290181601106`, O6fitf -> -0.0007415585413454499`, O8fitf -> -0.011560667709631382`}};
O4O6O8fitPCIMinnum[11]={19.931587837377496`, {O4fitf -> -0.007706522897684047`, O6fitf -> -0.0006429496478835439`, O8fitf -> -0.013618386993742897`}};
O4O6O8fitPCIMinnum[12]={796.972868927756`, {O4fitf -> -0.014865983069589857`, O6fitf -> 0.0066732766651677695`, O8fitf -> -0.059585541466050794`}};
O4O6O8fitPCIMinnum[13]={5.4486259855243135`, {O4fitf -> -0.0073776001162540955`, O6fitf -> -0.006545077377638051`, O8fitf -> -0.007356025826837298`}};
O4O6O8fitPCIMinnum[14]={85641.12286050567`, {O4fitf -> -0.07133837259205647`, O6fitf -> 0.14148942581907142`, O8fitf -> -0.45456555208254495`}};
  O4O6O8fitPCIMinnum[15]={339367.4556100354`, {O4fitf -> 0.10431587353492576`, O6fitf -> -0.3259240666343542`, O8fitf -> 0.7265963552442568`}};
Clear[Nn]; Do[Module[{}, xi2CIaf[Nn]=O4O6O8fitPCIMinnum[Nn][[1]]; aALfCIaf[Nn]=aAL; alsmtauCIaf[Nn]=aMSext[mtauphys^2/(kappa sigmax),aAL] Pi;  O4CIaf[Nn]=O4fitf/.O4O6O8fitPCIMinnum[Nn][[2]]; O6CIaf[Nn]=O6fitf/.O4O6O8fitPCIMinnum[Nn][[2]]; O8CIaf[Nn]=O8fitf/.O4O6O8fitPCIMinnum[Nn][[2]]],{Nn,3,15}];
 *) 
 (*----------------*) 
  (* Now, for comparison with the nonpinched Borel-Laplace CI approach: double-pinched CI Borel Laplace with O8=0 and aAlf=aAL(=0.10332864134432757, FIXED, corresponding to alpha_s(MZ^2)=0.1179): *)
O4init=0.001; O6init=-0.001; O8init=0.; aALfinit=aAL;
O4O6fitPCIMinN[Nn_]:= FindMinimum[Sum[(ReBPCI[M2FP[jj] Exp[I Pi/6], Nn, aAL,O4fitf,O6fitf,0] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/6]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/6]]^2, {jj, 0, NchP}]+Sum[(ReBPCI[M2FP[jj] Exp[I Pi/4], Nn, aAL, O4fitf,O6fitf,0] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/4]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/4]]^2, {jj, 0, NchP}]+Sum[(ReBPCI[M2FP[jj], Nn, aAL, O4fitf,O6fitf,0] - ReBPexpBinAL[M2FP[jj]])^2/delReBPexpBinAL[M2FP[jj]]^2, {jj, 0, NchP}], {{O4fitf, O4init},{O6fitf, O6init}}];
(* aAL=alpha_s(sigmax)/Pi *)
(* O4O6fitPCIMinN[3]={35.3103, {O4fitf -> 0.000959324, O6fitf -> -0.000839135}};
 O4O6fitPCIMinN[4]={16.73, {O4fitf -> 0.000150264, O6fitf -> -0.000556906}};
 O4O6fitPCIMinN[5]={8.54736, {O4fitf -> -0.000448346, O6fitf -> -0.000472715}};
 O4O6fitPCIMinN[6]={3.0477, {O4fitf -> -0.00110946, O6fitf -> -0.000584171}};
 O4O6fitPCIMinN[7]={1.10433, {O4fitf -> -0.00156774, O6fitf -> -0.000894152}};
 O4O6fitPCIMinN[8]={4.7338, {O4fitf -> -0.00212084, O6fitf -> -0.00181309}};
 O4O6fitPCIMinN[9]={18.3515, {O4fitf -> -0.00234362, O6fitf -> -0.00278726}};
 O4O6fitPCIMinN[10]={178.39, {O4fitf -> -0.00242802, O6fitf -> -0.00648941}}; *)
(* Only moderately close to the nonpinched Borel-Laplace CI results, see O4O6fitMinALEPH1179090.save *)
 
(* end of double-pinched CI (PCI) Borel-Laplace *)
(*---------------------------------------------------------------------_*)
 (* Now FESR (2,n) moments a^{(2,n)} (i.e., double-pinched) in CI: *)
 (*--------*)
 (* First the experimental ALEPH values of (2,n) moments a^{(2,n)} (see also file rtauALEPH.m): *)
grs0a[2,nn_][sig_]:=((nn+3)/(nn+1)) (1/sigmax) (1 - (nn+2) (sig/sigmax)^(nn+1) + (nn+1) (sig/sigmax)^(nn+2) );
aexpBin77[2,nn_]:=(Sum[ dsbin[[ii]] grs0a[2,nn][sbin[[ii]]] OmegaVplA[ii],{ii,1,77}] + 2 Pi^2 fPi^2 grs0a[2,nn][mPi^2]) -  1;
delaexpBin77[2,nn_]:=(2 Pi^2) Sqrt[Sum[ grs0a[2,nn][sbin[[ii]]] grs0a[2,nn][sbin[[jj]]] dsbin[[ii]] dsbin[[jj]](  covVV[ii,jj]+covAA[ii,jj]+ covVA[ii,jj]+covAV[ii,jj] ),{ii,1,77},{jj,1,77}]];
(*  aexpBin77[2,n] +- delaexpBin77[2,n] = a^{(2,n)}_{exp} *)
(*---*)
(* Now the experimental ALEPH values for (1,n) moments a^{(1,n)} (see also the file rtauALEPH.m): *)
 grs0a[1,nn_][sig_]:=((nn+2)/(nn+1)) (1/sigmax) (1 - (sig/sigmax)^(nn+1));
aexpBin77[1,nn_]:=(Sum[ dsbin[[ii]] grs0a[1,nn][sbin[[ii]]] OmegaVplA[ii],{ii,1,77}] + 2 Pi^2 fPi^2 grs0a[1,nn][mPi^2]) -  1;
delaexpBin77[1,nn_]:=(2 Pi^2) Sqrt[Sum[ grs0a[1,nn][sbin[[ii]]] grs0a[1,nn][sbin[[jj]]] dsbin[[ii]] dsbin[[jj]](  covVV[ii,jj]+covAA[ii,jj]+ covVA[ii,jj]+covAV[ii,jj] ),{ii,1,77},{jj,1,77}]];
(*  a^{(1,n)}_{exp} = aexpBin77[1,n] +- delaexpBin77[1,n] *)
(*--------*)
(* Now the theoretical FESR (2,n) moments a^{(2,n)} in CI: *)

kappa=1;  (* kappa = mu^2/Q^2, where mu^2 is RScl *)
tkap=kappa Exp[tKK];
 
(* Integration of 5-loop MSbar RGE in the circle with |Q^2|=kappa sigmax: *)
(* x=Log[kappa sigmax Exp[I th]]; dx= I dth = I dth;  *)
(* a[kappa sigmax Exp[I th]] = y[yh]; *) 
(*'*)
 sol1a[aALf_]:= NDSolve[{-I y'[th] == bta[y[th]], y[0] == aALf}, y, {th, -Pi, +Pi}];
 aCI[th_, aALf_] := First[y[th] /. sol1a[aALf]];
   (* aALf=a(kappa sigmax); aCI[th,aALf]=a(Q2=kappa sigma Exp[I th]) *)
   
     dff[th_, Nn_, aALf_] := Module[{aa}, aa = aCI[th, aALf]; Sum[ddtk[nn - 1,tkap] aa^nn, {nn, 1, Nn}]]; (* = d_{D=0}(Q^2=sigmax Exp[I th])^{[Nn]} (TPS [Nn}) such that a[sigmax]=aALf *)
  (*-----*)  
(* moments a^{(2,n}}, CI: *)			     
   aaCID0fast[2,nn_,aALf_][Nn_]:=(1/(2 Pi)) ((nn+3)/(nn+1))  NIntegrate[ ( Exp[I th] (1 - (-Exp[I th])^(nn+1)) + ((nn+1)/(nn+3))(1 - (-Exp[I th])^(nn+3)) ) dff[th,Nn,aALf], {th, -Pi, Pi}];
   (* aALf= a(kappa sigmax) *)
   (*  aaCID0fast[2,nn,aALf][NN] is a^{(2,nn)} moment calculated with the value of  a(kappa sigmax) equal to aALf, calculated to truncation order Nn (~a^Nn) *)
aaCIfast[2,n_,aALf_][NN_,O2np4_,O2np6_]:=aaCID0fast[2,n,aALf][NN] + ((n+3)/(n+1)) 2 Pi^2 (-1)^n ( (n+2) O2np4/sigmax^(n+2) + (n+1) O2np6/sigmax^(n+3) );
(* O2np4= <O_{2 n + 4}>_{V+A}; O2np6= <O_{2 n + 6}>_{V+A}; *)
  (* Note, on 2 March 2021 I compared with Cesar and found out an error in my prg in aaFOfast[2,n], aaCIfast[2,n], aaPVfast[2,n], aaRenfast[2,n]: the factor in front of the condensates must be (n+3)/(n+1), and NOT (n+3)/(n+2); this is numerically important *)
  (*----*)
(* moments a^{(1,n}}, CI: *)
  aaCID0fast[1,nn_,aALf_][Nn_]:=(1/(2 Pi)) ((nn+2)/(nn+1))  NIntegrate[ ( (1 + Exp[I th]) - (1/(nn+2))(1 - (-Exp[I th])^(nn+2)) ) dff[th,Nn,aALf], {th, -Pi, Pi}];
   (* aALf= a(kappa sigmax) *)
aaCIfast[1,n_,aALf_][Nn_, O2np4_]:=aaCID0fast[1,n,aALf][NN]+((n+2)/(n+1)) 2 Pi^2 (-1)^n O2np4/sigmax^(n+2); 
  (*------*)
(* When aALf=a(sigmax) is varied ('avar'), i.e.,using alO4O6O8fitPFOMinnum[N] (N=3,4,...15): *)			     
(*
 Tab20D0CIavar=Table[{NN,Re[aaCID0fast[2,0,aALfCI[NN]][NN]]},{NN,3,10}];
 (* Tab20CIavar=Table[{NN,aaCIfast[2,0,aALfCI[NN]][NN,O4CI[NN],O6CI[NN]]},{NN,3,10}];*)
 Tab20CIavar=Table[{NN, Tab20D0CIavar[[NN - 2]][[2]] + ((0 + 3)/(0 + 1)) 2 Pi^2 (-1)^0 ((0 + 2) O4CI[NN]/sigmax^(0 + 2) + (0 + 1) O6CI[NN]/sigmax^(0 + 3))}, {NN, 3, 10}];
 delTab20CIavar= Table[{NN, Tab20CIavar[[NN - 2]][[2]] - Tab20CIavar[[NN - 3]][[2]]}, {NN, 4, 10}]; (* --> minimum at Nt=5 (i.e., practically no change from Nt=4 to Nt=5) *)
 Tab21D0CIavar=Table[{NN,Re[aaCID0fast[2,1,aALfCI[NN]][NN]]},{NN,3,10}]; 
 (* Tab21CIavar=Table[{NN,aaCIfast[2,1,aALfCI[NN]][NN,O6CI[NN],O8CI[NN]]},{NN,3,10}];*)
  Tab21CIavar=Table[{NN, Tab21D0CIavar[[NN - 2]][[2]] + ((1 + 3)/(1 + 1)) 2 Pi^2 (-1)^1 ((1 + 2) O6CI[NN]/sigmax^(1 + 2) + (1 + 1) O8CI[NN]/sigmax^(1 + 3))}, {NN, 3, 10}];
 delTab21CIavar= Table[{NN, Tab21CIavar[[NN - 2]][[2]] - Tab21CIavar[[NN - 3]][[2]]}, {NN, 4, 10}];  (*-->  local minimum at about Nt=5 (almost no change when from Nt=4 to Nt=5) *)
 Tab10D0CIavar=Table[{NN,Re[aaCID0fast[1, 0, aALfCI[NN]][NN]]},{NN,3,10}];
  Tab10CIavar=Table[{NN,Tab10D0CIavar[[NN - 2]][[2]] + ((0+2)/(0+1)) 2 Pi^2 (-1)^0 O4CI[NN]/sigmax^(0 + 2)}, {NN, 3, 10}];
delTab10CIavar= Table[{NN, Tab10CIavar[[NN - 2]][[2]] - Tab10CIavar[[NN - 3]][[2]]}, {NN, 4, 10}];  (* --> most stable when going from Nt=4 -> Nt=5 --> so Nt=5 is the best *)
ff20exp=Table[{NN,aexpBin77[2,0]},{NN,3,15}]; ff20plexp=Table[{NN,aexpBin77[2,0]+delaexpBin77[2,0]},{NN,3,15}]; ff20miexp=Table[{NN,aexpBin77[2,0]-delaexpBin77[2,0]},{NN,3,15}];
ff21exp=Table[{NN,aexpBin77[2,1]},{NN,3,15}];  ff21plexp=Table[{NN,aexpBin77[2,1]+delaexpBin77[2,1]},{NN,3,15}]; ff21miexp=Table[{NN,aexpBin77[2,1]-delaexpBin77[2,1]},{NN,3,15}];
ff10exp=Table[{NN,aexpBin77[1,0]},{NN,3,15}]; ff10plexp=Table[{NN,aexpBin77[1,0]+delaexpBin77[1,0]},{NN,3,15}]; ff10miexp=Table[{NN,aexpBin77[1,0]-delaexpBin77[1,0]},{NN,3,15}];
  *)
(* a21, a20, a10 most stable at Nt=5, so I will take Nt=5 in CI global approach *)  
  (*
 a20CIavar=ListPlot[{Tab20D0CIavar, Tab20CIavar, ff20exp, ff20miexp, ff20plexp}, PlotRange -> {{2.8, 10.2}, {0.205, 0.35}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "CI:" Superscript[(a), "(2,0)"]},Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.85}]]}]
 a20CIavarZoom =ListPlot[{Tab20D0CIavar, Tab20CIavar, ff20exp, ff20miexp, ff20plexp},PlotRange -> {{2.8, 10.2}, {0.235, 0.245}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "CI:" Superscript[a, "(2,0)"]},Epilog -> {Inset[Style["(b)", 13], Scaled[{0.15, 0.95}]]}]
a21CIavar=ListPlot[{Tab21D0CIavar, Tab21CIavar, ff21exp, ff21miexp, ff21plexp}, PlotRange -> {{2.8, 10.2}, {0.19, 0.22}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "CI:" Superscript[a, "(2,1)"]},Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.85}]]}]
a21CIavarZoom=ListPlot[{Tab21D0CIavar, Tab21CIavar, ff21exp, ff21miexp, ff21plexp}, PlotRange -> {{2.8, 10.2}, {0.20, 0.210}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "CI:" Superscript[a, "(2,1)"]},Epilog -> {Inset[Style["(b)", 13], Scaled[{0.40, 0.95}]]}]
 a10CIavar=ListPlot[{Tab10D0CIavar, Tab10CIavar, ff10exp, ff10miexp, ff10plexp}, PlotRange -> {{2.8, 10.2}, {0.19, 0.24}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "CI:" Superscript[(a), "(1,0)"]},Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.85}]]}]
a10CIavarZoom =ListPlot[{Tab10D0CIavar, Tab10CIavar, ff10exp, ff10miexp, ff10plexp},PlotRange -> {{2.8, 10.2}, {0.20, 0.21}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "CI:" Superscript[a, "(1,0)"]},Epilog -> {Inset[Style["(b)", 13], Scaled[{0.20, 0.85}]]}]
   *) 
(* a20 and a21 (and a10) show stability at Nt=5 (the smallest change when Nt=4->Nt=5) --> so we will choose Nt=5 in the CI global approach *)
  (*----------*)
(* When aALf=a(sigmax)=0.108366 is fixed ('a108', 'af', the central value in the CI a^{(2,5))-approach), i.e.,using O4O6O8fitPCIMinnum[N] (N=3,4,...15): *)
(*
 Tab20D0CIa108=Table[{NN,Re[aaCID0fast[2,0,aALfCIaf[NN]][NN]]},{NN,3,15}];
(*Tab20CIa108=Table[{NN,aaCIfast[2,0,aALfCIaf[NN]][NN,O4CIaf[NN],O6CIaf[NN]]},{NN,3,15}];*) 
 Tab20CIa108=Table[{NN, Tab20D0CIa108[[NN - 2]][[2]] + ((0 + 3)/(0 + 1)) 2 Pi^2 (-1)^0 ((0 + 2) O4CIaf[NN]/sigmax^(0 + 2) + (0 + 1) O6CIaf[NN]/sigmax^(0 + 3))}, {NN, 3, 15}]; delTab20CIa108=Table[{Nn, Tab20CIa108[[Nn-2]][[2]]-Tab20CIa108[[Nn-3]][[2]]},{Nn,4,15}];  (* Nt=8 has the smallest variation, i.e., Nt=7->Nt=8 the smallest variation *)
Tab21D0CIa108=Table[{NN,Re[aaCID0fast[2,1,aALfCIaf[NN]][NN]]},{NN,3,15}]; 
(*Tab21CIa108=Table[{NN,aaCIfast[2,1,aALfCIaf[NN]][NN,O6CIaf[NN],O8CIaf[NN]]},{NN,3,15}];*)
Tab21CIa108=Table[{NN, Tab21D0CIa108[[NN - 2]][[2]] + ((1 + 3)/(1 + 1)) 2 Pi^2 (-1)^1 ((1 + 2) O6CIaf[NN]/sigmax^(1 + 2) + (1 + 1) O8CIaf[NN]/sigmax^(1 + 3))}, {NN, 3, 15}]; delTab21CIa108=Table[{Nn, Tab21CIa108[[Nn-2]][[2]]-Tab21CIa108[[Nn-3]][[2]]},{Nn,4,15}];  (* Nt=8 has the smallest variation, i.e., Nt=7->Nt=8 the smallest variation *)
Tab10D0CIa108=Table[{NN,Re[aaCID0fast[1, 0, aALfCIaf[NN]][NN]]},{NN,3,15}];
 Tab10CIa108=Table[{NN,Tab10D0CIa108[[NN - 2]][[2]] + ((0+2)/(0+1)) 2 Pi^2 (-1)^0 O4CIaf[NN]/sigmax^(0 + 2)}, {NN, 3, 15}]; delTab10CIa108=Table[{Nn, Tab10CIa108[[Nn-2]][[2]]-Tab10CIa108[[Nn-3]][[2]]},{Nn,4,15}]; (* Nt=9 has the smallest variation, i.e., Nt=8->Nt=9 the smallest variation *)
 *)
  
(*
 a20CIa108 = ListPlot[{Tab20D0CIa108, Tab20CIa108, ff20exp, ff20miexp, ff20plexp},PlotRange -> {{2.8, 15.2}, {0.20, 0.36}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black,PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "CI:" Superscript[a, "(2,0)"]}, Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.95}]], Inset[Style[Subscript[\[Alpha], s][Subscript[\[Sigma], max]]/\[Pi] == Round[10000 aAL]/10000., 12], Scaled[{0.22, 0.8}]]}] 
 a20CIa108Zoom=ListPlot[{Tab20D0CIa108, Tab20CIa108, ff20exp, ff20miexp, ff20plexp}, PlotRange -> {{2.8, 10.2}, {0.235, 0.245}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "CI:" Superscript[a, "(2,0)"]}, Epilog -> {Inset[Style["(b)", 13], Scaled[{0.15, 0.95}]], Inset[Style[Subscript[\[Alpha], s][Subscript[\[Sigma], max]]/\[Pi] == Round[10000 aAL]/10000., 12], Scaled[{0.45, 0.9}]]}]
a21CIa108=ListPlot[{Tab21D0CIa108, Tab21CIa108, ff21exp, ff21miexp, ff21plexp}, PlotRange -> {{2.8, 15.2}, {0.17, 0.22}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "CI:" Superscript[a, "(2,1)"]}, Epilog -> {Inset[Style["(a)", 13], Scaled[{0.15, 0.90}]], Inset[Style[Subscript[\[Alpha], s][Subscript[\[Sigma], max]]/\[Pi] == Round[10000 aAL]/10000., 12], Scaled[{0.3, 0.25}]]}]
a21CIa108Zoom=ListPlot[{Tab21D0CIa108, Tab21CIa108, ff21exp, ff21miexp, ff21plexp}, PlotRange -> {{2.8, 10.2}, {0.20, 0.21}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "CI:" Superscript[a, "(2,1)"]}, Epilog -> {Inset[Style["(b)", 13], Scaled[{0.15, 0.90}]], Inset[Style[Subscript[\[Alpha], s][Subscript[\[Sigma], max]]/\[Pi] == Round[10000 aAL]/10000., 12], Scaled[{0.22, 0.15}]]}]
a10CIa108 = ListPlot[{Tab10D0CIa108, Tab10CIa108, ff10exp, ff10miexp, ff10plexp},PlotRange -> {{2.8, 15.2}, {0.18, 0.25}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black,PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "CI:" Superscript[a, "(1,0)"]}, Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.95}]], Inset[Style[Subscript[\[Alpha], s][Subscript[\[Sigma], max]]/\[Pi] == Round[10000 aAL]/10000., 12], Scaled[{0.22, 0.8}]]}]
 a10CIa108Zoom=ListPlot[{Tab10D0CIa108, Tab10CIa108, ff10exp, ff10miexp, ff10plexp}, PlotRange -> {{2.8, 10.2}, {0.20, 0.21}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "CI:" Superscript[a, "(1,0)"]}, Epilog -> {Inset[Style["(b)", 13], Scaled[{0.15, 0.95}]], Inset[Style[Subscript[\[Alpha], s][Subscript[\[Sigma], max]]/\[Pi] == Round[10000 aAL]/10000., 12], Scaled[{0.65, 0.15}]]}]
 *)
 
 (* Note, when aALf = aAL (=0.108366) is FIXED (a108), then the red points in the above ListPlots represent somewhat weaker stabilization then in the case when aALF is varied (avar) *)
 (* This seems alright *)

(*-------------------------------------------------*)
(*-------------------------------------------------*)									
(* Now continuing the global fit CI approach: Nt=5 is the preferred order of truncation, according to our analysis of a^{(2,1)}, a^{(2,0)} and a^{(1,0)}. *)

Nt0=5;									
(* The precise central value result of the CI global fit: *)
alO4O6O8fitPCIMinnum[5]={0.000230874, {aALf -> 0.110685234, O4fitf -> -0.00255783, O6fitf -> 0.000754947, O8fitf -> -0.000804784}};
									
(* First the estimate fo experimental uncertainties of alAL, O4, O6, O8 in the Nt=6 CI global Borel-Laplace fit; due to instabilities and possible underestimations, we do not use the correlated (with variances) chi^2, but rather the uncorrelated chi^2:  *)									
(* Number of equidistant points Nm in the interval 0.9 =< |M^2| =< 1.5 GeV^2: *)
Nm=2; Nd=3 Nm;  
M2cov1F[ii_]:=0.90+(ii-1)*0.60/(Nm-1); (* ii=1,..,Nm; this gives M2covF[1]=0.90, ... M2covF[Nm]=1.5 *)
Do[M2covF[jj]=M2cov1F[jj],{jj,1,Nm}]; Do[M2covF[jj+Nm]=M2cov1F[jj] Exp[I Pi/6],{jj,1,Nm}]; Do[M2covF[jj+2 Nm]=M2cov1F[jj] Exp[I Pi/4],{jj,1,Nm}]; (* in this way we have 3 Nm=Nd points M^2 in the complex M^2-plane, three with Psi=0, three with Psi=Pi/6, and three with Psi=Pi/4 *)
(* Now vary O4 in UNCORRELATED chi ('var'): *)
(* Note: VBBexpFAux[M2,M2] = delReBPexpBinAL[M2]^2, as it should be *)
chi2o2O4[O4f_]:=Sum[(ReBPCI[M2covF[jj],Nt0,aALfCI[Nt0],O4f,O6CI[Nt0],O8CI[Nt0]] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
O4CIvarfitMin=FindMinimum[chi2o2O4[O4fitf],{O4fitf,O4CI[Nt0]}];
O4CIvarfit=O4fitf/.O4CIvarfitMin[[2]];
Xi2O4CIvaro77=O4CIvarfitMin[[1]];
O4CIvarfitnum=	O4CIvarfit;
delO4CI= delO4f/.FindRoot[chi2o2O4[O4CIvarfitnum+delO4f]==Xi2O4CIvaro77+1,{delO4f, 3. 10^-5}];
(* --> for Nm=2 (Nd=6) we obtain: delO4CI=0.0000304; note that O4CI[5]=-0.00255783, by global analysis *)

chi2o2O6[O6f_]:=Sum[(ReBPCI[M2covF[jj],Nt0,aALfCI[Nt0],O4CI[Nt0],O6f,O8CI[Nt0]] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
O6CIvarfitMin=FindMinimum[chi2o2O6[O6fitf],{O6fitf,O6CI[Nt0]}];
O6CIvarfit=O6fitf/.O6CIvarfitMin[[2]];
Xi2O6CIvaro77=O6CIvarfitMin[[1]];
 delO6CI= delO6f/.FindRoot[chi2o2O6[O6CIvarfit+delO6f]==Xi2O6CIvaro77+1,{delO6f, 3. 10^-5}];
(* Nm=2; Nd=6; delO6CI=0.0000451; *)

chi2o2O8[O8f_]:=Sum[(ReBPCI[M2covF[jj],Nt0,aALfCI[Nt0],O4CI[Nt0],O6CI[Nt0],O8f] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
O8CIvarfitMin=FindMinimum[chi2o2O8[O8fitf],{O8fitf,O8CI[Nt0]}];
O8CIvarfit=O8fitf/.O8CIvarfitMin[[2]];
Xi2O8CIvaro77=O8CIvarfitMin[[1]];
 delO8CI= delO8f/.FindRoot[chi2o2O8[O8CIvarfit+delO8f]==Xi2O8CIvaro77+1,{delO8f, 3. 10^-5}];
(* Nm=2; Nd=6; delO8CI=0.0000809; *)

chi2o2aAL[aALf_]:=Sum[(ReBPCI[M2covF[jj],Nt0,aALf,O4CI[Nt0],O6CI[Nt0],O8CI[Nt0]] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
aALCIvarfitMin=FindMinimum[chi2o2aAL[aALfitf],{aALfitf,aALfCI[Nt0]}];
aALCIvarfit=aALfitf/.aALCIvarfitMin[[2]];
Xi2aALCIvaro77=aALCIvarfitMin[[1]];
(* delaALCdelaALCI= delaALf/.FindRoot[chi2o2aAL[aALCIvarfit+delaALf]==Xi2aALCIvaro77+1,{delaALf, 10.^-4}]; delaALCdelaALCI DOES NOT work in practice, so I checked by hand: chi2o2aAL[aALCIvarfit]=0.000113;  chi2o2aAL[aALCIvarfit +-0.000133] =app 1.00 *)
(* Nm=2; Nd=6; Nt0=5; delaALCI=0.000133 *)

(* The precise central value result of the CI global fit: *)
 alO4O6O8fitPCIMinnum[5]={0.000230874, {aALf -> 0.110685234, O4fitf -> -0.00255783, O6fitf -> 0.000754947, O8fitf -> -0.000804784}};
(*----*)
(* Together, the estimates of EXPERIMENTAL uncertainties in the CI global fit approach (with Nt=6) are (Nm=2; Nd=6; uncorrelated xi^2):  *)
(* delO4CI= 0.000030; delO6CI=0.000045; delO8CI=0.000081; delaALCI=0.000133 (=delta(a(sigmax))) *)
(* --> alpha_s(mtau^2)=0.334903+{^{+0.000383}_{-0.000383}}_{exp}; *)  
(* 10^3 O4=-2.6+{^{+0.1}_{-0.0}}_{exp}; 10^3 O6=+0.8+{^{+0.0}_{-0.1}}_{exp}; 10^3 O8=-0.8+{^{+0.1}_{-0.1}}_{exp}; *)
 (* 10^3 aGG= 6 10^3 (O4 + ddel)=-13.4+{^{+0.2}_{-0.1}}_{exp}; *)
(*---------*)

(* Variation of kappa, CI global fit, Nt=6  (note that aALf=a(kappa sigmax) : *)
(* kappa=2.0: *)
(* alO4O6O8fitPCIMinnum[5]={0.000549756, {aALf -> 0.092372806, O4fitf -> -0.00182907, O6fitf -> 0.000860861, O8fitf -> -0.000442411}}; *)
(* kappa=1.0 (the central case of the global fit): *)
(* alO4O6O8fitPCIMinnum[5]={0.000230874, {aALf -> 0.110685234, O4fitf -> -0.00255783, O6fitf -> 0.000754947, O8fitf -> -0.000804784}}; *)
(* kappa=0.5: *)
(*     alO4O6O8fitPCIMinnum[5]={0.38664, {aALf -> 0.146316917, O4fitf -> -0.00439035, O6fitf -> 0.0013498, O8fitf -> -0.00360673}}; *)
(* Note that aALf=a(kappa*sigmax) *)
(* --> thus the variations: *)
(* alpha_s(mtau^2)=0.334903+{^{+0.006024}_{+0.002927}}_{del kappa} *)
(* 10^3 O4=-2.6+{^{+0.8}_{-1.8}}_{del kappa}; 10^3 O6=+0.8+{^{+0.1}_{+0.5}}_{del kappa}; 10^3 O8=-0.8+{^{+0.4}_{-2.8}}_{delta kappa}; *)
 (* 10^3 aGG= 6 10^3 (O4 + ddel)=-13.4+{^{+4.4}_{-11.0}}_{del kappa}; *)

(* Variation of d4, CI global fit: *)
(* d4=2 338.19= 676.38: *)
(* alO4O6O8fitPCIMinnum[5]={0.000255987, {aALf -> 0.108780324, O4fitf -> -0.00284365, O6fitf -> 0.000734351, O8fitf -> -0.000883667}}; *)
(* d4=338.19;   (the central case of the global fit): *)
(* alO4O6O8fitPCIMinnum[5]={0.000230874, {aALf -> 0.110685234, O4fitf -> -0.00255783, O6fitf -> 0.000754947, O8fitf -> -0.000804784}}; *)
(* d4=0: at Nt=5 this is equal to the Nt=4 (CI) case: *)
    alO4O6O8fitPCIMinnum[5]={0.00028701, {aALf -> 0.112741587, O4fitf -> -0.00217849, O6fitf -> 0.000783656, O8fitf -> -0.000654449}};
(* --> thus the variations: *)
(* alpha_s(mtau^2)=0.334903+{^{-0.005491}_{+0.005913}}_{del d4}; *)
(* 10^3 O4=-2.6+{^{-0.2}_{+0.4}}_{del d4}; 10^3 O6= +0.8+{^{-0.1}_{+0.0}}_{del d4}; 10^3 O8=-0.8+{^{-0.1}_{+0.1}}_{del d4}; *)
(* 10^3 aGG= 6 10^3 (O4 + ddel)=-13.4+{^{-1.7}_{+2.3}}_{del d4}; *)

(* Variation of Nt(truncation order, Nt=5+-1), CI global: *)
(* Nt=6: *)
(* alO4O6O8fitPCIMinnum[6]={0.0000353626, {aALf -> 0.109329116, O4fitf -> -0.00318218, O6fitf -> 0.000667948, O8fitf -> -0.00117464}}; *)
(* Nt=5 (the central case): *)
(*  alO4O6O8fitPCIMinnum[5]={0.000230874, {aALf -> 0.110685234, O4fitf -> -0.00255783, O6fitf -> 0.000754947, O8fitf -> -0.000804784}}; *)
(* Nt=4: *)
(*   alO4O6O8fitPCIMinnum[4]={0.00028701, {aALf -> 0.112741587, O4fitf -> -0.00217849, O6fitf -> 0.000783656, O8fitf -> -0.000654449}}; *)
 (* --> alpha_s(mtau^2)=0.334903+{^{-0.003908}_{+0.005913}}_{del Nt} *)
(* 10^3 O4=-2.6+{^{-0.6}_{+0.4}}_{del Nt}; 10^3 O6= +0.8+{^{-0.1}_{+0.0}}_{del Nt}; 10^3 O8=-0.8+{^{-0.4}_{+0.1}}_{del Nt}; *)
(* 10^3 aGG= 6 10^3 (O4 + ddel)=-13.4+{^{-3.7}_{+2.3}}_{del Nt}; *)
(*----------------*)
(* Altogether, the CI global fit approach gives: *)
(* Nt=5; *)
(*
alpha_s(mtau^2)= 0.334903 + {^{+0.000383}_{-0.000383}}_{exp} +  {^{+0.006024}_{+0.002927}}_{del kappa} + {^{-0.005491}_{+0.005913}}_{del d4} + {^{-0.003908}_{+0.005913}}_{del Nt}  = 0.334903 + {^{+0.010313}_{-0.006751}} =app  0.3349 + {^{+0.0103}_{-0.0067}} =app  0.335 + {^{+0.010}_{-0.007}}; 
10^3 O4= -2.6 + {^{+0.1}_{-0.0}}_{exp} + {^{+0.8}_{-1.8}}_{del kappa} + {^{-0.2}_{+0.4}}_{del d4} + {^{-0.6}_{+0.4}}_{del Nt} = -2.6 + {^{+1.0}_{-1.9}} ; 
10^3 O6= +0.8 + {^{+0.0}_{-0.1}}_{exp} + {^{+0.1}_{+0.5}}_{del kappa} + {^{-0.1}_{+0.0}}_{del d4} + {^{-0.1}_{+0.0}}_{del Nt} =  +0.8 + {^{+0.5}_{-0.2}}; 
10^3 O8= -0.8 + {^{+0.1}_{-0.1}}_{exp} + {^{+0.4}_{-2.8}}_{delta kappa} + {^{-0.1}_{+0.1}}_{del d4} + {^{-0.4}_{+0.1}}_{del Nt} = -0.8 + {^{+0.4}_{-2.8}};
10^3 aGG= -13.4 + {^{+0.2}_{-0.1}}_{exp} + {^{+4.4}_{-11.0}}_{del kappa} + {^{-1.7}_{+2.3}}_{del d4} + {^{-3.7}_{+2.3}}_{del Nt} = -13.4 + {^{+5.5}_{-11.7}} =app -13 + {^{+5}_{-12}};  
*)
(* Checked twice *)

(* End of CI global fit results *)
(*-------------------------------------------------*)
(*-------------------------------------------------*)
(* Now the CI approach with a^{(2,5)} and no condensates: *)
									
   (* solaALCIc[2,5][Nn_]:=FindRoot[ Re[aaCID0fast[2,5,aALf][Nn]]==aexpBin77[2,5],{aALf,0.1}];   -- FindRoot does not work, problems with aALf status ... *)
   aALCIc[2,5][4]=Module[{xx},xx=FindMinimum[Abs[Re[aaCID0fast[2, 5, aALf][4]] - aexpBin77[2, 5]], {aALf, 0.114}];  aALf/.xx[[2]]];
   aALCIc[2,5][5]=Module[{xx},xx=FindMinimum[Abs[Re[aaCID0fast[2, 5, aALf][5]] - aexpBin77[2, 5]], {aALf, 0.112}];  aALf/.xx[[2]]];
   aALCIc[2,5][6]=Module[{xx},xx=FindMinimum[Abs[Re[aaCID0fast[2, 5, aALf][6]] - aexpBin77[2, 5]], {aALf, 0.110}];  aALf/.xx[[2]]];
   aALCIc[2,5][7]=Module[{xx},xx=FindMinimum[Abs[Re[aaCID0fast[2, 5, aALf][7]] - aexpBin77[2, 5]], {aALf, 0.110}];  aALf/.xx[[2]]];
  aALCIc[2, 5][8]=Module[{xx},xx=FindMinimum[Abs[Re[aaCID0fast[2, 5, aALf][8]] - aexpBin77[2, 5]], {aALf, 0.110}];  aALf/.xx[[2]]];
  aALCIc[2, 5][9]=Module[{xx},xx=FindMinimum[Abs[Re[aaCID0fast[2, 5, aALf][9]] - aexpBin77[2, 5]], {aALf, 0.110}];  aALf/.xx[[2]]];

aALCIc[2, 5][10]=Module[{xx},xx=FindMinimum[Abs[Re[aaCID0fast[2, 5, aALf][10]] - aexpBin77[2, 5]], {aALf, 0.110}];  aALf/.xx[[2]]];

aALCIc[2, 5][11]=Module[{xx},xx=FindMinimum[Abs[Re[aaCID0fast[2, 5, aALf][11]] - aexpBin77[2, 5]], {aALf, 0.110}];  aALf/.xx[[2]]];
 aALCIc[2, 5][12]=Module[{xx},xx=FindMinimum[Abs[Re[aaCID0fast[2, 5, aALf][12]] - aexpBin77[2, 5]], {aALf, 0.110}];  aALf/.xx[[2]]];


(* kappa=1, CI: *)
(* aALCIc[2, 5][4]=0.114096046902029; aALCIc[2, 5][5]=0.112019057757055; aALCIc[2, 5][6]=0.11042721704998694; aALCIc[2, 5][7]=0.10963357513258858;  aALCIc[2, 5][8]=0.1089027695290096; aALCIc[2, 5][9]=0.10864264219824356; aALCIc[2, 5][10]=0.10836576725284845; aALCIc[2, 5][11]=0.10837147944845578; aALCIc[2, 5][12]=0.10958244715613312; *)

(* Table[{Nn, alsmtauCI[2, 5][Nn] - alsmtauCI[2, 5][Nn - 1]}, {Nn, 5, 12}] *)
								

  (* aALCIp[2, 5][4]=0.11607971629296304;  aALCIm[2, 5][4]=0.11212125406631006; *)
  
 alsmtauCI[2,5][Nn_]:=aMSext[mtauphys^2/(kappa sigmax),aALCIc[2,5][Nn]] Pi;
 (* alsmtauCI=alpha_s(mtau^2;MSbar) such that the a^{(2,5}} theoretical moment (in CI with D=0) with Nn truncation reproduces the experimental value moment aexpBin77[2,5] *)
  (* tabalsmtauCI  = Table[{Nn, alsmtauCI[2, 5][Nn]}, {Nn, 4, 12}]; ListPlot[tabalsmtauCI]; --> we see that minimum around Nn=10 or 11; take Nn=10;  *)
(* Further, if taking for a(sigmax)=aALCIc[2, 5][10]=0.108366; and looking at a^{(2,5)[Nn] as function of truncation Nn: taba25=Table[{Nn, Re[aaCID0fast[2, 5,0.108366][Nn]]},{Nn,4,15}]; Listplot[taba25]; --> we see plateaux (wide maximum)at Nn=10-11; so we take Nn=10 *)

(* aALCIp[2, 5][10] = Module[{xx}, xx = FindMinimum[Abs[Re[aaCID0fast[2, 5, aALf][10]] - aexpBin77[2, 5] - delaexpBin77[2, 5]], {aALf, 0.1103}]; aALf /. xx[[2]]]; --> aALCIp[2, 5][10]=0.110078; *)
(* aALCIm[2, 5][10] = Module[{xx}, xx = FindMinimum[Abs[Re[aaCID0fast[2, 5, aALf][10]] - aexpBin77[2, 5] + delaexpBin77[2, 5]], {aALf, 0.1063}]; aALf /. xx[[2]]]; -->  aALCIm[2, 5][10]=0.106667; *)
 
(* kappa=0.5:  alsmtauCI[2, 5][10]=0.316961; *)
(* kappa=2.0:  alsmtauCI[2, 5][10]=0.328779; *)

  (* kappa=1, and variation of d4=ddtk[4,tkap]: here we use Nn=5 to see the variation: *)
(* ddtk[4,tkap] (=338.19): aALCIc[2, 5][5]=0.112019 ->  alsmtauCI[2, 5][5]=0.338740; *)
(* ddtk[4,tkap]=2 x 338.19: aALCIc[2, 5][5]=0.110154 -> alsmtauCI[2, 5][5]=0.333374; *)
(* ddtk[4,kap]=0: aALCIc[2, 5][5]=0.114096(=aALCIc[2, 5][4]) -> alsmtauCI[2, 5][5]=0.344703; *)
(* --> thus: aALCIc[2, 5][5]=0.338740 + {^{-0.005366}_{+0.005963}_{del d4} *)

  (* nn=6: aALCIc[2, 6][10]=0.108459 -> alsmtauCI[2,6][10]=0.328483; *)
  (* nn=5: aALCIc[2, 5][10]=0.108366 -> alsmtauCI[2,5][10]=0.328215; (central value) *)
 (* nn=4: aALCIc[2, 4][10]=0.107562 -> alsmtauCI[2,4][10]=0.325895; *)
 
(* --> alpha_s(mtau^2)=0.328215+{^{+0.000268}_{-0.002320}}_{n=5 \pm 1} *)
 
(* variation of truncation: Nn=10 -> 10 \pm 1: *)
(* Nn=11: aALCIc[2, 5][11]=0.10837147944845578 -> alpha_s(mtau^2)=0.328232; *)
(* Nn=10: aALCIc[2, 5][10]=0.10836576725284845 -> alpha_s(mtau^2)=0.328215; *)
(* Nn=9: aALCIc[2, 5][9]=0.10864264219824356   -> alpha_s(mtau^2)=0.329014; *)
(* --> alpha_s(mtau^2)=0.328215+{^{+0.000017}_{+0.000799}}_{tr: Nn=10 \pm 1} *)

  (* --> alsmtauCI[2,5][10]=0.3282 + {^+0.005_-0.005}_{exp} + {^+0.001_-0.011}_{kappa} + {^-0.0054_+0.0060}_{del d4} + {^+0.000_ +0.001}_{Nn=10->10+-1(trunc)} + {^+0.000_-0.002}_{n=5+-1} =appr 0.328 +^{+0.008}_{-0.013} *)
  
(* alsmtau[NN] = aMSext[mtauphys^2/(kappa sigmax), aALf] Pi is then alpha_s(mtau^2;MSbar) value corresponding to the value of a(kappa sigma) equal to aALf *)

  (* Higher precision: *)
(*  alpha_s(mtau^2)(=alsmtauCI[2,5][10])=0.328215 + {^{+0.004938}_{-0.004909}}_{exp} + {^{+0.000564}_{-0.011254}}_{del kappa} +  {^{-0.005366}_{+0.005963}}_{del d4} + {^{+0.000268}_{-0.002320}}_{n=5 \pm 1} + {^{+0.000017}_{+0.000799}}_{tr: Nn=10 \pm 1} = 0.328215 + {^{+0.007808}_{-0.013599}}  =appr 0.328 + ^{{+0.008}_{-0.014}}  (added in quadrature, pluses and minuses separately)  *)

(* This then gives: (from a^{(2,5)}([10],CI)) a(sigmax)=0.108366+{^{+0.002708}_{-0.004698}} --> *)
(* (aAL=)a(sigmax)=0.108366 (alpha_s(mtau^2)=0.328215): *)
(* O4O6O8fitPCIMinnum[10]={12.4768, {O4fitf -> -0.007312, O6fitf -> -0.000742, O8fitf -> -0.011561}}; *)
(*   (aAL=)a(sigmax)=0.108366+0.002708 (alpha_s(mtau^2)=0.328215+0.007808) *)
(*  O4O6O8fitPCIMinnum[10]={26.5983, {O4fitf -> -0.00937818, O6fitf -> 0.000300427, O8fitf -> -0.0168835}}; *) // 
(*   (aAL=)a(sigmax)=0.108366-0.004698 (alpha_s(mtau^2)=0.328215-0.013599) *)
(*  O4O6O8fitPCIMinnum[10]={5.31636, {O4fitf -> -0.00425679, O6fitf -> -0.00202633, O8fitf -> -0.00521435}}; *)

(* --> Thus in this a^{(2,5)}_{[10],CI} + Borel-Laplace[10] approach we get: *)
(* Nt=10; *)
(* alpha_s(mtau^2)=0.3282 + {^{+0.0078}_{-0.0136}} =app 0.328 + {^{+0.008}_{-0.013}}; *)
(* 10^3 O4=-7.3+{^{-2.1}_{3.0}}; 10^3 O6= -0.7 + {^{+1.0}_{-1.3}}; 10^3 O8=-11.6 + {^{-5.3}_{+6.4}}; *)
(* aGG= 6 (O4 + ddel) -> 10^3 aGG= -42 + {^{-12}_{+18}} *)

 (* End of CI approach *)   
(*---------------------------------------------------------------------*)
(*---------------------------------------------------------------------*)
(*---------------------------------------------------------------------*)
(*---------------------------------------------------------------------*)
(* Double-pinched ('P') Borel-Laplace in PV(+CI) approach (PPV): *)


(* kappa=Exp[-tKK]; *)
  kappa=1;  (* kappa = mu^2/Q^2, where mu^2 is RScl *)
  tkap=kappa Exp[tKK];

(* First for FIXED a(kappa sigmax)=aAL *)
sol2a[aALf_]:= NDSolve[{-I y'[th] == bta[y[th]], y[0] == aALf}, y, {th, -Pi, +Pi}];
(*'*) (* aALf=a[kappa sigmax] *)
   (*  aCI[th_? NumberQ,aALf_? NumberQ]:=First[y[th]/.sol2a[aALf]]; *)
 aCI[th_? NumberQ, aALf_] := First[y[th] /. sol2a[aALf]];
(* aALf=a(kappa sigmax); aCI[th,aALf]=a(Q2=kappa sigma Exp[I th]) *)

(* aAL=a(kappa*sigmax), FIXED here: *)  
  (* aAL=0.127;  *)
  aAL=0.10405;
(* aCI[th,aAL] = a(kappa sigmax Exp[I th]), and aAL=a(kappa sigmax) *)
  
  delD[th_,Nn_]:= Sum[delddtk[jj-1,tkap] aCI[th,aAL]^jj, {jj, 1, Nn}];
  (* delD[th,N] is the polynomial part of the Borel od Adler D, of order up to a(kappa sigmax Exp[I th])^N; note that kappa=tkap Exp[-tKK] (kappa=mu^2/Q^2) *)
  delDext[th_,Nn_,aALf_]:= Sum[delddtk[jj-1,tkap] aCI[th,aALf]^jj, {jj, 1, Nn}];

  DBorelep[th_, ep_]:=(1/be0)*(NIntegrate[BDsing[u,tkap] Exp[-u/(be0 aCI[th,aAL])], {u, 0., I ep}] + NIntegrate[BDsing[u,tkap] Exp[-u/(be0 aCI[th,aAL])], {u, I ep, I ep +10^3}]);
  
th0=0.5;
DBorel1pl[th_]:=(1/be0*Exp[I th0])*(NIntegrate[BDsing[u Exp[I th0],tkap] Exp[-u Exp[I th0]/(be0 aCI[th,aAL])], {u, 0., 10.^3}]);
DBorel1mi[th_]:=(1/be0*Exp[-I th0])*(NIntegrate[BDsing[u Exp[-I th0],tkap] Exp[-u Exp[-I th0]/(be0 aCI[th,aAL])], {u, 0., 10.^3}]);
  
DBorel1plext[th_,aALf_]:=(1/be0*Exp[I th0])*(NIntegrate[BDsing[u Exp[I th0],tkap] Exp[-u Exp[I th0]/(be0 aCI[th,aALf])], {u, 0., 10.^3}]);
DBorel1miext[th_,aALf_]:=(1/be0*Exp[-I th0])*(NIntegrate[BDsing[u Exp[-I th0],tkap] Exp[-u Exp[-I th0]/(be0 aCI[th,aALf])], {u, 0., 10.^3}]);
(* Note, by construction,  DBorel1mi[-th]=Conjugate[DBorel1pl[th]] *)
  (* aALf=a(kappa sigmax)= a(tkap Exp[tKK]) *)
  
DBorelS[th_]:=(DBorel1pl[th]+DBorel1mi[th])/2;
DBorel[th_,Nm_]:=DBorelS[th]+delD[th,Nm];(* This is PV *)
  (* DBorel[-th,Nm]=Conjugate[DBorel[th,Nm]]; *)
  (* aALf=a(kappa sigmax)= a(tkap Exp[tKK]) *)
  
DBorelSext[th_,aALf_]:=(DBorel1plext[th,aALf]+DBorel1miext[th,aALf])/2;
DBorelext[th_,Nm_,aALf_]:=DBorelSext[th,aALf]+delDext[th,Nm,aALf];(* This is PV *)

  delDBorel[th_]:=(DBorel1pl[th]-DBorel1mi[th])/2/Pi/I; 
(* Note, delD[-th,10]=Conjugate[delD[th,10]];  *)
(* delDBorel[-th]=Conjugate[delDBorel[th]] *) 
(* delDBorel[th]=delDBorelIR2plplIR3mimi[th], i.e., the difference when going above (Im u > 0) for both IRp=2 and IRp=3, and going below (Im u < 0) for both IRp=2 and IRp=3 *)

 delDBorelext[th_,aALf_]:=(DBorel1plext[th,aALf]-DBorel1miext[th,aALf])/2/Pi/I; 
  (*------------*)
  (* Now generation of the tables of Borel-resummed Adler function along the contour of radius kappa*sigmax, for fixed a(kappa sigmax)=aAL: *)

 Nn=60; 
  
Clear[tabDBorelS];  
tabDBorelS=Table[{jj*Pi/Nn,  DBorelS[N[jj*Pi/Nn]]}, {jj, 1, Nn - 1}]; 

Clear[deltabDBorelS];
tabdelDBorel=Table[{jj*Pi/Nn,  delDBorel[N[jj*Pi/Nn]]}, {jj, 1, Nn - 1}];

Clear[tabaCI];
Do[tabaCI[nn]=Table[{jj*Pi/Nn,  aCI[N[jj*Pi/Nn],aAL]^nn}, {jj, 1, Nn - 1}],{nn,1,15}];

Clear[tabdelD];
  Do[tabdelD[nn]=Table[{jj*Pi/Nn,  Sum[delddtk[mm-1,tkap] tabaCI[mm][[jj]][[2]],{mm,1,nn}]}, {jj, 1, Nn - 1}],{nn,3,15}];

  Do[tabDBorel[nn]=Table[{jj*Pi/Nn, tabDBorelS[[jj]][[2]]+tabdelD[nn][[jj]][[2]]},{jj,1,Nn-1}],{nn,3,15}]; 
  (* Note: tabDBorel[N]= table of the values {jj*Pi/Nn,DBorel[th=jj*Pi/Nn,N]} (jj=1, ...,Nn-1), where DBorel has the polynomial corrective part with power up to (and including) aCI[th,aAL]^N *)

Clear[Nn];
  
DBorSup=Interpolation[tabDBorelS];
DBorSfast[th_] :=If[th > 0, DBorSup[th], Conjugate[DBorSup[-th]]];
(* DBorSfast[th] is PV  Borel resummation of Adler d(Q^2=sigmax Exp[I th]) , FAST evaluation, the singular (S) part, i.e., with NO polynomial (correction) part *)

  
Do[DBornn[nn]=Interpolation[tabDBorel[nn]],{nn,3,15}];
DBorfast[th_,nn_] :=If[th > 0, DBornn[nn][th], Conjugate[DBornn[nn][-th]]];
(* DBorfast[th,nn]: This is PV Borel resummation of Adler d(Q^2=sigmax Exp[I th]) , FAST evaluation, with the polynomial (correction) part delD[th,nn] truncated at a[kappa sigmax Exp[I th]]^nn; note that Adler d(Q^2) = a(kappa Q^2) + O(a^2) i.e., without the term 1 (=O(a^0) *)
 (* It should approximate well the ('exact') expression DBorel[th,nn], which is evaluated much more SLOWLY; *)

delDBorSup=Interpolation[tabdelDBorel];
delDBorfast[th_] :=If[th > 0, delDBorSup[th], Conjugate[delDBorSup[-th]]]; 
(* delDBorfast[th] is the renormalon-uncertainty measure of DBorfast[th] *)
 (* It is equal to delDBorel[th], but much faster evaluation *)
 (*-----------*)
 (* Now double-pinched ('P') Borel-Laplace, in the Borel-resummed ('PV') approach  (-> 'PPV'): *) 
(* Here: M2 = M^2 = |M^2| Exp[I Psi] (complex), where later Psi=Pi/6,Pi/4,0: *)
 (* fixed aAL=a(kappa sigmax) *)
 

BPPVD0[M2_?NumberQ, Nn_]:= (1/(2 Pi)) NIntegrate[(((1 + Exp[I th])^2 - 2 (M2/sigmax) (1 + Exp[I th]) + 2 (M2/sigmax)^2) Exp[(sigmax/M2) Exp[I th]] - 2 (M2/sigmax)^2 Exp[-(sigmax/M2)]) DBorfast[th,Nn], {th, -Pi, Pi}];
 (*  BPPVD0sl[M2_?NumberQ, Nn_,aALf_?NumberQ]:= (1/(2 Pi)) NIntegrate[(((1 + Exp[I th])^2 - 2 (M2/sigmax) (1 + Exp[I th]) + 2 (M2/sigmax)^2) Exp[(sigmax/M2) Exp[I th]] - 2 (M2/sigmax)^2 Exp[-(sigmax/M2)]) DBorelext[th,Nn,aALf], {th, -Pi, Pi}]; *)
 
BPPVdelD0[M2_?NumberQ]:= (1/(2 Pi)) NIntegrate[(((1 + Exp[I th])^2 - 2 (M2/sigmax) (1 + Exp[I th]) + 2 (M2/sigmax)^2) Exp[(sigmax/M2) Exp[I th]] - 2 (M2/sigmax)^2 Exp[-(sigmax/M2)]) delDBorfast[th], {th, -Pi, Pi}];

 
  ReBPPV[M2f_,Nn_,O4_,O6_,O8_]:=Re[((1- 2 M2f/sigmax) + 2 (M2f/sigmax)^2 (1 - Exp[-sigmax/M2f]))+BPPVD0[M2f,Nn]+  2 Pi^2 ( (1/(M2f sigmax))(2 O4 + O6/sigmax) + (1/M2f^2) (O4 + 2 (O6/sigmax) + (O8/sigmax^2)) + (1/M2f^3) (1/2)(O6 + 2 O8/sigmax) + (1/M2f^4) (1/6) O8 )]; (* Re[B[M2,Nn,O4,O6,O8]] for PV with delD truncated at a^Nn, RScl kappa *)
    (* aALf= a(kappa sigmax) *)

 (* Now search for condensate values with this Borel-Laplace (double) pinched ('P') approach, with (Borel-resummed) PV method for D=0 part: *)
NchP=10; (* number of intervals in: (M2min < |M^2} < 1.5) *)
M2FP[ii_]:=M2min+ii*(1.5-M2min)/NchP; (* ii=0,1,2,...,NchP *)
(* We will use sum of squares minimization in this interval, for M^2=|M^2| Exp[I Psi] with Psi=0, Pi/6, Pi/4 one after another in the sum (it turns out that it is not good to include Psi=Pi/3, this value appears to be too large, and xi^2 become large): *)

  O4init = -0.0030; O6init = 0.00073; O8init = -0.0010; (* aALfinit = 0.1100; *)
O4O6O8fitPPVMinN[Nn_]:= FindMinimum[Sum[(ReBPPV[M2FP[jj] Exp[I Pi/6], Nn, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/6]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/6]]^2, {jj, 0, NchP}]+Sum[(ReBPPV[M2FP[jj] Exp[I Pi/4], Nn, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/4]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/4]]^2, {jj, 0, NchP}]+Sum[(ReBPPV[M2FP[jj], Nn, O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj]])^2/delReBPexpBinAL[M2FP[jj]]^2, {jj, 0, NchP}], {{O4fitf, O4init},{O6fitf, O6init},{O8fitf, O8init}}];
(* aALf=alpha_s(kappa*sigmax)/Pi *)

(* Do[O4O6O8fitPPVMinnum[nn]=O4O6O8fitPPVMinN[nn], {nn, 3, 15}]; *)

(* kappa=Exp[-tKK]; aAL=0.105: *)
(* O4O6O8fitPPVMinnum[4]={16.1979, {O4fitf -> 0.00466136, O6fitf -> -0.0050575, O8fitf -> 0.00396906}};
 O4O6O8fitPPVMinnum[5]= {14.9049, {O4fitf -> 0.00424659, O6fitf -> -0.00480629, O8fitf -> 0.00372994}};  
O4O6O8fitPPVMinnum[6]={14.1302, {O4fitf -> 0.00387599, O6fitf -> -0.00467935, O8fitf -> 0.00351357}} *)
(* kappa=Exp[-tKK]; aAL=0.110: *)
 (* O4O6O8fitPPVMinnum[4]={6.88956, {O4fitf -> 0.00338444, O6fitf -> -0.00227834, O8fitf -> 0.00231214}};
 O4O6O8fitPPVMinnum[5]={5.37539, {O4fitf -> 0.0025262, O6fitf -> -0.00181954, O8fitf -> 0.00179724}}; 
O4O6O8fitPPVMinnum[6]={4.77416, {O4fitf -> 0.00190599, O6fitf -> -0.00165822, O8fitf -> 0.00138461}}   *)
(* kappa=Exp[-tKK]; aAL=0.115: *)
(* O4O6O8fitPPVMinnum[4]={3.59972, {O4fitf -> 0.00272976, O6fitf -> -0.00066753, O8fitf -> 0.00137092}};
O4O6O8fitPPVMinnum[5]={2.47365, {O4fitf -> 0.0016867, O6fitf -> -0.000179244, O8fitf -> 0.000698772}};
O4O6O8fitPPVMinnum[6]={2.1501, {O4fitf -> 0.000911981, O6fitf -> -0.0000311025, O8fitf -> 0.0000893272}} *)

  (* kappa=Exp[-tKK]; aAL=0.120: *)
(* O4O6O8fitPPVMinnum[4]={1.44818, {O4fitf -> 0.00213316, O6fitf -> 0.00106422, O8fitf -> 0.000381306}};
O4O6O8fitPPVMinnum[5]={0.783316, {O4fitf -> 0.000880387, O6fitf -> 0.00157684, O8fitf -> -0.000512338}};
O4O6O8fitPPVMinnum[6]={0.729167, {O4fitf -> -0.0000768993, O6fitf -> 0.00171266, O8fitf -> -0.00142399}} *) 

  (* kappa=Exp[-tKK]; aAL=0.127: *)
(* O4O6O8fitPPVMinnum[4]={0.110937, {O4fitf -> 0.00138633, O6fitf -> 0.00376542, O8fitf -> -0.00116159}};
 O4O6O8fitPPVMinnum[5]={0.0160695, {O4fitf -> -0.000206967, O6fitf -> 0.00431566, O8fitf -> -0.00252594}};
 O4O6O8fitPPVMinnum[6]={0.128108, {O4fitf -> -0.00147824, O6fitf -> 0.00446398, O8fitf -> -0.00412973}};
O4O6O8fitPPVMinnum[7]={0.664016, {O4fitf -> -0.00213815, O6fitf -> 0.00447346, O8fitf -> -0.00549041}};
O4O6O8fitPPVMinnum[8]={5.1783, {O4fitf -> -0.0031023, O6fitf -> 0.00464493, O8fitf -> -0.00866271}} *)

(* kappa=Exp[-tKK]; aAL=0.128: *)
(* O4O6O8fitPPVMinnum[4]={0.0534676, {O4fitf -> 0.0012985, O6fitf -> 0.00415227, O8fitf -> -0.00137284}};
 O4O6O8fitPPVMinnum[5]={0.010929, {O4fitf -> -0.000348404, O6fitf -> 0.00470967,O8fitf -> -0.00282446}};  ***
 O4O6O8fitPPVMinnum[6]={0.125054, {O4fitf -> -0.00167118, O6fitf -> 0.00486566, O8fitf -> -0.00456106}};  ***
O4O6O8fitPPVMinnum[7]={0.752652, {O4fitf -> -0.0023644, O6fitf -> 0.00489011, O8fitf -> -0.00605005}};
O4O6O8fitPPVMinnum[8]={6.3272, {O4fitf -> -0.00339104, O6fitf -> 0.00512506, O8fitf -> -0.00954068}}  *)

(* kappa=Exp[-tKK]; aAL=0.129: *)
(* O4O6O8fitPPVMinnum[4]={0.0244162, {O4fitf -> 0.00120263, O6fitf -> 0.00457529, O8fitf -> -0.00162048}};
 O4O6O8fitPPVMinnum[5]={0.0185365, {O4fitf -> -0.000499226, O6fitf -> 0.00514062, O8fitf -> -0.00316532}};
O4O6O8fitPPVMinnum[6]={0.145038, {O4fitf -> -0.00187538, O6fitf -> 0.00530644, O8fitf -> -0.00504488}};
O4O6O8fitPPVMinnum[7]={0.918692, {O4fitf -> -0.00260365, O6fitf -> 0.00534884, O8fitf -> -0.00667257}};
O4O6O8fitPPVMinnum[8]={7.91873, {O4fitf -> -0.00369705, O6fitf -> 0.00565673, O8fitf -> -0.0105083}}  *)
(* kappa=Exp[-tKK]; aAL=0.130: *)
(* O4O6O8fitPPVMinnum[4]={0.00664633, {O4fitf -> 0.00111916, O6fitf -> 0.00497811, O8fitf -> -0.00183913}};
O4O6O8fitPPVMinnum[5]={0.03792, {O4fitf -> -0.000639027, O6fitf -> 0.00555228, O8fitf -> -0.00348349}};
O4O6O8fitPPVMinnum[6]={0.157633, {O4fitf -> -0.00207053, O6fitf -> 0.00573035, O8fitf -> -0.00551676}};
O4O6O8fitPPVMinnum[7]={1.08545, {O4fitf -> -0.00283568, O6fitf -> 0.00579398, O8fitf -> -0.00729419}};
 O4O6O8fitPPVMinnum[8]={9.77583, {O4fitf -> -0.00400042, O6fitf -> 0.00618515, O8fitf -> -0.0115034}}  *) 
(* kappa=Exp[-tKK]; aAL=0.135: *)
(* O4O6O8fitPPVMinnum[4]={0.13503, {O4fitf -> 0.000684162, O6fitf -> 0.00724, O8fitf -> -0.00316309}};
O4O6O8fitPPVMinnum[5]={0.165677, {O4fitf -> -0.00137796, O6fitf -> 0.0078773, O8fitf -> -0.00541221}};
O4O6O8fitPPVMinnum[6]={0.627614, {O4fitf -> -0.00311908, O6fitf -> 0.0081632, O8fitf -> -0.00839827}};
O4O6O8fitPPVMinnum[7]={3.85157, {O4fitf -> -0.00410001, O6fitf -> 0.00839432, O8fitf -> -0.0111143}};
O4O6O8fitPPVMinnum[8]={31.4335, {O4fitf -> -0.00570129, O6fitf -> 0.0093912, O8fitf -> -0.0176828}}  *) 
  (*---------*)
  (*  Nn here is the truncation order of the correction part  *) 
  (* Now the solutions, for kappa=1, in PV(+CI) approach, with MINIMIZED xi2: *)
  
  (* Nn=3, kappa=1: aAL > 0.130 (absurdly high) to get xi2[3] minimal *)

  (* Nn=4, kappa=1; aAL=0.1115: xi2[4]=0.0011835; aAL=0.1116: xi2[4]=0.000724381; aAL=0.1117: xi2[4]=0.00199973; aAL=0.11120: xi2[4]=0.00498236 *)
  (* --> for Nn=4: aAL=0.1116: *)
 (* kappa=1; aAL=0.1116: *)
  (* O4O6O8fitPPVMinnum[4]={0.000724381, {O4fitf -> 0.00369978, O6fitf -> 0.00493949, O8fitf -> -0.000531704}}  ****  *)

  (*  Nn=5, kappa=1; aAL=0.105: xi2[5]=0.0338394; aAL=0.1059: xi2[5]=0.00179144; aAL=0.1060: xi2[5]=0.00155207; aAL=0.1061: xi2[5]=0.00363221; *)
(* for Nn=5, xi2 is minimum for  aAL=0.1060 (when kappa=1): *)
  (* kappa=1; aAL=0.1060: *)
  (* O4O6O8fitPPVMinnum[5]={0.00155207, {O4fitf -> 0.000849667, O6fitf -> 0.00342918, O8fitf -> -0.000973415}}  ****  *)

  (* Nn=6, kappa=1; aAL=0.1039: xi2[6]=0.00292591; aAL=0.1040: xi2[6]=0.00129832; aAL=0.1041: xi2[6]=0.00136485; --> for Nn=6 (and kappa=1) xi2[6]_min is at aAL=0.1040: *)
(* kappa=1; aAL=0.1040: (corresponds to aAL=0.12347 when kappa=Exp[-tKK]) *)
  (* O4O6O8fitPPVMinnum[6]={0.00129832, {O4fitf -> -0.000171804, O6fitf -> 0.00282276, O8fitf -> -0.0011604}}  ****  *)

  (* Nn=7, kappa=1; aAL=0.1036: xi2[7]=0.00108266; aAL=0.1037: xi2[7]=0.000623798; aAL=0.1038: xi2[7]=0.00179697; aAL=0.1039: xi2[7]=0.00461516; aAL=0.1040: xi[7]=0.0090454; aAL=0.1041: xi[7]=0.015093  --> for Nn=7 (and kappa=1) xi2[7]_min is at aAL=0.1037: *)
 (* kappa=1; aAL=0.1037: *)
  (* O4O6O8fitPPVMinnum[7]={0.000623798, {O4fitf -> -0.00081573, O6fitf -> 0.00271004, O8fitf -> -0.00153886}} **** *)

  (* Nn=8, kappa=1; aAL=0.1036: xi2[8]=0.00215214; aAL=0.1037: xi2[8]=0.000434073;  aAL=0.1038: xi2[8]=0.000157449; aAL=0.1039: xi2[8]=0.00132127; aAL=0.1040: xi2[8]=0.00390515 --> for Nn=8 (and kappa=1) xi2[8]_min is at aAL=0.1038: *)
  (* kappa=1; aAL=0.1038: *) 
  (* O4O6O8fitPPVMinnum[8]={0.000157449, {O4fitf -> -0.00138754, O6fitf -> 0.00263537, O8fitf -> -0.00212947}}  **** *)

  (* Nn=9, kappa=1; aAL=0.1036: xi2[9]=0.0323672; aAL=0.1040: xi2[9]=0.0083484; aAL=0.1042: xi2[9]=0.00319716;  aAL=0.1043: xi2[9]=0.00225137; aAL=0.1044: xi2[9]=0.0024679  --> for Nn=9 (and kappa=1) xi2[9]_min is at aAL=0.1043: *)
  (* kappa=1; aAL=0.1043: *) 
  (* O4O6O8fitPPVMinnum[9]={0.00225137, {O4fitf -> -0.0019323, O6fitf -> 0.00271104, O8fitf -> -0.00304537}}  **** *)

  (* Nn=10, kappa=1; aAL=0.1065, 0.1066, 0.1067, 0.1068, 0.1069 -> xi2[10]=0.1602, 0.1565, 0.1526, 0.1720, 0.1746, respectively  -->  for Nn=10 (and kappa=1) xi2[10]_min is at aAL=0.1067: *)
  (* kappa=1; aAL=0.1067: *) 
  (* O4O6O8fitPPVMinnum[10]={0.152639, {O4fitf -> -0.00335148, O6fitf -> 0.00374615, O8fitf -> -0.00642818}}  **** *)
   
  (* Summary, for kappa=1 and NchP=10, PV(+CI) approach: *)
(*
aALfPV[3]=0.1319; O4O6O8fitPPVMinnum[3]={8.72435, {O4fitf -> 0.0225121, O6fitf -> 0.0131115, O8fitf -> 0.00755042}};
 
aALfPV[4]=0.1116; O4O6O8fitPPVMinnum[4]={0.000724381, {O4fitf -> 0.00369978, O6fitf -> 0.00493949, O8fitf -> -0.000531704}};

 (* aALfPV[5]=0.1057, 0.1058, 0.1059, 0.1060, 0.1061: xi^2=0.00179939; 0.00128529; 0.00179144; 0.00155207; 0.00363221;  so the FIRST local minimum of xi^2 at aAL=0.1058; *)
 aALfPV[5]=0.1058;  O4O6O8fitPPVMinnum[5]={0.00128529, {O4fitf -> 0.000883256, O6fitf -> 0.00332168, O8fitf -> -0.000920479}};
  (* aALfPV[5]=0.10594; O4O6O8fitPPVMinnum[5]={0.0021833, {O4fitf -> 0.000858846, O6fitf -> 0.00340143, O8fitf -> -0.000964082}}; *)
 (* aALfPV[5]=0.10595; O4O6O8fitPPVMinnum[5]={0.00118125, {O4fitf -> 0.00085843, O6fitf -> 0.00339991, O8fitf -> -0.000956611}};  this is strange, this local minimum I will ignore *)
 (* aALfPV[5]=0.10596; O4O6O8fitPPVMinnum[5]={0.00121971, {O4fitf -> 0.000856676, O6fitf -> 0.00340576, O8fitf -> -0.000959971}}; *)
 (* aALfPV[5]=0.1060; O4O6O8fitPPVMinnum[5]={0.00155207, {O4fitf -> 0.000849667, O6fitf -> 0.00342918, O8fitf -> -0.000973415}}; *)
 (* aALfPV[5]=0.1061: O4O6O8fitPPVMinnum[5]={0.00363221, {O4fitf -> 0.000832174, O6fitf -> 0.00348783,   O8fitf -> -0.00100707}} *)

 
 (* aALfPV[6]=0.1040; O4O6O8fitPPVMinnum[6]={0.0012983156571, {O4fitf -> -0.00017180367523501175`, O6fitf -> 0.002822755705951555`, O8fitf -> -0.0011604024085024112`}}; *)
 (* aALfPV[6]=0.1041: O4O6O8fitPPVMinnum[6]={0.00136485, {O4fitf -> -0.000196727, O6fitf -> 0.00287777,   O8fitf -> -0.00119745}};
  aALfPV[6]=0.1039: O4O6O8fitPPVMinnum[6]={0.00292591, {O4fitf -> -0.000146861, O6fitf -> 0.00276787,  O8fitf -> -0.00112346}}; *)
 aALfPV[6]=0.10405; O4O6O8fitPPVMinnum[6]={0.00111994, {O4fitf -> -0.000184268, O6fitf -> 0.00285025, O8fitf -> -0.00117891}};

 aALfPV[7]=0.1037; O4O6O8fitPPVMinnum[7]={0.0006237979878128319`, {O4fitf -> -0.000815730468680909`, O6fitf -> 0.002710040238953602`, O8fitf -> -0.0015388621161230298`}};

 aALfPV[8]=0.1038; O4O6O8fitPPVMinnum[8]={0.000157449, {O4fitf -> -0.00138754, O6fitf -> 0.00263537, O8fitf -> -0.00212947}};

 aALfPV[9]=0.1043; O4O6O8fitPPVMinnum[9]={0.00225137, {O4fitf -> -0.0019323, O6fitf -> 0.00271104, O8fitf -> -0.00304537}}; 

 aALfPV[10]=0.1067; O4O6O8fitPPVMinnum[10]={0.152639, {O4fitf -> -0.00335148, O6fitf -> 0.00374615, O8fitf -> -0.00642818}};

 Clear[Nn]; Do[Module[{}, xi2PV[Nn]=O4O6O8fitPPVMinnum[Nn][[1]]; alsmtauPV[Nn]=aMSext[mtauphys^2/(kappa sigmax),aALfPV[Nn]] Pi;  O4PV[Nn]=O4fitf/.O4O6O8fitPPVMinnum[Nn][[2]]; O6PV[Nn]=O6fitf/.O4O6O8fitPPVMinnum[Nn][[2]]; O8PV[Nn]=O8fitf/.O4O6O8fitPPVMinnum[Nn][[2]]],{Nn,3,10}];
 *) 
(*-----*)
  (* End of Borel-Laplace in PPV approach *) 
  (*---------------------------------------------------------------------_*)
 (* Now FESR (2,n) moments a^{(2,n)} (i.e., double-pinched) in CI: *)
 (*--------*)
 (* First the experimental ALEPH values of (2,n) moments a^{(2,n)} (see also file rtauALEPH.m): *)
grs0a[2,nn_][sig_]:=((nn+3)/(nn+1)) (1/sigmax) (1 - (nn+2) (sig/sigmax)^(nn+1) + (nn+1) (sig/sigmax)^(nn+2) );
aexpBin77[2,nn_]:=(Sum[ dsbin[[ii]] grs0a[2,nn][sbin[[ii]]] OmegaVplA[ii],{ii,1,77}] + 2 Pi^2 fPi^2 grs0a[2,nn][mPi^2]) -  1;
delaexpBin77[2,nn_]:=(2 Pi^2) Sqrt[Sum[ grs0a[2,nn][sbin[[ii]]] grs0a[2,nn][sbin[[jj]]] dsbin[[ii]] dsbin[[jj]](  covVV[ii,jj]+covAA[ii,jj]+ covVA[ii,jj]+covAV[ii,jj] ),{ii,1,77},{jj,1,77}]];
(*  aexpBin77[2,n] +- delaexpBin77[2,n] = a^{(2,n)}_{exp} *)
(*---*)
(* Now the experimental ALEPH values for (1,n) moments a^{(1,n)} (see also the file rtauALEPH.m): *)
 grs0a[1,nn_][sig_]:=((nn+2)/(nn+1)) (1/sigmax) (1 - (sig/sigmax)^(nn+1));
aexpBin77[1,nn_]:=(Sum[ dsbin[[ii]] grs0a[1,nn][sbin[[ii]]] OmegaVplA[ii],{ii,1,77}] + 2 Pi^2 fPi^2 grs0a[1,nn][mPi^2]) -  1;
delaexpBin77[1,nn_]:=(2 Pi^2) Sqrt[Sum[ grs0a[1,nn][sbin[[ii]]] grs0a[1,nn][sbin[[jj]]] dsbin[[ii]] dsbin[[jj]](  covVV[ii,jj]+covAA[ii,jj]+ covVA[ii,jj]+covAV[ii,jj] ),{ii,1,77},{jj,1,77}]];
(*  a^{(1,n)}_{exp} = aexpBin77[1,n] +- delaexpBin77[1,n] *)
(*-----------------------*)
(* Now the theoretical FESR (2,n) moments a^{(2,n)} in CI: *)

kappa=1;  (* kappa = mu^2/Q^2, where mu^2 is RScl *)
tkap=kappa Exp[tKK];

  Nt=6;  (* the truncation order of delD[th,Nn], at ~a^Nn *)

  aAL=aALfPV[Nt];
 (* aAL=a(kappa*sigmax), FIXED here *)  
  
(* First for FIXED a(kappa sigmax)=aAL *)
sol2a[aALf_]:= NDSolve[{-I y'[th] == bta[y[th]], y[0] == aALf}, y, {th, -Pi, +Pi}];
(*'*) (* aALf=a[kappa sigmax] *)
   (*  aCI[th_? NumberQ,aALf_? NumberQ]:=First[y[th]/.sol2a[aALf]]; *)
 aCI[th_? NumberQ, aALf_] := First[y[th] /. sol2a[aALf]];
(* aALf=a(kappa sigmax); aCI[th,aALf]=a(Q2=kappa sigma Exp[I th]) *)

(* aCI[th,aAL] = a(kappa sigmax Exp[I th]), and aAL=a(kappa sigmax) *)
  
delD[th_,Nt]:= Sum[delddtk[jj-1,tkap] aCI[th,aAL]^jj, {jj, 1, Nt}];

th0=0.5;
DBorel1pl[th_]:=(1/be0*Exp[I th0])*(NIntegrate[BDsing[u Exp[I th0],tkap] Exp[-u Exp[I th0]/(be0 aCI[th,aAL])], {u, 0., 10.^3}]);
DBorel1mi[th_]:=(1/be0*Exp[-I th0])*(NIntegrate[BDsing[u Exp[-I th0],tkap] Exp[-u Exp[-I th0]/(be0 aCI[th,aAL])], {u, 0., 10.^3}]);
DBorelS[th_]:=(DBorel1pl[th]+DBorel1mi[th])/2;

DBorel[th_,Nt]:=DBorelS[th]+delD[th,Nt];(* This is PV *)
  (* DBorel[-th,Nt]=Conjugate[DBorel[th,Nt]]; *)
  (* aALf=a(kappa sigmax)= a(tkap Exp[tKK]) *)
 delDBorel[th_]:=(DBorel1pl[th]-DBorel1mi[th])/2/Pi/I;
 (*------------*)
  (* Now generation of the tables of Borel-resummed Adler function along the contour of radius kappa*sigmax, for fixed a(kappa sigmax)=aAL=aALtPV[Nt] (where Nt is a fixed truncation order) : *)

 Nn=60; 
  
Clear[tabDBorelS];  
tabDBorelS=Table[{jj*Pi/Nn,  DBorelS[N[jj*Pi/Nn]]}, {jj, 1, Nn - 1}]; 

Clear[tabdelDBorel];
tabdelDBorel=Table[{jj*Pi/Nn,  delDBorel[N[jj*Pi/Nn]]}, {jj, 1, Nn - 1}];

Clear[tabaCI];
Do[tabaCI[nn]=Table[{jj*Pi/Nn,  aCI[N[jj*Pi/Nn],aAL]^nn}, {jj, 1, Nn - 1}],{nn,1,Nt}];

Clear[tabdelD];
  tabdelD[Nt]=Table[{jj*Pi/Nn,  Sum[delddtk[mm-1,tkap] tabaCI[mm][[jj]][[2]],{mm,1,Nt}]}, {jj, 1, Nn - 1}];

tabDBorel[Nt]=Table[{jj*Pi/Nn, tabDBorelS[[jj]][[2]]+tabdelD[Nt][[jj]][[2]]},{jj,1,Nn-1}];
  (* Note: tabDBorel[N]= table of the values {jj*Pi/Nn,DBorel[th=jj*Pi/Nn,N]} (jj=1, ...,Nn-1), where DBorel has the polynomial corrective part with power up to (and including) aCI[th,aAL]^N *) 

Clear[Nn];
DBorSup=Interpolation[tabDBorelS];
DBorSfast[th_] :=If[th > 0, DBorSup[th], Conjugate[DBorSup[-th]]];
(* DBorSfast[th] is PV  Borel resummation of Adler D(Q^2=sigmax Exp[I th]) , FAST evaluation, the singular (S) part, i.e., with NO polynomial (correction) part *)

  
DBornn[Nt]=Interpolation[tabDBorel[Nt]];
DBorfast[th_,Nt] :=If[th > 0, DBornn[Nt][th], Conjugate[DBornn[Nt][-th]]];
  (* DBorfast[th,Nt]: This is PV Borel resummation of Adler D(Q^2=sigmax Exp[I th]) (D=0 Adler without LO term 1), FAST evaluation, with the polynomial (correction) part delD[th,Nt] truncated at a[kappa sigmax Exp[I th]]^Nt; note that Adler D(Q^2) = a(kappa Q^2) + O(a^2) i.e., without the term 1 (=O(a^0) *)
 (* It should approximate well the ('exact') expression DBorel[th,nn], which is evaluated much more SLOWLY; *)

delDBorSup=Interpolation[tabdelDBorel];
delDBorfast[th_] :=If[th > 0, delDBorSup[th], Conjugate[delDBorSup[-th]]]; 
(* delDBorfast[th] is the renormalon-uncertainty measure of DBorfast[th] *)
 (* It is equal to delDBorel[th], but much faster evaluation *)
 (*--------------*)
 (* moments a^{(2,n}}, PV, at fixed truncation order and for aAL=(a(kappa*sigmax))=aALfPV[Nt]: *)			     

 aaPVD0fast[2,nn_][Nt]:=(1/(2 Pi)) ((nn+3)/(nn+1))  NIntegrate[ ( Exp[I th] (1 - (-Exp[I th])^(nn+1)) + ((nn+1)/(nn+3))(1 - (-Exp[I th])^(nn+3)) ) DBorfast[th,Nt], {th, -Pi, Pi}];
(* aAL(=a(kappa sigmax)) =aALfPV[Nt], with Nt chosen FIXED truncation order *)
(*  aaPVD0fast[2,nn][Nt] is a^{(2,nn)} moment calculated with the value of  a(kappa sigmax) equal to aALf, calculated to truncation order Nt (~a^Nt) *)
aaPVfast[2,n_][Nt,O2np4_,O2np6_]:=aaPVD0fast[2,n][Nt] + ((n+3)/(n+1)) 2 Pi^2 (-1)^n ( (n+2) O2np4/sigmax^(n+2) + (n+1) O2np6/sigmax^(n+3) );
(* O2np4= <O_{2 n + 4}>_{V+A}; O2np6= <O_{2 n + 6}>_{V+A}; *)
   (* aaPVD0Sfast[2,nn_]:=(1/(2 Pi)) ((nn+3)/(nn+1))  NIntegrate[ ( Exp[I th] (1 - (-Exp[I th])^(nn+1)) + ((nn+1)/(nn+3))(1 - (-Exp[I th])^(nn+3)) ) DBorSfast[th], {th, -Pi, Pi}]; *)
   (* Note, on 2 March 2021 I compared with Cesar and found out an error in my prg in aaFOfast[2,n], aaCIfast[2,n], aaPVfast[2,n], aaRenfast[2,n]: the factor in front of the condensates must be (n+3)/(n+1), and NOT (n+3)/(n+2); this is numerically important *)
   (*----*)
(* moments a^{(1,n}}, PV (at Nt truncation order): *)
aaPVD0fast[1,nn_][Nt]:=(1/(2 Pi)) ((nn+2)/(nn+1))  NIntegrate[ ( (1 + Exp[I th]) - (1/(nn+2))(1 - (-Exp[I th])^(nn+2)) ) DBorfast[th,Nt], {th, -Pi, Pi}];
   (* aAL (=a(kappa sigmax))=aALfPV[Nt] *)
aaPVfast[1,n_][Nt, O2np4_]:=aaPVD0fast[1,n][Nt]+((n+2)/(n+1)) 2 Pi^2 (-1)^n O2np4/sigmax^(n+2); 
   (* aaPVD0Sfast[1,nn_]:=(1/(2 Pi)) ((nn+2)/(nn+1))  NIntegrate[ ( (1 + Exp[I th]) - (1/(nn+2))(1 - (-Exp[I th])^(nn+2)) ) DBorSfast[th], {th, -Pi, Pi}]; *)
   (* aAL (=a(kappa sigmax))=aALfPV[Nt] *)
(*------*)
   (* Now I have to repeat, for each truncation order Nt=3,4,5,...10, the calculation of  aaPVD0fast[2,0][Nt],  aaPVD0fast[2,1][Nt] and  aPVD0fast[1,0][Nt] (and their extensions aaPVfast[2,0][Nt,O4PV[Nt],O6PV[Nt]], aaPVfast[2,1][Nt,O6PV[Nt],O8PV[Nt]] and aaPVfast[1,0][Nt,O4PV[Nt]]): *)
(* When aALf=a(sigmax) is varied ('avar'), i.e.,using alO4O6O8fitPPVMinnum[N] (N=3,4,...15): *)
 (*
  Tab20D0PVavar= (*=Table[{Nt,Re[aaPVD0fast[2,0][Nt]]},{Nt,4,10}]*){{3,-0.143711},{4,0.17079},{5,0.217804},{6,0.235014},{7,0.245057},{8,0.254122},{9,0.262487},{10,0.282006}};
  Tab21D0PVavar= (*=Table[{Nt,Re[aaPVD0fast[2,1][Nt]]},{Nt,4,10}]*){{3,0.269286},{4,0.231079},{5,0.222099},{6,0.218784},{7,0.217857},{8,0.217216},{9,0.217244},{10,0.220795}}; 
  Tab10D0PVavar= (*=Table[{Nt,Re[aaPVD0fast[1,0][Nt]]},{Nt,4,10}]*){{3,0.0722406},{4,0.183589},{5,0.197769},{6,0.202855},{7,0.206439},{8,0.209991},{9,0.213775},{10,0.224562}}; 
  Tab20PVavar=Table[{NN, Tab20D0PVavar[[NN - 2]][[2]] + ((0 + 3)/(0 + 1)) 2 Pi^2 (-1)^0 ((0 + 2) O4PV[NN]/sigmax^(0 + 2) + (0 + 1) O6PV[NN]/sigmax^(0 + 3))}, {NN, 3, 10}];
  delTab20PVavar=Table[{NN, Tab20PVavar[[NN-2]][[2]]-Tab20PVavar[[NN-3]][[2]]},{NN,4,10}];
Tab21PVavar=Table[{NN, Tab21D0PVavar[[NN - 2]][[2]] + ((1 + 3)/(1 + 1)) 2 Pi^2 (-1)^1 ((1 + 2) O6PV[NN]/sigmax^(1 + 2) + (1 + 1) O8PV[NN]/sigmax^(1 + 3))}, {NN, 3, 10}]; delTab21PVavar= Table[{NN, Tab21PVavar[[NN - 2]][[2]] - Tab21PVavar[[NN - 3]][[2]]}, {NN, 4, 10}];
Tab10PVavar=Table[{NN,Tab10D0PVavar[[NN - 2]][[2]] + ((0+2)/(0+1)) 2 Pi^2 (-1)^0 O4PV[NN]/sigmax^(0 + 2)}, {NN, 3, 10}];
  delTab10PVavar=Table[{NN, Tab10PVavar[[NN-2]][[2]]-Tab10PVavar[[NN-3]][[2]]},{NN,4,10}];
ff20exp=Table[{NN,aexpBin77[2,0]},{NN,3,15}]; ff20plexp=Table[{NN,aexpBin77[2,0]+delaexpBin77[2,0]},{NN,3,15}]; ff20miexp=Table[{NN,aexpBin77[2,0]-delaexpBin77[2,0]},{NN,3,15}];
ff21exp=Table[{NN,aexpBin77[2,1]},{NN,3,15}];  ff21plexp=Table[{NN,aexpBin77[2,1]+delaexpBin77[2,1]},{NN,3,15}]; ff21miexp=Table[{NN,aexpBin77[2,1]-delaexpBin77[2,1]},{NN,3,15}];
ff10exp=Table[{NN,aexpBin77[1,0]},{NN,3,15}]; ff10plexp=Table[{NN,aexpBin77[1,0]+delaexpBin77[1,0]},{NN,3,15}]; ff10miexp=Table[{NN,aexpBin77[1,0]-delaexpBin77[1,0]},{NN,3,15}];
 *)   
  (*
 a20PVavar=ListPlot[{Tab20D0PVavar, Tab20PVavar, ff20exp, ff20miexp, ff20plexp}, PlotRange -> {{2.8, 10.2}, {0.16, 0.30}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "PV:" Superscript[(a), "(2,0)"]},Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.85}]]}]
 a20PVavarZoom =ListPlot[{Tab20D0PVavar, Tab20PVavar, ff20exp, ff20miexp, ff20plexp},PlotRange -> {{2.8, 10.2}, {0.235, 0.245}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "PV:" Superscript[a, "(2,0)"]},Epilog -> {Inset[Style["(b)", 13], Scaled[{0.15, 0.95}]]}]
a21PVavar=ListPlot[{Tab21D0PVavar, Tab21PVavar, ff21exp, ff21miexp, ff21plexp}, PlotRange -> {{2.8, 10.2}, {0.18, 0.235}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "PV:" Superscript[a, "(2,1)"]},Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.85}]]}]
a21PVavarZoom=ListPlot[{Tab21D0PVavar, Tab21PVavar, ff21exp, ff21miexp, ff21plexp}, PlotRange -> {{2.8, 10.2}, {0.200, 0.210}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "PV:" Superscript[a, "(2,1)"]},Epilog -> {Inset[Style["(b)", 13], Scaled[{0.40, 0.95}]]}]
a10PVavar=ListPlot[{Tab10D0PVavar, Tab10PVavar, ff10exp, ff10miexp, ff10plexp}, PlotRange -> {{2.8, 10.2}, {0.18, 0.23}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "PV:" Superscript[(a), "(1,0)"]},Epilog -> {Inset[Style["(a)", 13], Scaled[{0.20, 0.85}]]}]
   a10PVavarZoom =ListPlot[{Tab10D0PVavar, Tab10PVavar, ff10exp, ff10miexp, ff10plexp},PlotRange -> {{2.8, 10.2}, {0.200, 0.210}}, PlotStyle -> {Blue, Red, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}, {Black, PointSize[0.005]}}, Filling -> {4 -> {5}}, AxesLabel -> {N, "PV:" Superscript[a, "(1,0)"]},Epilog -> {Inset[Style["(b)", 13], Scaled[{0.20, 0.85}]]}]
   *) 
   (* at Nt=6 we have local minimum of a20, a21 and a10, so I will choose Nt=6 in the PV(+CI) global approach *)
   
    (*-------------------------------------------------*)  
   (* The global PV(+CI) approach, with uncertainties: *)
   
 Nt0=6;
   (* The corresponding central values of the global Borel-Laplace fit: *)
   (* NchP=10; kappa=1; the (semicircle) iterp. number was: Nn=60 *)
   aALfPV[6]=0.10405;
   O4O6O8fitPPVMinnum[6]={0.00111994, {O4fitf -> -0.000184268, O6fitf -> 0.00285025, 
				       O8fitf -> -0.00117891}};
 Clear[Nn]; Do[Module[{}, xi2PV[Nn]=O4O6O8fitPPVMinnum[Nn][[1]]; alsmtauPV[Nn]=aMSext[mtauphys^2/(kappa sigmax),aALfPV[Nn]] Pi;  O4PV[Nn]=O4fitf/.O4O6O8fitPPVMinnum[Nn][[2]]; O6PV[Nn]=O6fitf/.O4O6O8fitPPVMinnum[Nn][[2]]; O8PV[Nn]=O8fitf/.O4O6O8fitPPVMinnum[Nn][[2]]],{Nn,6,6}];

 (* We take here always: Nn=60 (interpolation index for upper semicircle; NchP=10; *)
   
(* First the estimate fo experimental uncertainties of aAL, O4, O6, O8 in the Nt=7 PV(+CI) global Borel-Laplace fit; due to instabilities and possible underestimations, we do not use the correlated (with variances) chi^2, but rather the uncorrelated chi^2: *)									
(* Number of equidistant points Nm in the interval 0.9 =< |M^2| =< 1.5 GeV^2: *)
Nm=2; Nd=3 Nm;  
M2cov1F[ii_]:=0.90+(ii-1)*0.60/(Nm-1); (* ii=1,..,Nm; this gives M2covF[1]=0.90, ... M2covF[Nm]=1.5 *)
Do[M2covF[jj]=M2cov1F[jj],{jj,1,Nm}]; Do[M2covF[jj+Nm]=M2cov1F[jj] Exp[I Pi/6],{jj,1,Nm}]; Do[M2covF[jj+2 Nm]=M2cov1F[jj] Exp[I Pi/4],{jj,1,Nm}]; (* in this way we have 3 Nm=Nd points M^2 in the complex M^2-plane, three with Psi=0, three with Psi=Pi/6, and three with Psi=Pi/4 *)

   (* Now vary O4 in UNCORRELATED chi ('var'): *)
(* Note: VBBexpFAux[M2,M2] = delReBPexpBinAL[M2]^2, as it should be *)
chi2o2O4[O4f_]:=Sum[(ReBPPV[M2covF[jj],Nt0,O4f,O6PV[Nt0],O8PV[Nt0]] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
O4PVvarfitMin=FindMinimum[chi2o2O4[O4fitf],{O4fitf,O4PV[Nt0]}];
O4PVvarfit=O4fitf/.O4PVvarfitMin[[2]];
Xi2O4PVvaro77=O4PVvarfitMin[[1]];
O4PVvarfitnum=	O4PVvarfit;
delO4PV= delO4f/.FindRoot[chi2o2O4[O4PVvarfitnum+delO4f]==Xi2O4PVvaro77+1,{delO4f, 3. 10^-5}];
(* --> for Nm=2 (Nd=6) we obtain: delO4PV=0.0000304; note that O4PV[Nt0]=-0.000171804, by global analysis *)

chi2o2O6[O6f_]:=Sum[(ReBPPV[M2covF[jj],Nt0,O4PV[Nt0],O6f,O8PV[Nt0]] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
O6PVvarfitMin=FindMinimum[chi2o2O6[O6fitf],{O6fitf,O6PV[Nt0]}];
O6PVvarfit=O6fitf/.O6PVvarfitMin[[2]];
Xi2O6PVvaro77=O6PVvarfitMin[[1]];
 delO6PV= delO6f/.FindRoot[chi2o2O6[O6PVvarfit+delO6f]==Xi2O6PVvaro77+1,{delO6f, 3. 10^-5}];
(* Nm=2; Nd=6; delO6PV=0.0000451; *)

chi2o2O8[O8f_]:=Sum[(ReBPPV[M2covF[jj],Nt0,O4PV[Nt0],O6PV[Nt0],O8f] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
O8PVvarfitMin=FindMinimum[chi2o2O8[O8fitf],{O8fitf,O8PV[Nt0]}];
O8PVvarfit=O8fitf/.O8PVvarfitMin[[2]];
Xi2O8PVvaro77=O8PVvarfitMin[[1]];
 delO8PV= delO8f/.FindRoot[chi2o2O8[O8PVvarfit+delO8f]==Xi2O8PVvaro77+1,{delO8f, 3. 10^-5}];
(* Nm=2; Nd=6; delO8PV=0.0000809; *)

chi2o2aAL=Sum[(ReBPPV[M2covF[jj],Nt0,O4PV[Nt0],O6PV[Nt0],O8PV[Nt0]] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
  (* I have to vary aAL (=a(sigmax)) around aALfPV[Nt0]=0.10405, (without varying O4PV[Nt0], O6PV[Nt0], O8PV[Nt0]), create thus DBorfast[th], evaluate chi2o2aAL, to see when chi2o2aAL increases by unity *)
  (* aAL=0.1036 -> chi2o2aAL=0.859601; *)
  (* aAL=0.10405 -> chi2o2aAL=0.00055349; *)
    (* aAL=0.1044 -> chi2o2aAL=0.846576; *)
    (* aAL=0.1045 -> chi2o2aAL=1.3341; *)
  (* -->  Nm=2; Nd=6; Nt0=6; --> delaALPV=0.0004 *)
   (*-------*)
  (* delO4PV=0.000030; delO6PV=0.000045;  delO8PV=0.000081; delaALPV=0.0004; *)
  
   (* --> The EXPERIMENTAL uncertainties are (PV global fit): *)
   (* a(sigmax)=0.10405+{^{+0.0004}_{-0.0005}}_{exp}; --> *)
   (* alpha_s(mtau^2)=0.3157+{^{+0.0012}_{-0.0014}}_{exp}; *)
   (* 10^3 O4=-0.2+{^{+0.0}_{-0.0}}_{exp}; *)
   (* 10^3 O6=+2.9+{^{+0.0}_{-0.1}}_{exp};  *)
   (* 10^3 O8=-1.2+{^{+0.1}_{-0.1}}_{exp};  *)
   (* aGG= 6 (O4 + ddel) -> 10^3 aGG= +0.9+{^{+0.2}_{-0.2}}_{exp}  *)
  (* checked twice *)
  (*---------------------------------------------------*)
(* Variation of kappa, PV global, Nt0=6: *)
   (* kappa=2.0  (note: now aAL=a(2.0 sigmax) : *)
   (*
    aAL=0.0880: xi2[Nt0]=0.0238614;
    aAL=0.0878: xi2[Nt0]=0.00784163;
    aAL=0.0877: xi2[Nt0]=0.00409158;
    aAL=0.0876: xi2[Nt0]=0.00310312;
    aAL=0.0875: xi2[Nt0]=0.00475565;
    aAL=0.0874: xi2[Nt0]=0.00912415;
    aAL=0.0872: xi2[Nt0]=0.0259491;
    aAL=0.0870: xi2[Nt0]=0.0534571;
    (*    --> kappa=2.0; aAL=0.0876; O4O6O8fitPPVMinnum[6]={0.00310312, {O4fitf -> 0.00082374, O6fitf -> 0.00296493, O8fitf -> -0.000716492}}; checked twice, for aAL=0.0875, 0.0876, 0.0877 *)
(* kappa=1.0 (the central case of the global fit): *)
(* aAL=0.10405; O4O6O8fitPPVMinnum[6]={0.00111994, {O4fitf -> -0.000184268, O6fitf -> 0.00285025, O8fitf -> -0.00117891}}; *)
    (* kappa=0.5  (note: now aAL=a(0.5 sigmax), Nt0=6 : *)
  (*
   aAL=0.1350; xi2[Nt0]=1.75918;
   aAL=0.1320; xi2[Nt0]=1.45815;
   aAL=0.1313; xi2[Nt0]=1.45407;
   aAL=0.1312; xi2[Nt0]=1.45359;
   aAL=0.1311; xi2[Nt0]=1.45345;
   aAL=0.1310; xi2[Nt0]=1.45367;
   aAL=0.1309; xi2[Nt0]=1.45497;
   aAL=0.1300; xi2[Nt0]=1.47264;
   aAL=0.1250; xi2[Nt0]=2.08482;
   *)
     (* --> kappa=0.5; aAL=0.1311; O4O6O8fitPPVMinnum[6]={1.45345, {O4fitf -> -0.000851269, O6fitf -> 0.00288614, O8fitf -> -0.00347118}};  (bad fit); checked twice for aAL=0.1310, 0.1311, 0.1312 *)

 (* Note that aAL=a(kappa*sigmax) *)
(* --> thus the variations of kappa give (PV global fit): *)
(* alpha_s(mtau^2)=0.3157+{^{+0.0039}_{-0.0019}}_{del kappa}; *)
   (* 10^3 O4=-0.2+{^{+1.0}_{-0.7}}_{del kappa}; *)
   (* 10^3 O6=+2.9+{^{+0.1}_{+0.0}}_{del kappa};  *)
   (* 10^3 O8=-1.2+{^{+0.5}_{-2.3}}_{del kappa};  *)
     (* aGG= 6 (O4 + ddel) -> 10^3 aGG= +0.9+{^{+6.0}_{-4.0}}_{del kappa} *)
     (* checked twice *)
(*-----------------*)
     (* Variation of deld4, PV global fit (kappa=1; NchP=10; note, now Nt=5): *)
(* delddtk[4,tkap]=1207.16+338.19 =1545.35 (d4=2 338.19= 676.38): *)
(* 
 aAL=0.1052; xi2[5]=0.034504;
 aAL=0.1050; xi2[5]=0.0196651;
 aAL=0.1048; xi2[5]=0.00921872;
 aAL=0.1046; xi2[5]=0.00318769;
 aAL=0.1045; xi2[5]=0.00184456; 
 aAL=0.1044; xi2[5]=0.00155541;
 aAL=0.1043; xi2[5]=0.00160144;
 aAL=0.1042; xi2[5]=0.00298499;
 aAL=0.1040; xi2[5]=0.0109213;
  *)
     (* --> aAL=0.1044 (=a(sigmax)); O4O6O8fitPPVMinnum[5]={0.00155541, {O4fitf -> 0.000353205, O6fitf -> 0.00302163, O8fitf -> -0.000940343}}; checked twice for aAL=0.1044 *)
(* delddtk[4,tkap]=1207.16 (d4=338.19); (the central case of the global fit): *)
     (* aAL(=aALfPV[5])=0.10595; O4O6O8fitPPVMinnum[5]={0.00118125, {O4fitf -> 0.00085843, O6fitf -> 0.00339991, O8fitf -> -0.000956611}} *)
(* delddtk[4,tkap]=1207.16-338.19=868.969 (d4=0): *)
   (*
    aAL=0.1080: xi2[5]=0.0255569;
    aAL=0.1074: xi2[5]=0.00164749;
    aAL=0.1073: xi2[5]=0.00108131;
    aAL=0.1072: xi2[5]=0.00135943;
    aAL=0.1070: xi2[5]=0.00472911;
    aAL=0.1068: xi2[5]=0.0117411;
    aAL=0.1060: xi2[5]=0.0930546;
    *)
(* --> aAL= 0.1073; O4O6O8fitPPVMinnum[5]={0.00108131, {O4fitf -> 0.00150864, O6fitf -> 0.00368061, O8fitf -> -0.000873977}}; checked twice for aAL=0.1073 *)
(* --> alpha_s(mtau^2)[Nt=5]=0.3212+{^{-0.0045}_{+0.0039}}_{del deld4}; *)
   (* 10^3 O4[Nt=5]=+0.9+{^{-0.5}_{+0.6}}_{del deld4}; *)
   (* 10^3 O6[Nt=5]=+3.4+{^{-0.4}_{+0.3}}_{del deld4};  *)
   (* 10^3 O8[Nt=5]=-1.0+{^{+0.1}_{+0.1}}_{del deld4};  *)
     (* aGG[Nt=5]= 6 (O4 + ddel) -> 10^3 aGG= +7.1+{^{-3.0}_{+3.9}}_{del deld4} *)
     (* checked twice *)
     (*-----------------*)
(* Variation of Nt=6+-1, PV global fit (kappa=1; NchP=10): *)
(* Nt=6+1=7: *)
 (* aAL(=aALfPV[7])=0.1037; O4O6O8fitPPVMinnum[7]={0.000623798, {O4fitf -> -0.00081573, O6fitf -> 0.00271004, O8fitf -> -0.00153886}}; *)
 (*  Nt=6 (central case): *)
 (* aAL(=aALfPV[6])=0.10405; O4O6O8fitPPVMinnum[6]={0.00111994, {O4fitf -> -0.000184268, O6fitf -> 0.00285025, O8fitf -> -0.00117891}}; *)
(* Nt=6-1=5: *) 
 (* aAL(=aALfPV[5])=0.1058; O4O6O8fitPPVMinnum[5]={0.00128529, {O4fitf -> 0.000883256, O6fitf -> 0.00332168, O8fitf -> -0.000920479}}; *)
 (*  --> alpha_s(mtau^2)=0.3157+{^{-0.0010}_{+0.0051}}_{del Nt}; *)
 (* 10^3 O4=-0.2+{^{-0.6}_{+1.1}}_{del Nt}; *)
 (* 10^3 O6=+2.9+{^{-0.2}_{+0.5}}_{del Nt};  *)
 (* 10^3 O8=-1.2+{^{-0.3}_{+0.2}}_{del Nt};  *)
 (* aGG= 6 (O4 + ddel) -> 10^3 aGG= +0.9+{^{-3.8}_{+6.2}}_{del Nt}  *)
     (* checked twice *)  
(*-----------------------------------------*)
     (* Adding renormalon ambiguity ('amb') to Adler: in ReBPPV we replace BBPVD0[M2f,Nn] by: (BPPVD0[M2f, Nn] + BPPVdelD0[M2f]) *)
(* Nt=6; O4O6O8fitPPVMinN[6] gives the following xi^2 =xi2[6]: *)
(* aAL=0.10405: xi2[6]=0.05285;
   aAL=0.1040:  xi2[6]=0.04626; 
   aAL=0.1038:  xi2[6]=0.02454;
   aAL=0.1036:  xi2[6]=0.01039;
   aAL=0.1034:  xi2[6]=0.00549; 
   aAL=0.1033:  xi2[6]=0.00350;
   aAL=0.1032:  xi2[6]=0.00282;    
   aAL=0.1031:  xi2[6]=0.00345;
 -----
   aAL=0.10317:  xi2[6]=0.002871;    
   aAL=0.10318:  xi2[6]=0.002841;
   aAL=0.10319:  xi2[6]=0.002824;
   aAL=0.10320:  xi2[6]=0.002820;  ****
   aAL=0.10321:  xi2[6]=0.002830;
   aAL=0.10322:  xi2[6]=0.002852;
   aAL=0.10323:  xi2[6]=0.002887;
 *)
 (* Therefore: aAL=0.10320 where xi2[6] is minimal: *)
 (* BBPVD0[M2f,Nn] -> (BPPVD0[M2f, Nn] + BPPVdelD0[M2f]); Nt=6:
  aAL=0.10320;  O4O6O8fitPPVMinN[6]={0.00282042, {O4fitf -> -0.000886043, O6fitf -> 0.00329577, O8fitf -> -0.000840987}} *)
     (*-----*)
 (* The central value  (BBPVD0[M2f,Nn]): 
  aAL=0.10405;  O4O6O8fitPPVMinN[6]={0.00111994, {O4fitf -> -0.000184268, O6fitf -> 0.00285025, O8fitf -> -0.00117891}}; *)    
(* When  in ReBPPV we replace BBPVD0[M2f,Nn] by: (BPPVD0[M2f, Nn] - BPPVdelD0[M2f]) *)    
(* Nt=6; O4O6O8fitPPVMinN[6] gives the following xi^2 =xi2[6]: *)
(*
aAL=0.10405: xi2[6]=0.0489; 
aAL=0.10405: xi2[6]=0.04893;
aAL=0.1046: xi2[6]=0.01284; 
aAL=0.1047: xi2[6]=0.00862;
aAL=0.1048: xi2[6]=0.00523;
aAL=0.1049: xi2[6]=0.00270;
aAL=0.1050: xi2[6]=0.001021;
aAL=0.1051: xi2[6]=0.000193;
aAL=0.1052: xi2[6]=0.000217;
aAL=0.1053: xi2[6]=0.001058;
------
aAL=0.10511: xi2[6]=0.000156;
aAL=0.10513: xi2[6]=0.000109;
aAL=0.10514: xi2[6]=0.000098;
aAL=0.10515: xi2[6]=0.000095;  ***
aAL=0.10516: xi2[6]=0.000101;
aAL=0.10517: xi2[6]=0.000115;
aAL=0.10518: xi2[6]=0.000137;
 *)
 (* Therefore: aAL=0.10515 where xi2[6] is minimal: *)
(* BBPVD0[M2f,Nn] -> (BPPVD0[M2f, Nn] - BPPVdelD0[M2f]); Nt=6:
 aAL=0.10515;  O4O6O8fitPPVMinN[6]={0.0000949632, {O4fitf -> 0.000562437, O6fitf -> 0.00240416, O8fitf -> -0.0016664}; *)
     (*------*)
(* --> aAL=0.10405 + {^{-0.00085}_{+0.00110}}_{amb}  --> *)     
     (* alpha_s(mtau^2)=0.3157  + {^{-0.0021}_{+0.0032}}_{amb};
10^3 O4=-0.2 + {^{-0.7}_{+0.8}}_{amb}; *)
10^3 O6=+2.9 + {^{+0.4}_{-0.5}}_{amb};  *)
10^3 O8=-1.2 + {^{+0.4}_{-0.5}}_{amb};  *)
10^3 aGG= 6 10^3 (O4 + ddel) -> 10^3 aGG= +0.9 + {^{-4.2}_{+4.5}}_{amb}  *)
(*-----------------------------------------*)    
     (* Altogether, the PV(+CI)global approach gives (Nt=6): *)
(* alpha_s(mtau^2)=0.3157 + {^{+0.0012}_{-0.0014}}_{exp} + {^{+0.0039}_{-0.0019}}_{del kappa} + {^{-0.0045}_{+0.0039}}_{del deld4} + {^{-0.0010}_{+0.0051}}_{del Nt}  + {^{-0.0021}_{+0.0032}}_{amb} = 0.3157 + {^{+0.0083}_{-0.0056}} =app 0.316 + {^{+0.008}_{-0.006}};  *)
(* 10^3 O4= -0.2 + {^{+0.0}_{-0.0}}_{exp} + {^{+1.0}_{-0.7}}_{del kappa} + {^{-0.5}_{+0.6}}_{del deld4} + {^{-0.6}_{+1.1}}_{del Nt} + {^{-0.7}_{+0.8}}_{amb} = -0.2 + {^{+1.8}_{-1.3}}; *)
(* 10^3 O6= +2.9 + {^{+0.0}_{-0.1}}_{exp} + {^{+0.1}_{+0.0}}_{del kappa} + {^{-0.4}_{+0.3}}_{del deld4} + {^{-0.2}_{+0.5}}_{del Nt} + {^{+0.4}_{-0.5}}_{amb} = +2.9 + {^{+0.7}_{-0.7}};  *)
(* 10^3 O8= -1.2 + {^{+0.1}_{-0.1}}_{exp} + {^{+0.5}_{-2.3}}_{del kappa} + {^{+0.1}_{+0.1}}_{del deld4} + {^{-0.3}_{+0.2}}_{del Nt} + {^{+0.4}_{-0.5}}_{amb} = -1.2 + {^{+0.7}_{-2.4}}; *)
(* 10^3 aGG = +0.9 + {^{+0.2}_{-0.2}}_{exp} + {^{+6.0}_{-4.0}}_{del kappa} + {^{-3.0}_{+3.9}}_{del deld4} + {^{-3.8}_{+6.2}}_{del Nt}  + {^{-4.2}_{+4.5}}_{amb} = +0.9 + {^{+10.5}_{-7.6}} =app +1 + {^{+10}_{-8}}; *)

(* End of PV(+CI) global fit results *)
    (*---------------------------------------------------*)
   (*---------------------------------------------------*)  
   (*-------------------------------------------------*)
    (* Now combining FO and tFO; and CI and PV(+CI) global results (plots), for a21, a20 and a10 (with all (alpha_s, O4, O6, O8)  variable: *)

a20FOtFOavar=
ListPlot[{Tab20D0tFOavar, Tab20D0FOavar, Tab20tFOavar, Tab20FOavar, ff20exp, ff20miexp, ff20plexp}, 
  PlotRange -> {{2.8, 12.2}, {0.205, 0.35}}, 
  PlotStyle -> {Red, Black, Red, 
    Black, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}, {Blue, 
     PointSize[0.002]}}, Filling -> {6 -> {7}}, 
  AxesLabel -> {Subscript[N, t], Superscript[(a), "(2,0)"]}, 
  Joined -> {False, False, False, False, False, True, True}, 
  PlotMarkers -> {\[FilledCircle], \[FilledSquare], \[FilledDiamond], \
\[FilledUpTriangle], \[FilledVerySmallSquare], \
\[FilledVerySmallSquare], \[FilledVerySmallSquare]}, 
  Epilog -> {Inset[Style["(a)", 13], Scaled[{0.70, 0.95}]]}, 
  PlotMarkers -> Automatic, 
  PlotLegends -> Placed[{"tFO (D=0)", "FO (D=0)", "tFO", "FO"}, {0.17, 0.78}]];
a20FOtFOavarZoom=
ListPlot[{Tab20D0tFOavar, Tab20D0FOavar, Tab20tFOavar, Tab20FOavar, ff20exp, ff20miexp, ff20plexp}, 
  PlotRange -> {{2.8, 12.2}, {0.237, 0.245}}, 
  PlotStyle -> {Red, Black, Red, 
    Black, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}, {Blue, 
     PointSize[0.002]}}, Filling -> {6 -> {7}}, 
  AxesLabel -> {Subscript[N, t], Superscript[(a), "(2,0)"]}, 
  Joined -> {False, False, False, False, True, True, True}, 
  PlotMarkers -> {\[FilledCircle], \[FilledSquare], \[FilledDiamond], \
\[FilledUpTriangle], \[FilledVerySmallSquare], \
\[FilledVerySmallSquare], \[FilledVerySmallSquare]}, 
  Epilog -> {Inset[Style["(b)", 13], Scaled[{0.40, 0.95}]]}, 
  PlotLegends -> Placed[{"tFO (D=0)", "FO (D=0)", "tFO", "FO"}, {0.85, 0.75}]];

a20CIPVavar= 
 ListPlot[{Tab20D0CIavar, Tab20D0PVavar, Tab20CIavar, Tab20PVavar, 
   ff20exp, ff20miexp, ff20plexp}, 
  PlotRange -> {{2.8, 10.2}, {0.205, 0.35}}, 
  PlotStyle -> {Red, Black, Red, 
    Black, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}, {Blue, 
     PointSize[0.002]}}, Filling -> {6 -> {7}}, 
  AxesLabel -> {Subscript[N, t], Superscript[(a), "(2,0)"]}, 
  Joined -> {False, False, False, False, False, True, True}, 
  PlotMarkers -> {\[FilledCircle], \[FilledSquare], \[FilledDiamond], \
\[FilledUpTriangle], \[FilledVerySmallSquare], \
\[FilledVerySmallSquare], \[FilledVerySmallSquare]}, 
  Epilog -> {Inset[Style["(a)", 13], Scaled[{0.50, 0.95}]]}, 
  PlotMarkers -> Automatic, 
  PlotLegends -> Placed[{"CI (D=0)", "PV (D=0)", "CI", "PV"}, {0.17, 0.78}]];
a20CIPVavarZoom= 
 ListPlot[{Tab20D0CIavar, Tab20D0PVavar, Tab20CIavar, Tab20PVavar, 
   ff20exp, ff20miexp, ff20plexp}, 
  PlotRange -> {{2.8, 10.2}, {0.237, 0.245}}, 
  PlotStyle -> {Red, Black, Red, 
    Black, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}, {Blue, 
     PointSize[0.002]}}, Filling -> {6 -> {7}}, 
  AxesLabel -> {Subscript[N, t], Superscript[(a), "(2,0)"]}, 
  Joined -> {False, False, False, False, True, True, True}, 
  PlotMarkers -> {\[FilledCircle], \[FilledSquare], \[FilledDiamond], \
\[FilledUpTriangle], \[FilledVerySmallSquare], \
\[FilledVerySmallSquare], \[FilledVerySmallSquare]}, 
  Epilog -> {Inset[Style["(b)", 13], Scaled[{0.60, 0.95}]]}, 
  PlotLegends -> Placed[{"CI (D=0)", "PV (D=0)", "CI", "PV"}, {0.18, 0.75}]];

a21FOtFOavar= 
 ListPlot[{Tab21D0tFOavar, Tab21D0FOavar, Tab21tFOavar, Tab21FOavar, 
   ff21exp, ff21miexp, ff21plexp}, 
  PlotRange -> {{2.8, 12.2}, {0.195, 0.230}}, 
  PlotStyle -> {Red, Black, Red, 
    Black, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}, {Blue, 
     PointSize[0.002]}}, Filling -> {6 -> {7}}, 
  AxesLabel -> {Subscript[N, t], Superscript[(a), "(2,1)"]}, 
  Joined -> {False, False, False, False, False, True, True}, 
  PlotMarkers -> {\[FilledCircle], \[FilledSquare], \[FilledDiamond], \
\[FilledUpTriangle], \[FilledVerySmallSquare], \
\[FilledVerySmallSquare], \[FilledVerySmallSquare]}, 
  Epilog -> {Inset[Style["(a)", 13], Scaled[{0.60, 0.95}]]}, 
  PlotMarkers -> Automatic, 
  PlotLegends -> Placed[{"tFO (D=0)", "FO (D=0)", "tFO", "FO"}, {0.17, 0.78}]];
a21FOtFOavarZoom= 
 ListPlot[{Tab21D0tFOavar, Tab21D0FOavar, Tab21tFOavar, Tab21FOavar, 
   ff21exp, ff21miexp, ff21plexp}, 
  PlotRange -> {{2.8, 12.2}, {0.198, 0.2095}}, 
  PlotStyle -> {Red, Black, Red, 
    Black, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}, {Blue, 
     PointSize[0.002]}}, Filling -> {6 -> {7}}, 
  AxesLabel -> {Subscript[N, t], Superscript[(a), "(2,1)"]}, 
  Joined -> {False, False, False, False, True, True, True}, 
  PlotMarkers -> {\[FilledCircle], \[FilledSquare], \[FilledDiamond], \
\[FilledUpTriangle], \[FilledVerySmallSquare], \
\[FilledVerySmallSquare], \[FilledVerySmallSquare]}, 
  Epilog -> {Inset[Style["(b)", 13], Scaled[{0.90, 0.25}]]}, 
  PlotMarkers -> Automatic, 
  PlotLegends -> Placed[{"tFO (D=0)", "FO (D=0)", "tFO", "FO"}, {0.20, 0.22}]];

a21CIPVavar= 
 ListPlot[{Tab21D0CIavar, Tab21D0PVavar, Tab21CIavar, Tab21PVavar, 
   ff21exp, ff21miexp, ff21plexp}, 
  PlotRange -> {{2.8, 10.2}, {0.195, 0.230}}, 
  PlotStyle -> {Red, Black, Red, 
    Black, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}, {Blue, 
     PointSize[0.002]}}, Filling -> {6 -> {7}}, 
  AxesLabel -> {Subscript[N, t], Superscript[(a), "(2,1)"]}, 
  Joined -> {False, False, False, False, False, True, True}, 
  PlotMarkers -> {\[FilledCircle], \[FilledSquare], \[FilledDiamond], \
\[FilledUpTriangle], \[FilledVerySmallSquare], \
\[FilledVerySmallSquare], \[FilledVerySmallSquare]}, 
  Epilog -> {Inset[Style["(a)", 13], Scaled[{0.60, 0.95}]]}, 
  PlotMarkers -> Automatic, 
  PlotLegends -> Placed[{"CI (D=0)", "PV (D=0)", "CI", "PV"}, {0.17, 0.78}]];
a21CIPVavarZoom= 
 ListPlot[{Tab21D0CIavar, Tab21D0PVavar, Tab21CIavar, Tab21PVavar, 
   ff21exp, ff21miexp, ff21plexp}, 
  PlotRange -> {{2.8, 10.2}, {0.198, 0.2095}}, 
  PlotStyle -> {Red, Black, Red, 
    Black, {Blue, PointSize[0.002]}, {Blue, PointSize[0.002]}, {Blue, 
     PointSize[0.002]}}, Filling -> {6 -> {7}}, 
  AxesLabel -> {Subscript[N, t], Superscript[(a), "(2,1)"]}, 
  Joined -> {False, False, False, False, True, True, True}, 
  PlotMarkers -> {\[FilledCircle], \[FilledSquare], \[FilledDiamond], \
\[FilledUpTriangle], \[FilledVerySmallSquare], \
\[FilledVerySmallSquare], \[FilledVerySmallSquare]}, 
  Epilog -> {Inset[Style["(b)", 13], Scaled[{0.90, 0.25}]]}, 
  PlotMarkers -> Automatic, 
  PlotLegends -> Placed[{"CI (D=0)", "PV (D=0)", "CI", "PV"}, {0.20, 0.22}]];

(* Export["a20FOtFOavar.pdf",a20FOtFOavar]; Export["a20FOtFOavarZ.pdf",a20FOtFOavarZoom]; Export["a21FOtFOavar.pdf",a21FOtFOavar]; Export["a21FOtFOavarZ.pdf",a21FOtFOavarZoom]; *)
(*  Export["a20CIPVavar.pdf",a20CIPVavar]; Export["a20CIPVavarZ.pdf",a20CIPVavarZoom]; Export["a21CIPVavar.pdf",a21CIPVavar]; Export["a21CIPVavarZ.pdf",a21CIPVavarZoom]; *)
(*-------------------------------------------------------------------*)
(* PV(+CI) a^{(2,5)(D=0)approach: *)
   (* Now calculation of (2,n) and (1,n) (D=0) momenta for n=6 (+-1) and adjusting aAL=a(kappa*sigmax) so that momenta are equal to the experimental values *)
   
kappa=1;  (* kappa = mu^2/Q^2, where mu^2 is RScl *)

   tkap=kappa Exp[tKK];

   aAL=0.10516; Nt=10;
   (* aAL(=a(kappa sigmax)); value adjustable by hand here *)
   
Nn=60; 
Clear[tabDBorelS];  
tabDBorelS=Table[{jj*Pi/Nn,  DBorelS[N[jj*Pi/Nn]]}, {jj, 1, Nn - 1}]; 
Clear[tabdelDBorel];
tabdelDBorel=Table[{jj*Pi/Nn,  delDBorel[N[jj*Pi/Nn]]}, {jj, 1, Nn - 1}];
Clear[tabaCI];
Do[tabaCI[nn]=Table[{jj*Pi/Nn,  aCI[N[jj*Pi/Nn],aAL]^nn}, {jj, 1, Nn - 1}],{nn,1,Nt}];
Clear[tabdelD];
  tabdelD[Nt]=Table[{jj*Pi/Nn,  Sum[delddtk[mm-1,tkap] tabaCI[mm][[jj]][[2]],{mm,1,Nt}]}, {jj, 1, Nn - 1}];
tabDBorel[Nt]=Table[{jj*Pi/Nn, tabDBorelS[[jj]][[2]]+tabdelD[Nt][[jj]][[2]]},{jj,1,Nn-1}];
  (* Note: tabDBorel[N]= table of the values {jj*Pi/Nn,DBorel[th=jj*Pi/Nn,N]} (jj=1, ...,Nn-1), where DBorel has the polynomial corrective part with power up to (and including) aCI[th,aAL]^N *) 
Clear[Nn];
DBorSup=Interpolation[tabDBorelS];
DBorSfast[th_] :=If[th > 0, DBorSup[th], Conjugate[DBorSup[-th]]];
(* DBorSfast[th] is PV  Borel resummation of Adler D(Q^2=sigmax Exp[I th]) , FAST evaluation, the singular (S) part, i.e., with NO polynomial (correction) part *)
DBornn[Nt]=Interpolation[tabDBorel[Nt]];
DBorfast[th_,Nt] :=If[th > 0, DBornn[Nt][th], Conjugate[DBornn[Nt][-th]]];
   (* DBorfast[th,Nt]: This is PV Borel resummation of Adler D(Q^2=sigmax Exp[I th]) (D=0 Adler without LO term 1), FAST evaluation, with the polynomial (correction) part delD[th,Nt] truncated at a[kappa sigmax Exp[I th]]^Nt; note that Adler D(Q^2) = a(kappa Q^2) + O(a^2) i.e., without the term 1 (=O(a^0) *)
 (* It should approximate well the ('exact') expression DBorel[th,nn], which is evaluated much more SLOWLY; *)
    delDBorSup=Interpolation[tabdelDBorel]; delDBorfast[th_] :=If[th > 0, delDBorSup[th], Conjugate[delDBorSup[-th]]];  (* this is the ambiguity of DBorel *)
aaPVD0fast[1,nn_][Nt]:=(1/(2 Pi)) ((nn+2)/(nn+1))  NIntegrate[ ( (1 + Exp[I th]) - (1/(nn+2))(1 - (-Exp[I th])^(nn+2)) ) DBorfast[th,Nt], {th, -Pi, Pi}];

aaPVD0fast[2,nn_][Nt]:=(1/(2 Pi)) ((nn+3)/(nn+1))  NIntegrate[ ( Exp[I th] (1 - (-Exp[I th])^(nn+1)) + ((nn+1)/(nn+3))(1 - (-Exp[I th])^(nn+3)) ) DBorfast[th,Nt], {th, -Pi, Pi}];
   (* aAL(=a(kappa sigmax)) *)
    (* delaaPVD0fast[2, nn_] := (1/(2 Pi)) ((nn + 3)/(nn + 1)) NIntegrate[(Exp[I th] (1 - (-Exp[I th])^(nn + 1)) + ((nn + 1)/(nn + 3)) (1 - (-Exp[I th])^(nn + 3))) DdelBorfast[th], {th, -Pi, Pi}]; the is the (renormalon-)ambiguity of aaPVD0fast[2,nn][Nt] when integrating above or below the real axis in the u-complex plane; delaaPVD0fast[2, 5]=0.000894   --> del(aaPVD0fast[2,5][10])= \pm 0.000894 ->  del(aALPV25[10])= \mp 0.00033_{ren.amb.} *)


    (* at fixed aAL=0.10516, variation of aaPVD0fast[2,5][Nt] as function of Nt: {Nt, aaPVD0fast[2,5][Nt]}: taba25vsNt={{4,0.16269},{5,0.174491}, {6,0.179001},{7,0.180758},{8,0.181673},{9,0.182061},{10,0.182287},{11,0.182319},{12,0.182149},{13,0.181958},{14,0.179881},{15,0.181286},{16,0.154344 },{17,0.224331}}; deltaba25vsNt=Table[{Nn,taba25vsNt[[Nn-3]][[2]]-taba25vsNt[[Nn-4]][[2]]},{Nn,5,17}]; ListPlot[taba25vsNt]; ListPlot[deltaba25vsNt]; --> stabilization at Nt=10-12; I will take Nt=10; *)

    (* Results for aAL=aALPV25[Nt]=aaPVD0fast[2,5][Nt] such that aaPVD0fast[2,5][Nt]=0.182289(=aexpBin77[2,5]): *)
   (* kappa=1; Nt=4,5,6,7,8,9,10,11,12,13,14,15: *)
   (* aALPV25[4]=0.11421; alsmtauPV25[4]=0.34503;
 aALPV25[5]=0.10829; alsmtauPV25[5]=0.32800;
 aALPV25[6]=0.10641; alsmtauPV25[6]=0.32256; 
    aALPV25[7]=0.10573; alsmtauPV25[7]=0.32059;
    aALPV25[8]=0.10539; alsmtauPV25[8]=0.31961;
    aALPV25[9]=0.10524; alsmtauPV25[9]=0.31917;
    aALPV25[10]=0.10516; alsmtauPV25[10]=0.31894;
    aALPV25[11]=0.10515;  alsmtauPV25[11]=0.31891;
    aALPV25[12]=0.10521;  alsmtauPV25[12]=0.31909;
    aALPV25[13]=0.10529;  alsmtauPV25[13]=0.31932;
    aALPV25[14]=0.10632;  alsmtauPV25[14]=0.32230;
    aALPV25[15]=0.10557;  alsmtauPV25[15]=0.32013;
    (* no solution for Nt=16, weird *)
    *)  
   (* Clear[Nn]; tabalsmtauPV25=Table[{Nn,alsmtauPV25[Nn]},{Nn,4,15}]; ListPlot[tabalsmtauPV25]; *)
    (* Minimum at Nn=10-11; choose Nn=10: *)
   (* Choose: Nn=10 (truncation order in PV(+CI)approach for a^{(2,5}}[Nn] *)
    (* kappa=2: aaPVD0fast[2,5][10]=0.18229 -> aALPV25[10]=0.08745 ->  alsmtauPV25[10]=0.31893; i.e., almost no change in comparison with kappa=1 *)
    (* kappa=0.5: aaPVD0fast[2,5][10]=0.18229 -> aALPV25[10]=0.13713-> alsmtauPV25[10]=0.32367 *)
    (* variation of d4 is made by varying delddtk[4,kap]=1207.16 (with kappa=1) by +- 338.7 when taking Nt=5 (the singular part is not varied): delddtk[4,kap]=1207.16+338.2 -> aALPV25[5]=0.10690; alsmtauPV25[5]=0.32398; delddtk[4,kap]=1207.16-338.2 -> aALPV25[5]=0.10978; alsmtauPV25[5]=0.33229; delddtk[4,kap]=1207.16 (the model-predicted value) ->  aALPV25[5]=0.10829; alsmtauPV25[5]=0.32800; -->  ^{-0.0040}_{+0.0043}_{deld4}  *)
    (* variation of Nt truncation order: Nt=10: aALPV25[10]=0.10516; alsmtauPV25[10]=0.31894; Nt=11: aALPV25[11]=0.10515;  alsmtauPV25[11]=0.31891; Nt=9: aALPV25[9]=0.10524; alsmtauPV25[9]=0.31917;  --> ^{-0.0000}_{+0.0002}_{Nt=10+-1} *)
  (* Variation due to renormalon ambiguity ('amb'): in aaPVD0fast[2, nn_][Nt] we use, instead of DBorfast[th, Nt]: (DBorfast[th, Nt] + delDBorfast[th]), we obtain: (aaPVD0fast[2, 5][10]=aexpBin77[2,5]->) aAL=0.10484, alsmtau=0.3180; when using, instead of DBorfast[th, Nt]: (DBorfast[th, Nt] - delDBorfast[th]), we obtain: (aaPVD0fast[2, 5][10]=aexpBin77[2,5]->) aAL=0.105429, alsmtau=0.3199 *) 
     
    (*  alsmtauPV25[10]=0.31894; rounding up: *)
    (* alsmtauPV25pred=0.3189 \pm 0.0041_{exp} + {^{-0.0000}_{+0.0047}}_{kappa} + {^{-0.0040}_{+0.0043}}_{deld4} + {^{-0.0000}_{+0.0002}}_{Nt=10+-1} + {^{+0.0010}_{-0.0016}}_{n=5+-1}+ {^{-0.0009}_{+0.0010}}_{amb} = 0.3189 + {^{+0.0077}_{-0.0060}} (here we added in quadrature all increases (+0.0077), and all decreases (-0.0057)) =app 0.319 + {^{0.008}_{-0.006}} *)
										(* Thus: Nn=10,  alsmtauPV25pred=0.3189+{^{+0.0076}_{-0.0057}} --> aAL(=a(sigmax))= 0.105145 + {^{+0.002627}_{-0.001965}} --> *)

 (* --> Using Nn(semicircle interp. number)=60.; NchP=10; kappa=1: *)
(* aAL(=a(sigmax))=0.105145+0.002627=0.107772: *)
(*  O4O6O8fitPPVMinN[10]={0.208883, {O4fitf -> -0.00379739, O6fitf -> 0.00434719, O8fitf -> -0.00747081}}; *)
(* aAL(=a(sigmax))=0.105145: *)
(*  O4O6O8fitPPVMinN[10]={0.188219, {O4fitf -> -0.00272026, O6fitf -> 0.00290388, O8fitf -> -0.0050499}}; *)
(* aAL(=a(sigmax))=0.105145-0.001965=0.10318: *)
(*  O4O6O8fitPPVMinN[10]={0.351079, {O4fitf -> -0.00195174, O6fitf -> 0.00191313, O8fitf -> -0.00355163}}; *)

    (*--> in PV(+CI) approach, from a^{(2,5}}_{PV,D=0,[Nt]=[10]} + Borel-Laplace[Nt=10} we obtain:
 (* alpha_s(mtau^2)= 0.3189 + {^{+0.0076}_{-0.0057}} =app 0.319 + {^{+0.008}_{-0.006}}; *)
(* 10^3 O4=-2.7 + {^{-1.1}_{+0.7}}; 10^3 O6=+2.9 + {^{+1.4}_{-1.0}}; 10^3 O8=-5.0 + {^{-2.5}_{+1.4}};
 aGG= 6 (O4 + ddel) = -14 + {^{-7}_{+4};  *)
    
   (* End of PV(+CI) approach *)  
     
    (*   Npt=10000;   aaPVD0plextMC[2, nn_,aALf_] := (1/be0*
    Exp[I th0])*(1/(2 Pi)) ((nn + 3)/(nn + 
      1))*(NIntegrate[(Exp[
          I th] (1 - (-Exp[I th])^(nn + 1)) + ((nn + 1)/(nn + 
             3)) (1 - (-Exp[I th])^(nn + 3))) BDsing[u Exp[I th0], 
       tkap] Exp[-u Exp[I th0]/(be0 aCI[th, aALf])], {u, 0., 
      1.}, {th, -Pi, Pi}, 
     Method -> {"MonteCarloRule", "Points" -> Npt}] + 
    NIntegrate[(Exp[
          I th] (1 - (-Exp[I th])^(nn + 1)) + ((nn + 1)/(nn + 
             3)) (1 - (-Exp[I th])^(nn + 3))) (1/z^2) BDsing[
       Exp[I th0]/z, tkap] Exp[-Exp[I th0]/(z be0 aCI[th, aALf])], {z,
       0., 1.}, {th, -Pi, Pi}, 
	       Method -> {"MonteCarloRule", "Points" -> Npt}]);
    aaPVD0miextMC[2, nn_,aALf_] := (1/be0*
    Exp[-I th0])*(1/(2 Pi)) ((nn + 3)/(nn + 
      1))*(NIntegrate[(Exp[
          I th] (1 - (-Exp[I th])^(nn + 1)) + ((nn + 1)/(nn + 
             3)) (1 - (-Exp[I th])^(nn + 3))) BDsing[u Exp[-I th0], 
       tkap] Exp[-u Exp[-I th0]/(be0 aCI[th, aALf])], {u, 0., 
      1.}, {th, -Pi, Pi}, 
     Method -> {"MonteCarloRule", "Points" -> Npt}] + 
    NIntegrate[(Exp[
          I th] (1 - (-Exp[I th])^(nn + 1)) + ((nn + 1)/(nn + 
             3)) (1 - (-Exp[I th])^(nn + 3))) (1/z^2) BDsing[
       Exp[-I th0]/z, 
       tkap] Exp[-Exp[-I th0]/(z be0 aCI[th, aALf])], {z, 0., 
      1.}, {th, -Pi, Pi}, 
	       Method -> {"MonteCarloRule", "Points" -> Npt}]);
    aaPVD0SextMC[2, nn_, aALf_] :=(aaPVD0miextMC[2, nn][aALf]+aaPVD0plextMC[2, nn][aALf])/2;
aaPVD0delDext[2, nn_, aALf_][Nn_] := (1/(2 Pi)) ((nn + 3)/(nn + 
       1)) NIntegrate[(Exp[
         I th] (1 - (-Exp[I th])^(nn + 1)) + ((nn + 1)/(nn + 
            3)) (1 - (-Exp[I th])^(nn + 3))) delDext[th, Nn, 
      aALf], {th, -Pi, Pi}];
    aaPVD0extMC[2, nn_, aALf_][Nn_] :=  aaPVD0SextMC[2, nn, aALf] +aaPVD0delDext[2, nn, aALf][Nn];
    *)
   (* MC calculation with VARIABLE aALf=a(kappa*sigmax) takes a long time to calculate, we will not use it; further, due to strong cancellation between aaPVD0SextMC[2, nn, aALf] (MC) and aaPVD0delDext[2, nn, aALf][Nn] ("exact" nonMC), the uncertaiinty of the result is difficult to suppress *)


    (* End of PV(+CI) approach *)  
 (*-------------------*)
(*---------------------------------------------------------------------_*)
(*---------------------------------------------------------------------_*)
(* (Double-)Pinched ('P') Borel-Laplace in renormalon-resummed (Ren) approach (PRen): *)

 (* May 31, 2021: I noticed that I used LMM Ren-model parameters, instead of MSbar Ren-model parameter; today I correct this: *)

<</home/gorazd/3danQCD.dir/MSbarRenMod5A.save;
 
(* Now double-pinched ('P') Re[BPRen]: *)
tdIRp21=tdIRp2;

alsin=0.3575;  (*= alpha_s(mtauphys^2;MSbar) *)
<</home/gorazd/3danQCD.dir/aMSQ2complS_almtauinput.m; 
(*  Now this gives: aMSpert[Q2,phi]=a(Q^2=Q2 Exp[I phi]; MSbar; nf=3)  (Q2=|Q^2|>0) *)

dGdIR[fi_?NumberQ]:=NIntegrate[(GdIR[tt]/tt) aMSpert[Exp[-tKK] sigmax tt,fi],{tt,0,1}];
dGdUV[fi_?NumberQ]:=NIntegrate[(GdUV[1/zz]/zz) aMSpert[sigmax Exp[-tKK] (1/zz),fi],{zz,0,1}];
 dGdSL[fi_?NumberQ]:=NIntegrate[(GdSL[tt]/tt) (aMSpert[Exp[-tKK] sigmax tt,fi]-aMSpert[Exp[-tKK] sigmax,fi]),{tt,0,1}];
dGdD0Ren[fi_?NumberQ]:=dGdIR[fi]+dGdSL[fi]+dGdUV[fi]; 
(* This is Adler d^{(D=0)}(Q^2=sigmax Exp[I fi]) *)

Nn =40.; tabDsigmaxth= Table[{jj*Pi/Nn, dGdD0Ren[jj*N[Pi]/Nn]}, {jj, 1, Nn - 1}]; (* Save["tabDsigmax280altau0320.save", tabDsigmaxth] *)
dD0RenPos= Interpolation[tabDsigmaxth];
dD0RenInt[th_] := If[th > 0, dD0RenPos[th], Conjugate[ dD0RenPos[-th]]]; 
(* dD0RenInt[phi]=d_{D=0}(Q^2=sigmax Exp{i phi]) renormalon-resummed (and interpolated along the circle radius sigmax); for a pQCD MSbar with alpha_s(mtauphys^2;MSbar)=alsin; it is much faster than dGdD0Ren[phi] *)
BPRenD0Int[M2_?NumberQ]:=(1/(2 Pi)) (NIntegrate[ ( ( (1 + Exp[I th])^2 - 2 (M2/sigmax) (1 + Exp[I th]) + 2  (M2/sigmax)^2 ) Exp[(sigmax/M2) Exp[I th]] - 2 (M2/sigmax)^2 Exp[-(sigmax/M2)] ) dD0RenInt[th], {th, -Pi, Pi}]); (* This is the contribution of d_{D=0}(Q^2) to the double-pinched Borel-Laplace *)


(* If no interpolation along the circle is made for d_{D=0}(sigmax Exp[I phi]): epps=10.^-8; BPRenD0[M2_?NumberQ]:=(1/(2 Pi)) (NIntegrate[ ( ( (1 + Exp[I th])^2 - 2 (M2/sigmax) (1 + Exp[I th]) + 2  (M2/sigmax)^2 ) Exp[(sigmax/M2) Exp[I th]] - 2 (M2/sigmax)^2 Exp[-(sigmax/M2)] ) dGdD0Ren[th], {th, -Pi, -epps}] + NIntegrate[ ( ( (1 + Exp[I th])^2 - 2 (M2/sigmax) (1 + Exp[I th]) + 2  (M2/sigmax)^2 ) Exp[(sigmax/M2) Exp[I th]] - 2 (M2/sigmax)^2 Exp[-(sigmax/M2)] ) dGdD0Ren[th], {th, epps, Pi}]); BPRenD0[0.9]=0.18371223934769293, needs several minutes; far too long for practical purposes; *)
(* for example, when alsin=0.320: Timing[BPRenD0[0.9 Exp[I Pi/6]]]={521.06, 0.15849 - 0.083749 I}; but Timing[BPRenD0Int[0.9 Exp[I Pi/6]]]={0.276713, 0.158491 - 0.083738 I} (Nn=20) *)

ReBPRen[M2f_?NumberQ,O4_,O6_,O8_]:=Re[((1- 2 M2f/sigmax) + 2 (M2f/sigmax)^2 (1 - Exp[-sigmax/M2f]))+BPRenD0Int[M2f]+  2 Pi^2 ( (1/(M2f sigmax))(2 O4 + O6/sigmax) + (1/M2f^2) (O4 + 2 (O6/sigmax) + (O8/sigmax^2)) + (1/M2f^3) (1/2)(O6 + 2 O8/sigmax) + (1/M2f^4) (1/6) O8 )] (* Re[B[M2,Nn,O4,O6,O8]], i.e., the real part of the double-pinched Borel-Laplace for renormalon-resummed approach (Ren); M2=M^2 is COMPLEX in general *)

  O4init = 0.001; O6init = -0.001; O8init = 0.0005;  (* alsin fixed here *)
O4O6O8fitPRenMinN= FindMinimum[Sum[(ReBPRen[M2FP[jj] Exp[I Pi/6], O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/6]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/6]]^2, {jj, 0, NchP}]+Sum[(ReBPRen[M2FP[jj] Exp[I Pi/4], O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj] Exp[I Pi/4]])^2/delReBPexpBinAL[M2FP[jj] Exp[I Pi/4]]^2, {jj, 0, NchP}]+Sum[(ReBPRen[M2FP[jj], O4fitf,O6fitf,O8fitf] - ReBPexpBinAL[M2FP[jj]])^2/delReBPexpBinAL[M2FP[jj]]^2, {jj, 0, NchP}], {{O4fitf, O4init},{O6fitf, O6init},{O8fitf, O8init}}];

 (* May 31, 2021: for Nn=10 and NchP=10: (alsin,xi2)=(0.35, 243.7); (0.34, 206.); (0.33,171.); (0.32,  140.); (0.31,113.4); (0.30,92.3); (0.29, 76.1); (0.28, 64.3); (0.27, 56.2); (0.26, 51.3); (0.25, 49.1043); (0.24, 49.1035); (0.23, 51.006); (0.22, 54.54); (0.21, 59.47); (0.20, 65.55); *) 
 (*  Refining the minimal xi^2: Nn=20 and NchP=10: (alsin,xi2)=(0.240, 49.0285); (0.242, 48.8463); (0.244, 48.7409); (0.246, 48.7149); (0.248, 48.7708); (0.250, 48.9113);  (0.252, 49.1392);  (0.254, 49.4577); *)
 (* Refiningthe minimal xi^2: Nn=40 and NchP=10:  (alsin,xi2)=(0.243, 48.7789); (0.244,48.7355); (0.245, 48.7118); (0.246, 48.7083); (0.247, 48.7252); (0.248, 48.7629); *)
 (* ---> May 31, 2021: alsin=0.246; this is much lower than alsin=0.3575 (=app 0.358) when, erroneously, the LMM characteristic function parameters (AND LMM tkk) were used; why? in MSbar tKK=0.519 and in LMM tKK=-0.770, which means that in MSbar the effective momentum scales of integration at a given t are 3.6-times smaller than in LMM, which means that in MSbar the Landau cut problem is much more emphasised *)
 (* alsin=alpha_s(mtau^2)=0.246: O4O6O8fitPRenMinN={48.7083, {O4fitf -> 0.00549874, O6fitf -> -0.00722537, O8fitf -> 0.00411338}}; *)
  (*---*)
 (* Experimental variation of alpha_s(mtau^2)=alsin: *)
(* We use the (semicicle interpolation)index Nn=40; alsin=0.3575; *)
(* NchP=10: *)
O4O6O8fitPRenMinnum={2.77397, {O4fitf -> -0.00167724, O6fitf -> 0.000575483, O8fitf -> -0.00158122}};
O4Ren=O4fitf/.O4O6O8fitPRenMinnum[[2]];
O6Ren=O6fitf/.O4O6O8fitPRenMinnum[[2]];
O8Ren=O8fitf/.O4O6O8fitPRenMinnum[[2]];

(* Number of equidistant points Nm in the interval 0.9 =< |M^2| =< 1.5 GeV^2: *)
Nm=2; Nd=3 Nm;  
M2cov1F[ii_]:=0.90+(ii-1)*0.60/(Nm-1); (* ii=1,..,Nm; this gives M2covF[1]=0.90, ... M2covF[Nm]=1.5 *)
Do[M2covF[jj]=M2cov1F[jj],{jj,1,Nm}]; Do[M2covF[jj+Nm]=M2cov1F[jj] Exp[I Pi/6],{jj,1,Nm}]; Do[M2covF[jj+2 Nm]=M2cov1F[jj] Exp[I Pi/4],{jj,1,Nm}]; (* in this way we have 3 Nm=Nd points M^2 in the complex M^2-plane, three with Psi=0, three with Psi=Pi/6, and three with Psi=Pi/4 *)
chi2o2aAL=Sum[(ReBPRen[M2covF[jj],O4Ren,O6Ren,O8Ren] - ReBPexpBinAL[M2covF[jj]])^2/ delReBPexpBinAL[M2covF[jj]]^2,{jj,1,Nd}];
(alsin=0.3575 -> chi2o2aAL=1.40; alsin=0.3575+0.0004 -->  chi2o2aAL=2.23 (with unchanged condensates); alsin=0.3575+0.0005 -->  chi2o2aAL=2.63 (with unchanged condensates); *)
(* alsin=0.3575-0.0004 -->  chi2o2aAL=1.83 (with unchanged condensates);  alsin=0.3575-0.0005 -->  chi2o2aAL=2.14 (with unchanged condensates);  alsin=0.3575-0.0006 -->  chi2o2aAL=2.51 (with unchanged condensates);*)

(* Thus, Ren global fit gives: *)
(* --> alpha_s(mtau^2)(=alsin) = 0.3575 + {^{+0.0005}_{-0.0006}}_{exp} =app 0.358 + {^{+0.000}_{-0.001}}_{exp}; *)
(* In the resummed Ren model, it is difficult to define the theoretical uncertainties; the result is independent of kappa, and of truncation order (there is no truncation); further, the model predicts d4 (=338.19), and to vary that, we would have to construct the model with a different LB-renormalon ansatz *)
(* delO4Ren(=delO4PV=delO4CI=delO4FO)=0.000030; delO6Ren(=delO6PV=delO6CI=delO6FO)=0.000045; delO8Ren(=delO8PV=delO8CI=delO8FO)=0.000081; *)
(* --> 10^3 O4=-1.7 + {^{+0.0}_{-0.0}}_{exp}; 10^3 O6=+0.6 + {^{0.0}-{-0.1}}_{exp}; 10^3 O8=-1.6 + {^{+0.1}_{-0.1}}_{exp}; *)
(* 10^3 aGG =  10^3 6 (O4 + ddel) = -8.1 + {^{+0.2}_{-0.2}}_{exp} =app -8 + {^{+0}_{-0}}_{exp} *)

 
(* End of Ren global fit *)
(*-----------------*)
   (* Now calculation of (2,n) and (1,n) (D=0) momenta for n=5 (+-1) and adjusting aAL=a(kappa*sigmax) so that momenta are equal to the experimental values *)
(* in the 'Ren' (renormalon-resummed) approach: *)
(* We adjust the value of alsin(=alpha_s(mtauphys^2;MSbar)) so that a^{(2,5)}_{Ren,D=0}= 0.182289 +- 0.003822  (=aexpBin77[2, 5] +- delaexpBin77[2, 5], the ALEPH experimental value) *)
 
alsin=0.36939;  (*= alpha_s(mtauphys^2;MSbar), here adjusted by hand
		*)
<</home/gorazd/3danQCD.dir/aMSQ2complS_almtauinput.m; 
(*  Now this gives: aMSpert[Q2,phi]=a(Q^2=Q2 Exp[I phi]; MSbar; nf=3)  (Q2=|Q^2|>0) *)

dGdIR[fi_?NumberQ]:=NIntegrate[(GdIR[tt]/tt) aMSpert[Exp[-tKK] sigmax tt,fi],{tt,0,1}];
dGdUV[fi_?NumberQ]:=NIntegrate[(GdUV[1/zz]/zz) aMSpert[sigmax Exp[-tKK] (1/zz),fi],{zz,0,1}];
 dGdSL[fi_?NumberQ]:=NIntegrate[(GdSL[tt]/tt) (aMSpert[Exp[-tKK] sigmax tt,fi]-aMSpert[Exp[-tKK] sigmax,fi]),{tt,0,1}];
dGdD0Ren[fi_?NumberQ]:=dGdIR[fi]+dGdSL[fi]+dGdUV[fi];

Nn =10.;
tabDsigmaxth= Table[{jj*Pi/Nn, dGdD0Ren[jj*N[Pi]/Nn]}, {jj, 1, Nn - 1}];
dD0RenPos= Interpolation[tabDsigmaxth];
dD0RenInt[th_] := If[th > 0, dD0RenPos[th], Conjugate[ dD0RenPos[-th]]]; 
(* dD0RenInt[phi]=d_{D=0}(Q^2=sigmax Exp{i phi]) renormalon-resummed (and interpolated along the circle radius sigmax); for a pQCD MSbar with alpha_s(mtauphys^2;MSbar)=alsin; it is much faster than dGdD0Ren[phi] *)

aaRenD0fast[1,nn_]:=(1/(2 Pi)) ((nn+2)/(nn+1))  NIntegrate[ ( (1 + Exp[I th]) - (1/(nn+2))(1 - (-Exp[I th])^(nn+2)) ) dD0RenInt[th], {th, -Pi, Pi}];
aaRenD0fast[2,nn_]:=(1/(2 Pi)) ((nn+3)/(nn+1))  NIntegrate[ ( Exp[I th] (1 - (-Exp[I th])^(nn+1)) + ((nn+1)/(nn+3))(1 - (-Exp[I th])^(nn+3)) ) dD0RenInt[th], {th, -Pi, Pi}];

   (* Results for alsin=alpha_s(mtau^2;MSbar): *)
(* We adjust the value of alsin(=alpha_s(mtauphys^2;MSbar)) so that a^{(2,5)}_{Ren,D=0}= 0.182289 +- 0.003822  (=aexpBin77[2, 5] +- delaexpBin77[2, 5], the ALEPH experimental value) *)
(May 31, 2021 (corrected parameters) Nn=10: (alsin,aaRenD0fast[2, 5])=(0.25,0.12051); (0.30, 0.149729); (0.35, 0.172723); (0.369, 0.179696); (0.38, 0.183398); (0.39, 0.18661)*)
(* May 31, 2021  (corrected parameters), refining Nn=40: (0.372,0.180694); (0.373,0.181031); (0.374, 0.181365); (0.375,0.181698); (0.376,0.182028); (0.377,0.182357); (0.378,0.182684); (0.379,0.18301); (0.380,0.183334); *)
(* --> May 31, 2021 (the corrected, i.e., MSbar Ren-model parameters used):  a^{(2,5)}_{Ren,D=0}= 0.182289 --> alsin=alpha_s(mtau^2)=0.377 *)

(* (old, LMM Ren-model parameters used, ERRONEOUS): Nn=40; aaRenD0fast[2, 5]=0.182289 -> alsin=0.36939 =appr 0.3694 *)  


aaRenfast[2,n_][O2np4_,O2np6_]:=aaRenD0fast[2,n] + ((n+3)/(n+1)) 2 Pi^2 (-1)^n ( (n+2) O2np4/sigmax^(n+2) + (n+1) O2np6/sigmax^(n+3) );
(* O2np4= <O_{2 n + 4}>_{V+A}; O2np6= <O_{2 n + 6}>_{V+A}; *)
   (* aALf= a(kappa sigmax) *)
(* Note, on 2 March 2021 I compared with Cesar and found out an error in my prg in aaFOfast[2,n], aaCIfast[2,n], aaPVfast[2,n], aaRenfast[2,n]: the factor in front of the condensates must be (n+3)/(n+1), and NOT (n+3)/(n+2); this is numerically important *)
aaRenfast[1,n_][O2np4_]:=aaRenD0fast[1,n]+((n+2)/(n+1)) 2 Pi^2 (-1)^n O2np4/sigmax^(n+2);

(* alsin=0.3575; Nn=40; NchP=10; O4O6O8fitPRenMinnum={2.773973580144038`, {O4fitf -> -0.0016772396924599462`,   O6fitf -> 0.0005754830501688608`, O8fitf -> -0.001581221090059177`}}; O4Ren=O4fitf/.O4O6O8fitPRenMinnum[[2]]; O6Ren=O6fitf/.O4O6O8fitPRenMinnum[[2]];  O8Ren=O8fitf/.O4O6O8fitPRenMinnum[[2]]; *)
(* --> *)
(* a^{(2,0}}_{Ren}: *)
(* aaRenD0fast[2, 0]=0.261282 =appr 0.261; *)
(* aaRenfast[2, 0][O4Ren, O6Ren]=0.237498 = appr 0.237; *)
(* aexpBin77[2, 0]=0.240381 +- 0.002612 =appr 0.240+-0.003 *)
(* a^{(2,1}}_{Ren}: *)
(* aaRenD0fast[2, 1]=0.201958 =appr 0.202; *)
(* aaRenfast[2, 1][O6Ren, O8Ren]=0.200884 = appr 0.201; *)
(* aexpBin77[2, 1]=0.206095 +- 0.002605 =appr 0.206+-0.003 *)
(* a^{(1,0}}_{Ren}: *)
(* aaRenD0fast[1, 0]=0.208703 =appr 0.209; *)
(* aaRenfast[1, 0][O4Ren]=0.200257 =appr 0.200; *)
(* aexpBin77[1, 0]=0.206114 +- 0.003098 =appr 0.206+-0.003 *)

(* I reiterate here: *)
(* From a^{(2,5)}_{Ren,D=0}: *)
(* -->  alsin=alpha_s(mtau^2)=0.3694+{^{+0.0072}_{-0.0071}}_{exp}+{^{-0.0010}_{-0.0028}}_{Nn=5+1-1} =0.3694 + {^{+0.0072}_{-0.0076}} =app 0.369 + {^{+0.008}_{-0.007}}; *)


(* End of Ren (renormalon-resummed)approach *)
 (*--------------------------------------------------------------*)
 (*--------------------------------------------------------------*)
 (*--------------------------------------------------------------*)
