# Kretschmann scalar in xTensor and xCoba

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

• 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. Nov 27, 2019 at 10:01
• @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. Nov 27, 2019 at 10:08
• mathematica.stackexchange.com/questions/69423/… follow this and you can calculate the scalar after defining the metric and other appropriate variables. Nov 27, 2019 at 10:14
• @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.
– kcr
Jan 27, 2020 at 14:48

Step 1. Open the xCoba package:

<< xActxCoba


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

DefConstantSymbol[M]
DefConstantSymbol[Q]
DefConstantSymbol[L]

\[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.