ToCanonical seems to abort

39 views
Skip to first unread message

Giorgos

unread,
Apr 1, 2025, 8:31:16 PM4/1/25
to xAct Tensor Computer Algebra
Hey everyone,

I have a pretty big scalar expression (~3000 terms) that I wish to canonicalize. In fact, I am hoping this expression returns 0 once canonicalized. However, running ToCanonical (or FullSimplification[]) doesn't do anything. It seems to abort, because it's "done" after less than a minute (and returns the input expression). Furthermore, I can see pairs of terms that should cancel with each other after canonicalization/Full Simplification that remain the same. Therefore, I can safely conclude that ToCanonical simply aborts and doesn't work.

I have a general idea of why this happens. My expression contains sub-expressions with many indices (products of 4 christoffel symbols), as well as partial derivatives of some other 3-index tensor that I'm working with. The latter appears to be particularly bad judging from this post:

https://groups.google.com/g/xact/c/hKmMafBv5v8

What are my options? I would not mind letting the program run for 1-2 days, but it doesn't seem to let me, since it aborts by itself. Can this simply not be done?

Jose

unread,
Apr 1, 2025, 11:58:30 PM4/1/25
to xAct Tensor Computer Algebra
Hi,

When ToCanonical gets an expression it will first use Expand to convert it into a sum of terms and then act on each individual term separately. If the resulting terms cancel out you will get zero. ToCanonical does not abort the global operation because it finds a problem in one of the terms. Canonicalization of each term is independent of the rest. ToCanonical may be slow with an individual term in which there is a lot of symmetry, but having many terms will increase time linearly on average. Of course, having many terms with many indices also increase the chances that some of them are especially complicated.

What I'd recommend is the following: if you have a expression expr formed by a sum of thousands of terms, then first use

    terms = Apply[List, expr]

and then use ToCanonical on each of the terms separately. For example you can use Map, or you can use a Table. It it takes very long, perhaps you can work on groups of 100 terms or something like that and collect them at the end. Another possibility is to use parallelization. If you see that ToCanonical gives problems with one of the terms (either because there are messages or because it does not canonicalize as you expect), report it here, or send it to me. If everything seems to work then you will have again a list of canonicalized result, and you can do Apply[Plus, result], or Total[result] to see if this really gives zero.

Cheers,
Jose.

Giorgos

unread,
Apr 2, 2025, 5:31:49 PM4/2/25
to xAct Tensor Computer Algebra
Your proposed solution worked. Thanks!

My expression simplified significantly (way less than 1000 terms). Unfortunately I did not get 0 as I desired, but that seems to be because the remaining terms are related to each other through Bianchi identities relating two different tensors (and partial integrations, since I'm working with an action scalar), which I am unsure if it is within the capabilities of xAct to deal with (if there's a way, let me know!).
Reply all
Reply to author
Forward
0 new messages