ClearAll[pmax,Qmax,h1,GVTab,GVTabnew1,GVTabnew2,PTTabnew,DTTabnew,PTTabGv,h1fun,h1int,h1ser,JTab];
SetDirectory[NotebookDirectory[]];
(* choose your favorite CICY *)
<<X8.m
{CY,chi,kappa,c2}
(* constructing the table of coefficients *)
JTab=CoefficientList[h1int,q];

(* Castelnovo bound on the genus of GV invariants *)
gMax[Q_]:=Floor[((Q^2)/(2 kappa))+(Q/2)+1];
chiOD=kappa/6+c2/12;
(* first subleading coefficient in h1[mu=0] *)
J1=-(-1)^chiOD Coefficient[h1int[[1]],q]

MatrixForm[GVTabnew2]

(* GV invariants for submaximal genus -- multiplied by suitable power of (-1) *)
LiGVsubmax=Table[(-1)^(kappa i (i-1)/2)GVTabnew2[[kappa i,3]],{i,2,Length[GVTabnew2]/kappa}](* PT invariants for maximal genus *)
LiPTmax=Table[(-1)^(kappa i (i-1)/2)PTfromJ[kappa i,1-gMax[kappa i]]/.repJ,{i,2,20}]
(* PT invariants for submaximal genus *)
LiPTsubmax=Table[(-1)^(kappa i (i-1)/2)PTfromJ[kappa i,2-gMax[kappa i]]/.repJ,{i,2,20}]

ListPlot[LiGVsubmax]

P=Simplify[InterpolatingPolynomial[LiGVsubmax,d/kappa-1]]

Pmax=Simplify[InterpolatingPolynomial[LiPTmax,d/kappa-1]]

Psubmax=Simplify[InterpolatingPolynomial[LiPTsubmax,d/kappa-1]]

(* compare to prediction from Soheyla's theorem *)
Simplify[{Pmax-(chiOD(1/2 d (d/kappa-1)+chiOD)),Psubmax-(-J1(1/2 d (d/kappa-1)+chiOD-1))}]

Table[{Pmax,Psubmax,Psubmax-(2gMax[d]-2)Pmax},{d,2kappa,20,kappa}]

PGVsubmax=Simplify[Psubmax-(2(1+(d/2)+((d^2)/(2kappa)))-2)Pmax]

Simplify[P-PGVsubmax]

Table[PGVsubmax,{d,kappa,30,kappa}]

(* results for X5,X6,X8,X10, up to overall power of (-1) *)
P5=3200-425 d+((155 (d^2))/2)-((d^4)/10);
P6=-(2/9) (-8262+1449 d-444 (d^2)+(d^4));
P8=2664-460 d+216 (d^2)-((d^4)/2);
P10=1150-((593 d)/2)+280 (d^2)-((3 (d^4))/2);

(* general result, for mu=0 mod kappa and mu large enough *)
Clear[J1,chiOD,kappa];Pgen=-J1 (1/2 mu (mu/kappa-1)+chiOD-1) -(2(1+(mu/2)+((mu^2)/(2kappa)))-2)chiOD(1/2 mu (mu/kappa-1)+chiOD);
Pgen-P5/.{kappa->5,chiOD->5,J1->-800,mu->d}//Expand
Pgen-P6/.{kappa->3,chiOD->4,J1->-612,mu->d}//Expand
Pgen-P8/.{kappa->2,chiOD->4,J1->-888,mu->d}//Expand
Pgen-P10/.{kappa->1,chiOD->3,J1->-575,mu->d}//Expand