Is it possible to filter out all terms in a sum that don't include a certain variable? Or equivalently keep only terms that involve a certain variable.
I would like to use such a function to experiment with the behavior of a sum with respect to a single variable (e.g., maximizing).
For example, if the input is $$(\cos(a)\sin(b)+b+\tan(b)c+a^2c, a)$$ I would like the output to be $$\cos(a)\sin(b)+a^2c.$$
I can't find an easy way to do this using
DeleteCases or the like.
EDIT: Given confusion expressed about what I want I've changed the example and clarified the purpose.