IndexCollect

31 views
Skip to first unread message

olse barn

unread,
Mar 9, 2023, 10:16:53 AM3/9/23
to xAct Tensor Computer Algebra
Hey everyone, 

I have a pretty long expression which looks something like this:

... + PD[-i][PD[-j][f[]]] * somethingelse1 +... + PD[-k][PD[-l][f[]]] * somethingelse2 + ... .

I would now like to collect only those terms that are multiplied by 

PD[-index1][PD[-index2][f[]]]

where index1 and index2 can be any element of the set of indices that I defined for the manifold.

Is there a way to do this? I.e. can I collect partial derivative terms with "undefined" indices and not having to Collect each combination "by hand"?

All the best.

olse barn

unread,
Mar 9, 2023, 11:01:19 AM3/9/23
to xAct Tensor Computer Algebra
Hey again, I already solved it by multiplying every f[] with a constant defined by DefConstantSymbol[coef].

Thomas Bäckdahl

unread,
Mar 9, 2023, 11:13:25 AM3/9/23
to xa...@googlegroups.com

Hi!

Yes, multiplying with constants and collecting constants is a useful method. The constant can be replaced with 1 after the collection too.

Also note that Collect works with patterns too, so you can do something like

Collect[%, {PD[_][PD[_][f[]]]}]

However, this will not bundle together expressions like this with different indices.
The function IndexCollect tries to handle that kind of problem though.

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 on the web visit https://groups.google.com/d/msgid/xact/81956733-5d99-49b4-9e6f-41be185b415dn%40googlegroups.com.

olse barn

unread,
Mar 9, 2023, 1:07:12 PM3/9/23
to xAct Tensor Computer Algebra
thank you for your alternative proposal!
Reply all
Reply to author
Forward
0 new messages