I'm working now with xAct in Mathematica obtaining huge list (around 50 000 terms) of contractions of a metric tensor with vector fields. I know that some elements of these list are multiplied for certain factor, let us call this for simplicity $f[x]$, and those elements should be deleted for consistency. So for example I will have
List1={f[x]y,f[x]z,z^2,y,y^2,f[x]^2};
So a tried the simplest solution: divide the list by $f[x]$ and check the Denominator
Redc=List1/(f[x]);
Numc=Denominator[Redc];
Thus, if the Denominator is different from 1, I will keep that entry and delete the rest (from the original list). Unfortunately I could't find the solution. Perhaps It will be quite easy, but I'm not really expert on Mathematica. I appreciate any help. Thanks
DeleteCases
? As in{f[x] y, f[x] z, z^2, y} // DeleteCases[f[x] _]
. This won't delete thef[x]^2
instance, but it is easily adapted for those cases if that's what you needed $\endgroup$ – glS Nov 2 '16 at 20:14