I am trying to use TensoriaCalc to calculate the components of the Ricci and the Riemann tensor of the following metric: $R^{2} \left(d\theta^{2} + \sin^{2}\left(\theta \right)d\phi^{2} \right)$;

According to the web guide, I should use this code:

Clear[i, j, R, \[Theta], g];
g["2Sphere"] = Metric[
  SubMinus[i], SubMinus[j],
  R^2 ({{1, 0},{0, Sin[\[Theta]]^2}}),
  CoordinateSystem -> {\[Theta], \[Phi]},
  TensorName -> "h",
  StartIndex -> 1,
   ChristoffelOperator -> FullSimplify,
   RiemannOperator -> FullSimplify,
   RicciOperator -> FullSimplify,
  RicciScalarOperator -> FullSimplify

and the output should be:

enter image description here

However, using the same code in my notebook, in Mathematica version 12.3, I have the following output:

enter image description here

which is not the result I was expecting.

Does anyone have any idea why this happens?

  • 1
    $\begingroup$ I am not familiar with the package, but why don't you calculate these things in Mathematica without a package? I am asking just out of curiosity $\endgroup$
    – bmf
    Feb 5, 2023 at 1:12
  • $\begingroup$ Using the package would take less effort to compute it. However, if I can't solve this problem I may have to calculate it without a package. $\endgroup$
    – RKerr
    Feb 5, 2023 at 13:48
  • 1
    $\begingroup$ I have explained in in this answer how you can do this kind of computations without any packages. It is done for an $\text{AdS}_5$ spacetime, but you should be able to easily adjust to the case of $\text{S}^2$. I have added as many explanatory comments, as possible. If you want you can have a look. If you are having difficulties adjusting to your metric, let me know and I can help. $\endgroup$
    – bmf
    Feb 5, 2023 at 13:54

1 Answer 1


I'm one of the developers of this package. I'm glad to answer your question. When we develop the package, we set the Format of Metric, so that the output is shown like your Out[3] result. When you hover your mouse on h_ij, you can directly see the TensorComponent of the Metric. Using the function TensorComponent will also help extract it. Also, if you want to get what you expected instead of the formatted result, operate FullForm on your Metric. If you want to extract the other geometrical objects, try to use Functions: Christoffel, Riemann, Ricci, Einstein, and so on.


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.