Moving between XTensor and CTensor

146 views
Skip to first unread message

Rhiannon Gwyn

unread,
May 6, 2015, 9:54:51 AM5/6/15
to xa...@googlegroups.com
Hi,

I wonder if anyone can help. I am trying to evaluate variations with respect to the metric for specific metrics. I can calculate them in general using XTensor and VarL:

VarL[metric[-a, -b], cd][Expression]

but once I specify a metric using CTensor I can't use VarL anymore. So that's fine, I can copy across the expressions I get, like

-Riccicd[a, b] + (metric[a, b]*RicciScalarcd[])/2

But this is not the right form for CTensor calculations, I need to change things as in
CTensorconvert = {Riccicd -> Ricci[cd],
  RicciScalarcd[] -> RicciScalar[cd][], Riccicd -> Ricci[cd]}

But while this seems to work sometimes, for things that require contraction of indices I get nonsense, even though the answer is simple if I simply rewrite them by hand:

 metric[a, c]   metric[b, d]   Riccicd[-c, -d]  RicciScalarcd[]^3 /. CTensorconvert

does not give the expected

metric[a, c]metric[b, d]Ricci[cd][-c, -d] RicciScalar[cd][]^3

I must be doing something wrong - can anyone help? Alternatively is there a way to use VarL with CTensor?

Many thanks

Rhiannon


Jose

unread,
May 6, 2015, 10:37:17 AM5/6/15
to xa...@googlegroups.com
Hi,

Could you post code for a complete example that gives a wrong result using the CTensorconvert rules?

I don't expect VarL or VarD to give correct results once you are using CTensor expressions, but replacing abstract tensors with CTensor objects using rules should work.

Cheers,
Jose.

Rhiannon Gwyn

unread,
May 6, 2015, 12:51:10 PM5/6/15
to xa...@googlegroups.com
Hi

Here is a shortened file... The example at the end (and more complicated expressions) doesn't work as expected, presumably because I need to tell it to contract the indices.

Thanks!

Rhiannon
exampleCTensorXTensor.nb

Leo Stein

unread,
May 6, 2015, 1:59:46 PM5/6/15
to Rhiannon Gwyn, xAct Tensor Computer Algebra
Hi Rhiannon,

I have edited your notebook a bit. I hope the edits explain everything that's going on.

Best,
Leo

--
You received this message because you are subscribed to the Google Groups "xAct Tensor Computer Algebra" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xact+uns...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

exampleCTensorXTensor.nb

Leo Stein

unread,
May 6, 2015, 2:01:54 PM5/6/15
to Rhiannon Gwyn, xAct Tensor Computer Algebra
Oops, I sent the previous version of the file a bit prematurely. Hope you can spot the difference :)

Leo
exampleCTensorXTensor.nb

Rhiannon Gwyn

unread,
May 6, 2015, 2:55:34 PM5/6/15
to xa...@googlegroups.com
Hi Leo,

Thanks, that is very helpful! I'm aware I was writing the metric initially without using tensors - that is because for the metrics I am actually interested in, writing things like

met = CTensor[   DiagonalMatrix[{-1 + 2 mass/r[], 1/(1 - 2 mass/r[]), r[]^2,  r[]^2 Sin[\[Theta][]]^2}], {-ch, -ch}];

for a metric which is not necessarily diagonal, was not very user friendly. The example in the file was just a simple example using older code.

But the redefinitions work perfectly. It makes sense that it's the order of evaluation that was the problem. Thanks!

Rhiannon
Reply all
Reply to author
Forward
0 new messages