# xAct working with an unspecified function

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:

<< xActxCore
<< xActxTensor
<< xActxCoba
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?

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

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