Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.9K Views
|
4 Replies
|
1 Total Like
View groups...
Share
Share this post:
GROUPS:

Turn a product of elements into a list

Posted 10 years ago

I am writing a code to apply Wick's theorem to expectation values of products of elements like x[i][t], y[k][t2]... I would like to find a way to turn such products into lists {x[i][t],y[k][t2], ...}, so that then I can use Subsets to find all pairings between the elements, and then replace them by the corresponding expectation values. How could I achieve this? Best,

Stefano

4 Replies

This works, thank you very much!

POSTED BY: Gianluca Gorni

Perhaps you can do it with Cases and a pattern:

Cases[x[i][t]*y[k][t2], (x | y)[i_][t_], All]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard