========== motivation ===========
Suppose, for example, I have an incoming expression like
m = (3-I)x + 4(x y)/(Cos[y])
I want to find all the symbols in the expression ("x" and "y" in this case) without a priori knowledge of what symbols may appear in m.
Perhaps then I want to do something to the symbols, for example, transform each symbol #:
# -> u*#
i.e. I want to obtain from m:
(3-I)u x + 4(u^2 x y)/(Cos[u y])
In this case, I can take this result, expand in u and unitize to get:
Series[(3-I)u x + 4(u^2 x y)/(Cos[u y]), {u,0,1}]/.u->1
a series expansion to first order in both x and y, where terms x^2, y^2, and x y are dropped.
==============================================================
This is just one example though, in general, I want to know how to find the symbols in an expression and do something to them.
I've tried things similar to
test = Expand[# /. Not@NumericQ :> ReplaceAll[#, z -> u z]] &;
(5-3 I)x + 2 y^2 //test
But this just returns the input unchanged, I would like it to return
(5-3 I)u x + 2 u^2 y^2
Any help?