Accessing the elements of a tensor

309 views
Skip to first unread message

Ruben Campos Delgado

unread,
Dec 9, 2021, 8:10:41 AM12/9/21
to xAct Tensor Computer Algebra
Hello,

I have defined a metric using  g = CTensor[....]
From that I can compute everything using MetricCompute[g, B, All]. For example, the Ricci Tensor is Ricci[CD][-a, -b].
How do I access the element of this tensors? For example, let us suppose I want the 12 component of the Ricci tensor. What do I have to write?
I tried Ricci[CD][-1,-2]  and Part[Ricci,1,2] but they do not work.

Thank you
R.C

Jose

unread,
Dec 9, 2021, 1:55:05 PM12/9/21
to xAct Tensor Computer Algebra
Hi,

To extract components of a tensor you need to specify the bases in which you want those components. If ctensor is a CTensor[...] object and B is a basis (defined with DefBasis or DefChart) then you need to use the notation

    ctensor[{0, -B}, {2, -B}]   for the 02 covariant component of ctensor
    ctensor[{0, B}, {2, B}]     for the 02 contravariant component of ctensor
    ctensor[{0, B}, {2, -B}]    for the mixed component

Note that the sign is in the basis, not in the number. This is done so that one can use 0 or even -1, -2 , ... (as we use them with spherical harmonics, say) for component elements.

Note also that CTensor can perform automatically changes of bases if the information of how to perform those changes has been provided. This means that the basis B used above does not have to be the basis used internally to store the components. Similarly, you can extract covariant components from a tensor having internally stored contravariant components if a metric has been declared, with SetCMetric. Finally, bases of different indices can be different, either different bases of the same bundle or even of different bundles.

Cheers,
Jose.
Reply all
Reply to author
Forward
0 new messages