Imagine there is a given function f, defined with
f[x_] := Sin[x]^2 + Cos[x]^2.
Is it possible to get rhs of this function before evaluation? For instance of f I want to get expression
Sin^2 + Cos^2.
You can do
which would return to you the r.h.s. wrapped in
Note that while this is a useful technique, in many cases it is not really needed, so I'd first reconsider the design of your functions, and only use the above if it is really necessary.As a light-weight alternative, you can use local rules (
Then, you get what you need simply by
The general from of this question is what prompted my question and self-answer:
The output is wrapped in
Again, the advantage to this method over working with