2
$\begingroup$

Using xAct package in Mathematica, I am trying to obtain expansions of Ricci scalar upto second order in metric perturbations. Although I am able to obtain the perturbed expressions, Mathematica/xAct does not seem to simplify some tensor expressions. For example, there are terms like:

    p2[a, -a] p2[b, -b] - (p2[a, -a])^2

where p2[a,b] is a second rank tensor. I would like such expressions to be automatically simplified; in the above case, expected result is 0. However, when I use the command //Simplification, I get the same expression. For instance, this is what I get for the above expression:

    In[42]:= p2[a, -a] * p2[b, -b] - (p2[a, -a])^2 // Simplification

    Out[42]= p2[a, -a]   p2[b, -b] - xAct`xTensor`Scalar[p2[a, -a]]^2

Why is xAct/Mathematica not recognizing the two terms as equal?

What is xActxTensorScalar[] object?

A prescription to simplify such expressions in general would be appreciated.

$\endgroup$
3
  • $\begingroup$ I'm not familiar with the xact notation, but are you sure the first term is contracted and the second one is not implicitly multiplyied by the identity tensor. So it could be a non zero tensor of second order. $\endgroup$
    – Gluoncito
    Jul 11, 2018 at 15:28
  • $\begingroup$ Welcome! To make the most of Mma.SE start by taking the tour now. It will help us to help you if you write an excellent question. Edit your question each time you find it can be improved to show due diligence, give more context. As you receive give back, vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. $\endgroup$
    – rhermans
    Jul 11, 2018 at 16:00
  • $\begingroup$ @Gluoncito I am not an expert in xAct, but from what I understand it does take care of contractions of repeated indices. Using the command //ScalarQ returns True , implying that this expression is a scalar. $\endgroup$
    – walker786
    Jul 11, 2018 at 17:06

1 Answer 1

2
$\begingroup$

An expression like p[a, -a]^2 is strictly incorrect in xTensor, because in WL this is p[a, -a]*p[a, -a], which has repeated indices. The way to avoid this problem is to hide internal scalar indices inside the Scalar head. That is, the expression Scalar[p[a, -a]]^2 is the correct way to express that object in xTensor.

Your Simplification call finds an improper expression and tries to fix it by returning an unambiguous expression (this doesn't always work, because ambiguous input may be incorrectly interpreted sometimes). Use then the command NoScalar, which will rename indices to avoid collisions, and finally use Simplification or ToCanonical again. You'll get the expected zero output.

Alternative, the command PutScalar (internally used by Simplification) adds the Scalar heads, and then you can call Simplification:

In[7]:= p[a, -a] p[b, -b] - p[a, -a]^2 // PutScalar // Simplification
Out[7]= 0
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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