Implementing Field Equations in spherical symmetry

(*four spacetime dimensions*)ND=4;

(*g is covariant metric*)
(*Metric is allowed to be time-dependent*)

g={{-ff[t,r],0,0,0},
{0,1/gg[t,r],0,0},
{0,0,r^2,0},
{0,0,0,r^2*Sin[θ]^2}
};

(*A é a métrica contravariante*)
A=Inverse[g];

X={t,r,θ,phi};

(*Γ are the metric connections (Christoffel symbols) ,the first index is up, the next two are down*)Γ=Table[Sum[1/2A[[c,d]]*(D[g[[b,d]],X[[a]]]+D[g[[a,d]],X[[b]]]-D[g[[a,b]],X[[d]]]),{d,1,ND}],{c,1,ND},{a,1,ND},{b,1,ND}];

(*Riemann Tensor with all indices down:Rie[[a,b,c,d]]*)Rie=Table[Sum[g[[f,a]](D[Γ[[f,b,d]],X[[c]]]-D[Γ[[f,b,c]],X[[d]]]+Sum[Γ[[e,b,d]]Γ[[f,e,c]],{e,1,ND}]-Sum[Γ[[e,b,c]]Γ[[f,e,d]],{e,1,ND}]),{f,1,ND}],{a,1,ND},{b,1,ND},{c,1,ND},{d,1,ND}];

(*Covariant Ricci tensor (indices down):*)Riccit=Table[Sum[D[Γ[[a,b,d]],X[[a]]]-D[Γ[[a,b,a]],X[[d]]]+Sum[Γ[[e,b,d]]Γ[[a,e,a]],{e,1,ND}]-Sum[Γ[[e,b,a]]Γ[[a,e,d]],{e,1,ND}],{a,1,ND}],{b,1,ND},{d,1,ND}];

(*Ricci Scalar:*)Riccie=Sum[A[[a,b]]Riccit[[a,b]],{a,1,ND},{b,1,ND}];

Simplify[Riccit]

Einstein equations

(*Einstein's covariant tensor:*)G=Table[Riccit[[a,b]]-1/2*g[[a,b]]*Riccie,{a,1,ND},{b,1,ND}];

(*tr component says that gg is static*)Simplify[G[[1,2]]]

param={gg[t,r]->gg[r],Derivative[0,1][gg][t,r]->gg'[r],Derivative[1,0][gg][t,r]->0,Derivative[2,0][gg][t,r]->0,Derivative[1,1][gg][t,r]->0};

Gnew=Simplify[G/.param]

(*we can now solve explicitly for gg using the tt component*)DSolve[Gnew[[1,1]]==0,gg,r]

gg[r_]:=1+(C1/r);
Gnew2=FullSimplify[Gnew]

DSolve[Gnew2[[2,2]]==0,ff,{t,r}]

In other words, ff is also solvable, ff=(E^((-Log[r]+Log[C1+r]))) C2[t]=(1+C1/r)*C2[t], and C2[t] can be absorbed in a new time coordinate.

Field equations for Kerr - Newman black hole

(*four spacetime dimensions*)ND=4;
(*arbitrary choice of normalization, the BH mass is set to 1*)M=1;

(*g is covariant metric*)
(*Kerr-Newman is written in Boyer-Lindquist coordinates*)
rho2=r^2+ar^2*Cos[θ]^2;

Delta=r^2-2*M*r+ar^2+Q^2;

g={{-(1-(2*M*r-Q^2)/rho2),0,0,-ar*(2*M*r-Q^2)*Sin[θ]^2/rho2},
{0,rho2/Delta,0,0},
{0,0,rho2,0},
{-ar*(2*M*r-Q^2)*Sin[θ]^2/rho2,0,0,(r^2+ar^2+(2*M*r-Q^2)*ar^2*Sin[θ]^2/rho2)*Sin[θ]^2}
};

(*A é a métrica contravariante*)
A=Inverse[g];

X={t,r,θ,phi};

(*Γ are the metric connections (Christoffel symbols) ,the first index is up, the next two are down*)Γ=Table[Sum[1/2A[[c,d]]*(D[g[[b,d]],X[[a]]]+D[g[[a,d]],X[[b]]]-D[g[[a,b]],X[[d]]]),{d,1,ND}],{c,1,ND},{a,1,ND},{b,1,ND}];


(*Riemann Tensor with all indices down:Rie[[a,b,c,d]]*)Rie=Table[Sum[g[[f,a]](D[Γ[[f,b,d]],X[[c]]]-D[Γ[[f,b,c]],X[[d]]]+Sum[Γ[[e,b,d]]Γ[[f,e,c]],{e,1,ND}]-Sum[Γ[[e,b,c]]Γ[[f,e,d]],{e,1,ND}]),{f,1,ND}],{a,1,ND},{b,1,ND},{c,1,ND},{d,1,ND}];

(*Covariant Ricci tensor (indices down):*)Riccit=Table[Sum[D[Γ[[a,b,d]],X[[a]]]-D[Γ[[a,b,a]],X[[d]]]+Sum[Γ[[e,b,d]]Γ[[a,e,a]],{e,1,ND}]-Sum[Γ[[e,b,a]]Γ[[a,e,d]],{e,1,ND}],{a,1,ND}],{b,1,ND},{d,1,ND}];

(*Ricci Scalar:*)Riccie=Sum[A[[a,b]]Riccit[[a,b]],{a,1,ND},{b,1,ND}];

Simplify[Riccit]

Maxwell

AMax={-Q*r/rho2,0,0,Q*r*ar*Sin[θ]^2/rho2};

(*COVARIANT MAXWELL TENSOR:*)FMax=Table[D[AMax[[nu]],X[[mu]]]-D[AMax[[mu]],X[[nu]]],{mu,1,ND},{nu,1,ND}];

FMaxcont=Table[Sum[A[[a,b]]*A[[c,d]]*FMax[[b,d]],{b,1,ND},{d,1,ND}],{a,1,ND},{c,1,ND}];

(*MaxEq1 is the term (Subscript[∇, a])(F^ab):*)MaxEq1=Table[Sum[D[FMaxcont[[a,b]],X[[a]]],{a,1,ND}]+Sum[Γ[[a,d,a]]*FMaxcont[[d,b]]+Γ[[b,d,a]]*FMaxcont[[a,d]],{a,1,ND},{d,1,ND}],{b,1,ND}];

MaxEq=FullSimplify[MaxEq1]

Ftwo=FullSimplify[Sum[FMax[[mu,nu]]*FMaxcont[[mu,nu]],{mu,1,4},{nu,1,4}]]

Einstein equations

(*Einstein's covariant tensor:*)G=Table[Riccit[[a,b]]-1/2*g[[a,b]]*Riccie,{a,1,ND},{b,1,ND}];

Einst1=Table[1/2*Sum[FMax[[a,c]]*FMax[[b,de]]*A[[c,de]],{c,1,ND},{de,1,ND}]-g[[a,b]]/8*Sum[FMax[[c,de]]*FMax[[e,f]]*A[[e,c]]*A[[f,de]],{c,1,ND},{de,1,ND},{e,1,ND},{f,1,ND}],{a,1,ND},{b,1,ND}];

FieldSeries=Simplify[Einstot=G-4*(Einst1)]