Simplifing sum of equal contracted tensors with different dummy indexes

79 views
Skip to first unread message

apt45

unread,
Mar 23, 2018, 5:43:42 AM3/23/18
to xAct Tensor Computer Algebra
I use xTensor to perform some tensor calculations

    << xAct`xTensor`
    DefManifold[M4, 4, {a, b,c,d}]
    DefMetric[-1, g[-a, -b], CD, {"|", "\[Del]"}, FlatMetric -> True]
    DefTensor[p1[a], M4]

Then I want to consider and simplify the following expression
     
     p1[a] p1[-a] + p1[b] p1[-b] // Simplification

I get the following Output
    (*Output:  p1[a] p1[-a] + p1[b] p1[-b] *)

Instead ,I want to get this more simplified output

     2p1[a] p1[-a]

Why does `Simplification` not work as I want? Is there any other function to apply to my expressions??

Thanks


Thomas Bäckdahl

unread,
Mar 23, 2018, 5:52:08 AM3/23/18
to xa...@googlegroups.com

Hi!

When I try your example, I get the expected 2  p1[-a]   p1[a] .

Please restart and try to type in the example again. If the problem persists, please tell us more about your system and send a failed notebook, so we can see why this fails for you.

Regards
Thomas

--
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.

zhan-f...@outlook.com

unread,
Jul 14, 2018, 10:11:44 AM7/14/18
to xAct Tensor Computer Algebra


在 2018年3月23日星期五 UTC+8下午5:43:42,apt45写道:
Hello,or maybe you can use the order named "ReplaceDummies" 
for expample:
p1[-a]p1[a]+ReplaceDummies[p1[-b]p1[b]].
Hope my suggestion can help you!

Best regards
Zhan-feng Mai

Jose

unread,
Jul 16, 2018, 5:40:10 AM7/16/18
to xAct Tensor Computer Algebra
Hi,

I just wanted to say that the best solution in this case is to use ToCanonical or Simplification, applied to the whole expression. As Thomas said, both should work in original case in this thread.

The use of ReplaceDummies as recommended in the previous email is not appropriate, for three reasons:

- ReplaceDummies is used on one of the two terms only. This will just change the names of the dummies of that term, in general to names that do not coincide with the dummy names of the other terms of the sum.

- Even if used on the whole expression, ReplaceDummies does not try to use common dummy names for different terms. It is SameDummies that does such a thing. In fact, ToCanonical always uses SameDummies internally on a sum of terms. (Recall that Simplification is just a combination of ToCanonical and Simplify).

- ToCanonical (and hence Simplification) can move indices up and down with the metric, or use the symmetry groups of the tensors, while ReplaceDummies and SameDummies cannot.

So again, the recommendation is: use systematically Simplification (or ToCanonical for longer sums of terms in which Simplify may be slow). Use of SameDummies, ReplaceDummies and other internal tools should be exercised with care, only when operations must be guided step by step for some reason.

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