The functions command extracts all functions present in an expression A.
f = sin(x) + cos(y) + z; functions(f); [sin(x), cos(y)]