I do not understand why the output of the two commands:

metric[-c, -d] (CD[d][RicciScalar[CD][]]) (CD[c][RicciScalar[CD][]]) // Simplify,

(CD[-c][RicciScalar[CD][]]) (CD[c][RicciScalar[CD][]]) // Simplify,

is different. The first one outputs a scalar function, as expected, whereas the second gives an expression

enter image description here

that I do not know how to contract.

  • 1
    $\begingroup$ Can you provide a minimal version of your code that reproduces the error when run on a "clean" kernel? It may help in tracking down the problem. $\endgroup$ Oct 8, 2021 at 19:47

1 Answer 1


You have a product of a Basis[-c, {1, B}], for some basis B, and a CTensor[comps, {B}][c] object.

You can use ContractBasis to force the contraction of a Basis[...] object with anything.

Or you can use FromBasisExpand to convert a Basis[...] object into a CTensor object, and the two CTensor objects will then be automatically contracted.


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.