What's the best way to extend Variables to work on expressions that are not polynomial?
IE, the following returns {x,y}, but I want {x,y,z}
expr=2 x + 5 y + 10^z;
Variables[expr]
This would be useful for automatically turning expressions into callable functions like here, ie automatically fill variable slots from parameters:
makeFunc[expr][1,2,3]
Variables[Level[expr, {-1}]]gives{x, y, z}You can also doCases[expr, _Symbol, Infinity]which gives{z, x, y}– Nasser Mar 01 '23 at 21:55