SetAttributes[ϵ,Constant];
SetAttributes[M,Constant];
SetAttributes[κ,Constant];
ord=2;

h[r_]:=1;
f[r_]:=1/b[r]^2;
p[r_]:=r^2/b[r];

(*b[r_]:=1-2*M/r;*)

<< Sigma.m
S2=S;
Clear[S];

Clear[i,j,k]
For[i=0,i≤ord+4,i++,
For[j=0,j≤ord+4,j++,
For[k=0,k≤(ord+4)/2,k++,
Subscript[S,i,j,k]=S2[[i+1,j+1,k+1]];
];
];
];

σ[t,r,η]=Sum[If[i+j+2k≤ord+4,Subscript[S,i,j,k]*dt[t/ϵ]^i*dr[r/ϵ]^j*η^k*ϵ^(i+j+2*k),0],{i,0,ord+4},{j,0,ord+4},{k,0,(ord+4)/2}]//Expand;

σ2[t,r,η]=Series[σ[t,r,η],{ϵ,0,2}]//Normal//Expand;

σ3[t,r,η]=σ[t,r,η]-σ2[t,r,η]//Expand;

<< Delta.m

Clear[i,j,k]
For[i=0,i≤ord+2,i++,
For[j=0,j≤ord+2,j++,
For[k=0,k≤(ord+2)/2,k++,
Subscript[c,i,j,k]=cs[[i+1,j+1,k+1]];
];
];
];

lDel[t,r,η]=Sum[If[i+j+2k≤ord+2,Subscript[c,i,j,k]*dt[t/ϵ]^i*dr[r/ϵ]^j*η^k*ϵ^(i+j+2*k),0],{i,0,ord+2},{j,0,ord+2},{k,0,(ord+2)/2}]//Expand;

Dim=Dimensions[lDel[t,r,η]][[1]]

uprule={dr[r/ϵ-r2/ϵ]->dr[r-r2],dt[t/ϵ-t2/ϵ]->dt[t-t2],x[t/ϵ,t2/ϵ,r/ϵ,r2/ϵ,η]->x[t,t2,r,r2,η],Y[θ/ϵ,ϕ/ϵ]->Y[θ,ϕ],ϵ*D[Y[θ/ϵ,ϕ/ϵ],θ]->D[Y[θ,ϕ],θ],ϵ^2*D[Y[θ/ϵ,ϕ/ϵ],{θ,2}]->D[Y[θ,ϕ],{θ,2}]}
dnrule={dr[r-r2]->dr[r/ϵ-r2/ϵ],dt[t-t2]->dt[t/ϵ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j])=0;
(Subscript[G11, i,j])=0;
(Subscript[G12, i,j])=0;
(Subscript[G21, i,j])=0;
(Subscript[G22, i,j])=0;
(Subscript[Gsq, i,j])=0;
(Subscript[bG, i,j])=0;
(Subscript[bpG, i,j])=0;
(Subscript[bbpG, i,j])=0;
];
];

Grn=Series[1/(8*Pi^2)*(u[t,t2,r,r2,η]/s[t,t2,r,r2,η]+u[t,t2,r,r2,η]*κ^2/6+u[t,t2,r,r2,η]*κ^4/180*(2dt[t/ϵ-t2/ϵ]^2*ϵ^2-s[t,t2,r,r2,η]))/.uprule//Expand,{ϵ,0,ord}]/.dnrule//Normal//Expand;

For[i=-2,i≤ord,i++,
For[j=0,j≤4,j++,
(Subscript[G, i,j])=Coefficient[Coefficient[Grn,κ,j],ϵ,i]*κ^j*ϵ^i//Expand;
(*Print[(Subscript[G, i,j])];*)
];
];

y1rule={η->Y[θ/ϵ,ϕ/ϵ]};
y2rule={Y[θ/ϵ,ϕ/ϵ]->η};

Arrr=2*M/((2*M-r)*r);
Aroo=3*M-r;
Grn10=D[Grn/.y1rule,θ]/.y2rule/.xrule/.drule//Expand;
Grn20=D[Grn10/.y1rule,θ]-Aroo*D[Grn,r]/.y2rule/.xrule/.drule//Expand;
Grn01=D[Grn,t2]/.xrule/.drule//Expand;
Grn02=D[Grn01,t2]/.xrule/.drule//Expand;
Grn11=D[Grn10,t2]/.xrule/.drule//Expand;
Grn12=D[Grn11,t2]/.xrule/.drule//Expand;
Grn21=D[Grn20,t2]/.xrule/.drule//Expand;
Grn22=D[Grn21,t2]/.xrule/.drule//Expand;

(*Derivatives*)
For[i=-8,i≤ord,i++,
For[j=0,j≤4,j++,
(Subscript[G10, i,j])=Coefficient[Coefficient[Grn10,κ,j],ϵ,i]*κ^j*ϵ^i//Expand;
(Subscript[G20, i,j])=Coefficient[Coefficient[Grn20,κ,j],ϵ,i]*κ^j*ϵ^i//Expand;
(Subscript[G01, i,j])=Coefficient[Coefficient[Grn01,κ,j],ϵ,i]*κ^j*ϵ^i//Expand;
(Subscript[G02, i,j])=Coefficient[Coefficient[Grn02,κ,j],ϵ,i]*κ^j*ϵ^i//Expand;
(Subscript[G11, i,j])=Coefficient[Coefficient[Grn11,κ,j],ϵ,i]*κ^j*ϵ^i//Expand;
(Subscript[G12, i,j])=Coefficient[Coefficient[Grn12,κ,j],ϵ,i]*κ^j*ϵ^i//Expand;
(Subscript[G21, i,j])=Coefficient[Coefficient[Grn21,κ,j],ϵ,i]*κ^j*ϵ^i//Expand;
(Subscript[G22, i,j])=Coefficient[Coefficient[Grn22,κ,j],ϵ,i]*κ^j*ϵ^i//Expand;
];
];

(Subscript[G10, -2,0])

D[1/(x[t/ϵ,t2/ϵ,r/ϵ,r2/ϵ,η]*ϵ^2),t]/.xrule/.drule

For[i=-4,i≤ord-2,i++,
For[j=0,j≤4,j++,
(Subscript[Gsq, i,j])=Mp[G,G,i,j];
];
];

bGrn=Series[box[Grn]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;
bpGrn=Series[box2[Grn]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;

bbpGrn=Series[box[bpGrn]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-4}]/.dnrule//Normal//Expand;

For[i=-8,i≤ord-2,i++,
For[j=0,j≤4,j++,
(Subscript[bG, i,j])=Coefficient[Coefficient[bGrn,κ,j],ϵ,i]*κ^j*ϵ^i//Expand;
(Subscript[bpG, i,j])=Coefficient[Coefficient[bpGrn,κ,j],ϵ,i]*κ^j*ϵ^i//Expand;
(Subscript[bbpG, i,j])=Coefficient[Coefficient[bbpGrn,κ,j],ϵ,i]*κ^j*ϵ^i//Expand;
];
];

N4k4=Table[0,{i,10}]

Gsqk4=Sum[(Subscript[Gsq, i,4]),{i,-8,0}];
N4k4[[1]]=Series[1/2*box[box2[Gsqk4]/.xrule/.drule]/.xrule/.drule/.uprule,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N4k4[[2]]=3*Sum[(Subscript[bG, i,j])*(Subscript[bpG, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N4k4[[3]]=3*Sum[(Subscript[G, i,j])*(Subscript[bbpG, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N4k4[[4]]=Series[-6*Sum[dAdB2[(Subscript[bG, i,j]),(Subscript[G, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N4k4[[5]]=Series[-6*Sum[dAdB[(Subscript[bpG, i,j]),(Subscript[G, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N4k4[[6]]=Series[R[r]*Sum[dAdB2[(Subscript[G, i,j]),(Subscript[G, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N4k4[[7]]=Series[R[r2]*Sum[dAdB[(Subscript[G, i,j]),(Subscript[G, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N4k4[[8]]=-2*R[r]*Sum[(Subscript[G, i,j])*(Subscript[bpG, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N4k4[[9]]=-2*R[r2]*Sum[(Subscript[G, i,j])*(Subscript[bG, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N4k4[[10]]=Series[1/2*R[r]*R[r2]*Gsqk4/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand//Simplify

N2k4=Table[0,{i,11}]
N2pk4=Table[0,{i,11}]

Roo=2*(3*M^2 - 2*M*r)/((2*M - r)*r)
Rptt=0

N2k4[[1]]=Series[-8*Sum[dAdB2[(Subscript[G10, i,j]),(Subscript[G10, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[1]]=Series[-8*Sum[dAdB[(Subscript[G01, i,j]),(Subscript[G01, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]
/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[2]]=Series[8*Sum[(Subscript[G10, i,j])*box2[(Subscript[G10, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[2]]=Series[8*Sum[(Subscript[G01, i,j])*box[(Subscript[G01, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[3]]=Series[8*Sum[(Subscript[G10, i,j])*box2[(Subscript[G10, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]
/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[3]]=Series[8*Sum[(Subscript[G01, i,j])*box[(Subscript[G01, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]
/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[4]]=Series[4*Sum[dAdB2[(Subscript[G, i,j]),(Subscript[G20, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]
/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[4]]=Series[4*Sum[dAdB[(Subscript[G, i,j]),(Subscript[G02, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]
/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[5]]=Series[-4*Sum[box2[(Subscript[G, i,j])]*(Subscript[G20, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-6,-2}]
/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[5]]=Series[-4*Sum[box[(Subscript[G, i,j])]*(Subscript[G02, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-6,-2}]
/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[6]]=Series[-4*Sum[(Subscript[G, i,j])*box2[(Subscript[G20, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]
/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[6]]=Series[-4*Sum[(Subscript[G, i,j])*box[(Subscript[G02, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]
/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[7]]=-4*R[r2]*Sum[(Subscript[G10, i,j])*(Subscript[G10, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N2pk4[[7]]=-4*R[r]*Sum[(Subscript[G01, i,j])*(Subscript[G01, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N2k4[[8]]=2*R[r2]*Sum[(Subscript[G, i,j])*(Subscript[G20, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N2pk4[[8]]=2*R[r]*Sum[(Subscript[G, i,j])*(Subscript[G02, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N2k4[[9]]=Series[-2*Roo*Sum[dAdB2[(Subscript[G, i,j]),(Subscript[G, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]
/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[9]]=Series[-2*Rptt*Sum[dAdB[(Subscript[G, i,j]),(Subscript[G, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]
/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[10]]=Series[-2*Roo*Sum[(Subscript[G, i,j])*box2[(Subscript[G, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]
/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[10]]=Series[-2*Rptt*Sum[(Subscript[G, i,j])*box[(Subscript[G, k-i,4-j])],{i,-8,ord},{j,0,4},{k,-6,-2}]
/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[11]]=-R[r2]*Roo*Gsqk4//Expand

N2pk4[[11]]=-R[r]*Rptt*Gsqk4//Expand

N0k4=Table[0,{i,13}]

N0k4[[1]]=4*Sum[(Subscript[G11, i,j])*(Subscript[G11, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N0k4[[2]]=4*Sum[(Subscript[G11, i,j])*(Subscript[G11, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand//Expand

N0k4[[3]]=4*Sum[(Subscript[G20, i,j])*(Subscript[G02, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N0k4[[4]]=Sum[(Subscript[G, i,j])*(Subscript[G22, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N0k4[[5]]=Sum[-2*(Subscript[G10, i,j])*(Subscript[G12, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N0k4[[6]]=Sum[-2*(Subscript[G10, i,j])*(Subscript[G12, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N0k4[[7]]=Sum[-2*(Subscript[G01, i,j])*(Subscript[G21, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N0k4[[8]]=Sum[-2*(Subscript[G01, i,j])*(Subscript[G21, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N0k4[[9]]=2*Rptt*Sum[(Subscript[G10, i,j])*(Subscript[G10, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N0k4[[10]]=2*Roo*Sum[(Subscript[G01, i,j])*(Subscript[G01, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N0k4[[11]]=-Rptt*Sum[(Subscript[G20, i,j])*(Subscript[G, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N0k4[[12]]=-Roo*Sum[(Subscript[G02, i,j])*(Subscript[G, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

N0k4[[13]]=Rptt*Roo*Sum[(Subscript[G, i,j])*(Subscript[G, k-i,4-j]),{i,-8,ord},{j,0,4},{k,-8,-4}]//Expand

aprule={dr[r/ϵ-r2/ϵ]->dr[r/ϵ],dt[t/ϵ-t2/ϵ]->dt[t/ϵ],dt[(t-t2)/ϵ]->dt[t/ϵ],x[t/ϵ,t2/ϵ,r/ϵ,r2/ϵ,η]->x[t/ϵ,r/ϵ,η]}
r2rule={r2->r-ϵ*dr[r/ϵ]}
up2rule={dr[r/ϵ]->dr[r],dt[t/ϵ]->dt[t],x[t/ϵ,r/ϵ,η]->x[t,r,η]}
dn2rule={dr[r]->dr[r/ϵ],dt[t]->dt[t/ϵ],x[t,r,η]->x[t/ϵ,r/ϵ,η]}

b[r_]:=1-2*M/r;

Clear[i]
goo=r^2/b[r];
gptt=-1;
NKoottK4=Sum[N0k4[[i]]/72,{i,1,8}]+gptt*Sum[N2k4[[i]]/288,{i,1,8}]+goo*Sum[N2pk4[[i]]/288,{i,1,8}]+goo*gptt*Sum[N4k4[[i]]/288,{i,1,10}]/.aprule/.r2rule/.up2rule/.uprule//Expand

Series[NKoottK4,{ϵ,0,ord-6}]//Normal//Expand//Simplify

%/.erule//Simplify

x2rule={x[t,r,η]->σ2[t,r,η]/.erule}

NkoottK4den=(414720 (π^4) (((-2 M+r))^6) ((x[t,r,η])^5))

NkoottK4num=((r^3) (κ^4) (3 (((-2 M+r))^2) ((dt[t])^4) (-8 (r^2) ((dr[r])^2)+(2 M-r) (-16 (r^3) η+21 (2 M-r) x[t,r,η]))+3 ((dt[t])^2) (8 (r^4) ((dr[r])^4)-(2 M-r) (r^2) ((dr[r])^2) (-8 (r^3) (4 η+((Derivative[1,0][Y][θ,ϕ])^2))+(2 M-r) x[t,r,η] (27+2 Derivative[2,0][Y][θ,ϕ]))+(((-2 M+r))^2) (16 (r^6) η (2 η+((Derivative[1,0][Y][θ,ϕ])^2))+6 (((-2 M+r))^2) ((x[t,r,η])^2) (5+Derivative[2,0][Y][θ,ϕ])-(2 M-r) (r^3) x[t,r,η] (54 η+21 ((Derivative[1,0][Y][θ,ϕ])^2)+4 η Derivative[2,0][Y][θ,ϕ])))-x[t,r,η] (18 (r^4) ((dr[r])^4)-(2 M-r) (r^2) ((dr[r])^2) (-9 (r^3) (8 η+3 ((Derivative[1,0][Y][θ,ϕ])^2))+(2 M-r) x[t,r,η] (32+3 Derivative[2,0][Y][θ,ϕ]))+(((-2 M+r))^2) (18 (r^6) η (4 η+3 ((Derivative[1,0][Y][θ,ϕ])^2))+3 (((-2 M+r))^2) ((x[t,r,η])^2) (2+3 Derivative[2,0][Y][θ,ϕ])-(2 M-r) (r^3) x[t,r,η] (64 η+33 ((Derivative[1,0][Y][θ,ϕ])^2)+6 η Derivative[2,0][Y][θ,ϕ])))))/.x2rule//Simplify

NKoottK4simp=NkoottK4num/NkoottK4den//Simplify

brule={M->(1-b)*r/2};

NKoottK4simp/.brule//Simplify