I have some expression which I want to gather various linear terms (CxxP, CxyP, CyyP) from. Currently I am using:
aaa = Collect[ expr, {CxxP, CxyP, CyyP}]
but the result is not returned in the order I specify (i.e. I would like CxxP to appear first etc):
-(1 + a) CxyP (a GC) - CxxP (k^2 l^2 + GC)
The reason for wanting this ordering is so I can extract the specific terms I need. If there is an easier way to do this I would love to know, e.g.
In[] = ExtractTerm[aaa, CxxP]
Out[] = -(k^2 l^2 + GC)
Using CoefficientList doesn’t preserve the order either, and doesn’t pick up coefficients for terms that aren’t there i.e. I want to be explicitly told that there aren’t any CyyP terms.
Thanks, Ewan
If I’ve understood you right, you can make an ordered list of coefficients like this: