I am trying to use xCoba with a diagonal metric depending on an unspecified function f[r], but I get the errors:

CTensor::unknown: Unknown expression f[r].

CTensor::unknown: Unknown expression f[r].

ManifoldOfChart::unknown: "Unknown !(\"chart\")Null.

" Throw::nocatch: "Uncaught Throw[Null] returned to top level."

This is my workflow:

<< xAct`xCore`
<< xAct`xTensor`
<< xAct`xCoba`
DefManifold[M4, 4, {a, b, c, d, e, f, i, l}]
DefBasis[red, TangentM4, {0, 1, 2, 3}, BasisColor -> Red]
DefChart[ch, M4, {0, 1, 2, 3}, {t[], r[], \[Theta][], \[Phi][]}, ChartColor -> Brown]
met = CTensor[
  DiagonalMatrix[{-f[r[]], 1/f[r[]], r[]^2, r[]^2*Sin[\[Theta]]^2}], {-ch, -ch}]
SetCMetric[met, ch, SignatureOfMetric -> {3, 1, 0}]

How can I work with an unspecified function? Is it even possible?


In case someone needs it in the future I answer my question.

To work with a non defined function f one has to include the line:


If, like in my case, the function depends only on r, one has to write f[r[]] in the rest of the program

  • $\begingroup$ Indeed. In xAct you need to declare all relevant objects, so that the system knows the tensorial properties of everything. In this case you need to declare f as a scalar function, meaning that it is a scalar and that its arguments must also be all scalars. Then r is the name of the scalar field r[], in the same way that T is the name of the tensor field T[i, -j], say. Both need the brackets to be recognized by xAct as tensorial quantities. $\endgroup$ – jose Feb 21 '20 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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