This OCaml code computes the Kerr−Newman metric as given here.
code idWiki idmeaning
bSI3 physical constants in SI units
guSame units geometrized
ccspeed of light
bGGgravitational constant
ke1/4πε0c4Coulomb’s constant
bMMMass of BH
bQQcharge on BH
bJJangular momentum
dtau2τ is proper time, measured locally.
dtau2 is a function of coordinates and differential vector.
rsrsSchwarzschild radius
rQ2rQ2a squared measure of the charge.
aαcommon subexpression
rrSchwarzschild radius, the r coordinate.
thθLatitude = (90−180*θ/π)°, a coordinate
dtdtdelta t where t is the coordinate time.
drdrdelta r
dthdelta θ
dpdelta longitude. Longitude = 180*φ/π.
rh2ρ2common subexpression
delΔcommon subexpression
t, r, φ and θ are the coördinates.
θ is actually 0 and π at the poles and π/2 at the equator. It determines the latitude.

Three physical constants play a role here, c, bG and ke. These constants can be expressed in either SI units of geometrized units.

Three constants describe the particular black hole: M, Q and J.

The function dtau2 is of the relevant coordinates, r and th, and the differential vector, (dt, dr, dth, dp), separating the two events whose distance the metric defines.

Cartesian Coordinates

This to compute r2 from x, y, z and a.

The plan:

Elephant

The Elephant in the room is whether these solutions satisfy Einstein’s equations.
start? Start!