How to eliminate redundant terms with free indices

23 views
Skip to first unread message

Sukruti

unread,
Sep 26, 2025, 9:51:46 AM (7 days ago) Sep 26
to xAct Tensor Computer Algebra
Hello,

Given a list of two or more terms each of which has all its indices free (no index contraction), how to eliminate the redundant terms?

Attached notebook illustrates this question.

Thanks in advance.

Best,
Sukruti
How to remove redundant terms.nb

Thomas Bäckdahl

unread,
Sep 26, 2025, 10:04:49 AM (7 days ago) Sep 26
to xa...@googlegroups.com

Hi!

Perhaps you can try something like this:
DeleteDuplicates[list1, And[Length@FindFreeIndices[#1] === Length@FindFreeIndices[#2], EqualExpressionsQ[#1, #2]] &]
or
DeleteDuplicates[list1, And[Length@FindFreeIndices[#1] === Length@FindFreeIndices[#2], First@xAct`SymManipulator`Private`SpecialEqualExpressionsQ[#1, #2]] &]

I don't know if this is exactly what you wanted though. I don't know why the first version is slow. 

"EqualExpressionsQ[expr1, expr2] returns True if there is a permutation of the free indices of expr1 such that its canonical form equals that of expr2, and False otherwise. "

The slightly modified version in SymManipulator does the same, but outputs more information about the change in free indices.

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.
To view this discussion visit https://groups.google.com/d/msgid/xact/9fcdcea7-4270-4bc0-826e-08941dd6f736n%40googlegroups.com.

Sukruti

unread,
Sep 26, 2025, 11:52:19 AM (7 days ago) Sep 26
to xAct Tensor Computer Algebra
Hi,

Thank you for the command suggestions! They work as needed and give the desired output.

I think your first command is slow because it has EqualExpressionsQ[#1, #2] which is quite slow for some reason.

The challenge I'm facing is that I need to remove redundant terms from lists of higher derivative terms with many indices (e.g., 6th- and 8th-order). For these cases, the suggested commands become very slow, taking well over 20 minutes even for just four terms in the list. Attached notebook shows what I mean.

Because of this, I don’t think the commands in their current form will work for my purposes. I’m not sure what the best way forward would be.

Best,
Sukruti
How to remove redundant terms 2.nb
Reply all
Reply to author
Forward
0 new messages