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,η]}
dnrule={dr[r-r2]->dr[r/ϵ-r2/ϵ],dt[t-t2]->dt[t/ϵ-t2/ϵ],x[t,t2,r,r2,η]->x[t/ϵ,t2/ϵ,r/ϵ,r2/ϵ,η]}

Clear[i];
Us=Table[0,{i,Dim}];
For[i=1,i≤Dim,i++,
Us[[i]]=Series[Exp[lDel[t,r,η][[i]]/.uprule],{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A,{η,2}]/ϵ^4;

box2[A_]:=-1/h[r2]*D[A,{t2,2}]+1/(2*h[r2]*p[r2]^2)*D[q[r2],r2]*D[A,r2]+1/f[r2]*D[A,{r2,2}]-2*(η*ϵ^2+1)/p[r2]*D[A,η]/ϵ^2-(2η*ϵ^2+(η*ϵ^2)^2)/p[r2]*D[A,{η,2}]/ϵ^4;

dAdB[A_,B_]:=-1/h[r]*D[A,t]*D[B,t]+1/f[r]*D[A,r]*D[B,r]-(2*η*ϵ^2+η^2*ϵ^4)/p[r]*D[A,η]*D[B,η]/ϵ^4;

dAdB2[A_,B_]:=-1/h[r2]*D[A,t2]*D[B,t2]+1/f[r2]*D[A,r2]*D[B,r2]-(2*η*ϵ^2+η^2*ϵ^4)/p[r2]*D[A,η]*D[B,η]/ϵ^4;

u[t_,t2_,r_,r2_,η_]:=Series[U[t,r,η]/.prule,{ϵ,0,ord+2}]//Normal//Expand;

s[t_,t2_,r_,r2_,η_]:=x[t/ϵ,t2/ϵ,r/ϵ,r2/ϵ,η]*ϵ^2+σ3[t,r,η]/.prule;

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

G10k0=Series[D[G00k0,t]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-1}]/.dnrule//Normal//Expand;
G20k0=Series[D[G10k0,t]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;G01k0=Series[D[G00k0,t2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-1}]/.dnrule//Normal//Expand;
G02k0=Series[D[G01k0,t2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;G11k0=Series[D[G10k0,t2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;
G12k0=Series[D[G11k0,t2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-3}]/.dnrule//Normal//Expand;
G21k0=Series[D[G11k0,t]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-3}]/.dnrule//Normal//Expand;
G22k0=Series[D[G12k0,t]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-4}]/.dnrule//Normal//Expand;

G10k2=Series[D[G00k2,t]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-1}]/.dnrule//Normal//Expand;
G20k2=Series[D[G10k2,t]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;G01k2=Series[D[G00k2,t2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-1}]/.dnrule//Normal//Expand;
G02k2=Series[D[G01k2,t2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;G11k2=Series[D[G10k2,t2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;
G12k2=Series[D[G11k2,t2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-3}]/.dnrule//Normal//Expand;
G21k2=Series[D[G11k2,t]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-3}]/.dnrule//Normal//Expand;
G22k2=Series[D[G12k2,t]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-4}]/.dnrule//Normal//Expand;

G10k4=Series[D[G00k4,t]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-1}]/.dnrule//Normal//Expand;
G20k4=Series[D[G10k4,t]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;G01k4=Series[D[G00k4,t2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-1}]/.dnrule//Normal//Expand;
G02k4=Series[D[G01k4,t2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;G11k4=Series[D[G10k4,t2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;
G12k4=Series[D[G11k4,t2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-3}]/.dnrule//Normal//Expand;
G21k4=Series[D[G11k4,t]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-3}]/.dnrule//Normal//Expand;
G22k4=Series[D[G12k4,t]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-4}]/.dnrule//Normal//Expand;

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

Gsqk4=Series[G00k2^2+2*G00k0*G00k4/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;

bGk0=Series[box[G00k0]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;
bGk2=Series[box[G00k2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;
bGk4=Series[box[G00k4]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;
bpGk0=Series[box2[G00k0]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;
bpGk2=Series[box2[G00k2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;
bpGk4=Series[box2[G00k4]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-2}]/.dnrule//Normal//Expand;

bbpGk0=Series[box[bpGk0]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-4}]/.dnrule//Normal//Expand;
bbpGk2=Series[box[bpGk2]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-4}]/.dnrule//Normal//Expand;
bbpGk4=Series[box[bpGk4]/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-4}]/.dnrule//Normal//Expand;

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

N4k4[[1]]=Series[1/2*box[box2[Gsqk4]/.xrule/.drule]/.xrule/.drule/.uprule,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N4k4[[2]]=Series[3*(bGk0*bpGk4+bGk2*bpGk2+bGk4*bpGk0)/.xrule/.drule/.uprule,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N4k4[[3]]=Series[3*(G00k0*bbpGk4+G00k2*bbpGk2+G00k4*bbpGk0)/.xrule/.drule/.uprule,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N4k4[[4]]=Series[-6*(dAdB2[bGk0,G00k4]+dAdB2[bGk2,G00k2]+dAdB2[bGk4,G00k0])/.xrule/.drule/.uprule,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N4k4[[5]]=Series[-6*(dAdB[bpGk0,G00k4]+dAdB[bpGk2,G00k2]+dAdB[bpGk4,G00k0])/.xrule/.drule/.uprule,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N4k4[[6]]=Series[R[r]*(2*dAdB2[G00k0,G00k4]+dAdB2[G00k2,G00k2])/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N4k4[[7]]=Series[R[r2]*(2*dAdB[G00k0,G00k4]+dAdB[G00k2,G00k2])/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N4k4[[8]]=Series[-2*R[r]*(G00k0*bpGk4+G00k2*bpGk2+G00k4*bpGk0)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N4k4[[9]]=Series[-2*R[r2]*(G00k0*bGk4+G00k2*bGk2+G00k4*bGk0)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//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,8}]
N2pk4=Table[0,{i,8}]

N2k4[[1]]=Series[-8*(2*dAdB2[G10k0,G10k4]+dAdB2[G10k2,G10k2])/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[1]]=Series[-8*(2*dAdB[G01k0,G01k4]+dAdB[G01k2,G01k2])/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[2]]=Series[8*(G10k0*box2[G10k4]+G10k2*box2[G10k2]+G10k4*box2[G10k0])/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[2]]=Series[8*(G01k0*box[G01k4]+G01k2*box[G01k2]+G01k4*box[G01k0])/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[3]]=Series[8*(G10k0*box2[G10k4]+G10k2*box2[G10k2]+G10k4*box2[G10k0])/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[3]]=Series[8*(G01k0*box[G01k4]+G01k2*box[G01k2]+G01k4*box[G01k0])/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[4]]=Series[4*(dAdB2[G00k0,G20k4]+dAdB2[G00k2,G20k2]+dAdB2[G00k4,G20k0])/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[4]]=Series[4*(dAdB[G00k0,G02k4]+dAdB[G00k2,G02k2]+dAdB[G00k4,G02k0])/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[5]]=Series[-4*(box2[G00k0]*G20k4+box2[G00k2]*G20k2+box2[G00k4]*G20k0)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[5]]=Series[-4*(box[G00k0]*G02k4+box[G00k2]*G02k2+box[G00k4]*G02k0)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[6]]=Series[-4*(G00k0*box2[G20k4]+G00k2*box2[G20k2]+G00k4*box2[G20k0])/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[6]]=Series[-4*(G00k0*box[G02k4]+G00k2*box[G02k2]+G00k4*box[G02k0])/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[7]]=Series[-4*R[r2]*(2*G10k0*G10k4+G10k2^2)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[7]]=Series[-4*R[r]*(2*G01k0*G01k4+G01k2^2)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2k4[[8]]=Series[2*R[r2]*(G00k0*G20k4+G00k2*G20k2+G00k4*G20k0)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N2pk4[[8]]=Series[2*R[r]*(G00k0*G02k4+G00k2*G02k2+G00k4*G02k0)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

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

N0k4[[1]]=Series[4*(2*G11k0*G11k4+G11k2*G11k2)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N0k4[[2]]=Series[4*(2*G11k0*G11k4+G11k2*G11k2)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N0k4[[3]]=Series[(G20k0*G02k4+G20k2*G02k2+G20k4*G02k0)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N0k4[[4]]=Series[(G00k0*G22k4+G00k2*G22k2+G00k4*G22k0)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N0k4[[5]]=Series[-2*(G10k0*G12k4+G10k2*G12k2+G10k4*G12k0)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N0k4[[6]]=Series[-2*(G10k0*G12k4+G10k2*G12k2+G10k4*G12k0)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N0k4[[7]]=Series[-2*(G01k0*G21k4+G01k2*G21k2+G01k4*G21k0)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//Expand

N0k4[[8]]=Series[-2*(G01k0*G21k4+G01k2*G21k2+G01k4*G21k0)/.xrule/.drule/.uprule//Expand,{ϵ,0,ord-6}]/.dnrule//Normal//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]
NKttttK4=Sum[N0k4[[i]]/72,{i,1,8}]-Sum[N2k4[[i]]/288,{i,1,8}]-Sum[N2pk4[[i]]/288,{i,1,8}]+Sum[N4k4[[i]]/288,{i,1,10}]/.aprule/.r2rule/.up2rule//Expand

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

%/.erule//Simplify

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

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

NkttttK4num=((κ^4) (72 (((-2 M+r))^4) ((dt[t])^6)+36 (((-2 M+r))^2) ((dt[t])^4) (-2 (r^2) ((dr[r])^2)+(2 M-r) (-4 (r^3) η+(2 M-r) x[t,r,η]))+3 ((dt[t])^2) (8 (r^4) ((dr[r])^4)-2 (2 M-r) (r^2) ((dr[r])^2) (-16 (r^3) η+11 (2 M-r) x[t,r,η])+(((-2 M+r))^2) (32 (r^6) (η^2)+44 (r^3) (-2 M+r) η x[t,r,η]+3 (((-2 M+r))^2) ((x[t,r,η])^2)))+x[t,r,η] (-18 (r^4) ((dr[r])^4)+(2 M-r) (r^2) ((dr[r])^2) (-72 (r^3) η+29 (2 M-r) x[t,r,η])+2 (((-2 M+r))^2) (-36 (r^6) (η^2)+29 (2 M-r) (r^3) η x[t,r,η]+21 (((-2 M+r))^2) ((x[t,r,η])^2)))))/.x2rule//Simplify

NKttttK4simp=NkttttK4num/NkttttK4den//Simplify

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

NKttttK4simp/.brule//Simplify