Print["Definitions:"]
CS=L*(L+hd)
CS2=CS-(hd+1)
Ms=CS CS2 (hd^2)-2 hd (1+hd) CS2 (r^2) (ω^2)+(((1+hd))^2) (r^4) (ω^4)
α=L+hd/2
Print["Bessel functions to next-to-next-to-leading-order"]
besselj[x_]=Simplify[1-((x^2)/(2*(2α+2)))+((x^4)/(4*2*(2α+2)(2α+4)))]
BesselAssump={j''[x]->FullSimplify[-(((2 α+1)/x)j'[x]+j[x])]}
BesselSub={j[ω r]->besselj[ω r],j'[ω r]->besselj'[ω r]}

Print["Ttt:"]
(Subscript[Ttt, Lω])=(1/(Nld*Omd))∫ (Subscript[N, L])[Om](Subscript[Ttt, ω])[r]\[DifferentialD]Om;
(Subscript[J, SLω])=(Subscript[Ttt, Lω]);
pref=((Nld*Omd (hd+1)(r^(L+hd+3)))/(2 CS));
(Subscript[𝒯, SLω])=Simplify[pref((hd/r)(∂_r)(Subscript[J, SLω])+(ω^2)(Subscript[J, SLω])-((hd(CS-2(hd+1)))/((hd+1)(r^2)))(Subscript[J, SLω]))];
(Subscript[IntegrandQ, SLω])=(Subscript[𝒯, SLω])j[ω r];
FullDerivate=FullSimplify[(∂_r)(pref*(hd/r)* j[ω r] (Subscript[J, SLω]))];
(Subscript[Integrand2Q, SLω])=FullSimplify[(Subscript[IntegrandQ, SLω])-FullDerivate]
(Subscript[Qtt, SLω])=FullSimplify[(Subscript[Integrand2Q, SLω])/.BesselSub]

QLO=Simplify[(Subscript[Qtt, SLω])/.{ω->0}];
QNLO=(ω^2)*Simplify[FullSimplify[(((Subscript[Qtt, SLω])-QLO)/(ω^2))/.{(Subscript[Ttt, ω])[r]->(Subscript[Ttt, 0])[r]}]/.{ω->0}];
QNNLO=(ω^4)*Simplify[FullSimplify[(((Subscript[Qtt, SLω])-QLO-QNLO)/(ω^4))/.{(Subscript[Ttt, ω])[r]->(Subscript[Ttt, 0])[r]}]/.{ω->0}];
CommonFactor=(r^(1+hd+L)) (∫(Subscript[N, L])[Om]\[DifferentialD]Om) (Subscript[Ttt, 0])[r];
LOFactor=QLO/CommonFactor
NLOFactor=QNLO/((ω^2)(r^2)CommonFactor)
NNLOFactor=QNNLO/((ω^4)(r^4)CommonFactor)
LOFactor4d=Simplify[QLO/CommonFactor/.{hd->1}]
NLOFactor4d=Simplify[QNLO/((ω^2)(r^2)CommonFactor)/.{hd->1}]
NNLOFactor4d=Simplify[QNNLO/((ω^4)(r^4)CommonFactor)/.{hd->1}]

Print["Original 4d paper:"]
D4Q=(1/((L+1)(L+2)))(r^(2+L)) (∫(Subscript[N, L])[Om]\[DifferentialD]Om) (Subscript[Ttt, 0])[r]((r^(-L))D[(r^(L+2))besselj[ω r],{r,2}]+(ω^2) (r^2)besselj[ω r]);
D4QLO=Simplify[D4Q/.{ω->0}];
D4QNLO=(ω^2)*Simplify[FullSimplify[((D4Q-D4QLO)/(ω^2))/.{(Subscript[Ttt, ω])[r]->(Subscript[Ttt, 0])[r]}]/.{ω->0}];
D4QNNLO=(ω^4)*Simplify[FullSimplify[((D4Q-D4QLO-D4QNLO)/(ω^4))/.{(Subscript[Ttt, ω])[r]->(Subscript[Ttt, 0])[r]}]/.{ω->0}];
D4LOFactor=D4QLO/Simplify[CommonFactor/.{hd->1}]
D4NLOFactor=D4QNLO/((ω^2)(r^2)Simplify[CommonFactor/.{hd->1}])
D4NNLOFactor=D4QNNLO/((ω^4)(r^4)Simplify[CommonFactor/.{hd->1}])
FullSimplify[D4LOFactor/LOFactor4d]
FullSimplify[D4LOFactor/LOFactor4d]
FullSimplify[D4LOFactor/LOFactor4d]