Question: Replacing f(x) by f in an expression


Presently, I am trying to find a way to replace functional expressions by a variable 

For example I have an expression as follows:

p:=f(x)^2 + g(x)^3 

I would like to get this to look like 

q:= f^2 + g^3 

Does anybody have an idea of how to do this in Maple? 



Please Wait...