How do I calculate the Kretschmann scalar $K=R_{abcd}R^{abcd}$ with xTensor and xCoba? I have found the functions Kretschmann and KretschmannCD, but I do not understand how to use them

  • $\begingroup$ What do you exactly mean how to use it? You normally need to have a background metric and you then would be able to calculate the Kretschmann scalar for it. $\endgroup$
    – Wiliam
    Nov 27, 2019 at 10:01
  • $\begingroup$ @William I have defined the metric and the various tensors associated, but I do not understand how to calculate the Kretschmann scalar, which is the sintax to define it. $\endgroup$
    – mattiav27
    Nov 27, 2019 at 10:08
  • $\begingroup$ mathematica.stackexchange.com/questions/69423/… follow this and you can calculate the scalar after defining the metric and other appropriate variables. $\endgroup$
    – Wiliam
    Nov 27, 2019 at 10:14
  • $\begingroup$ @mattiav27 you can also compute the Kretschmann scalar by writing your own routine if you are interested and you won't have to deal with packages. $\endgroup$
    – user49048
    Jan 27, 2020 at 14:48

1 Answer 1


Step 1. Open the xCoba package:

<< xAct`xCoba`

Step 2. Define some characteristics related to the manifold:

DefManifold[M4, 4, IndexRange[a, q]]
DefMetric[-1, metric[-a, -b], CD, PrintAs -> "g"]
DefChart[S, M4, {0, 1, 2, 3}, {t[], r[], \[Theta][], \[Phi][]}]

Step 3. Define the metric (Kerr-Newmann in this case):

Step 3.1. Constants and auxiliary functions


\[Rho] = (r[]^2 + L^2 Cos[\[Theta][]]^2)
\[CapitalDelta] = (r[]^2 - 2 M r[] + L^2 + Q^2)
\[CapitalSigma] = ((r[]^2 + L^2)^2 - \[CapitalDelta] L^2 Sin[\[Theta][]]^2)

Step 3.2. The Metric

MatrixForm[metricarray = {{(\[CapitalDelta] - L^2 Sin[\[Theta][]]^2)/\[Rho], 0, 0, (L Sin[\[Theta][]]^2)/\[Rho] (2 M r[] - Q^2)}, {0, -(\[Rho]/\[CapitalDelta]), 0, 0}, {0, 0, -\[Rho], 0}, {(L Sin[\[Theta][]]^2)/\[Rho] (2 M r[] - Q^2), 0, 0, -(Sin[\[Theta][]]^2/\[Rho]) \[CapitalSigma]}}]  
MetricInBasis[metric, -S, metricarray] // MatrixForm

Step 4. Compute the Kretschmann Scalar:

MetricCompute[metric, S, "Kretschmann"[], CVSimplify -> Simplify]
KretschmannCD[] // ToValues // FullSimplify

If you have any doubt about the commands used, just type, for instance, "? DefManifold" after the Step 1 that the Wolfram Mathematica will explain.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.