_is_function_class_equation improvements

* use f.exp and f.base for f.args[1] and f.args[0] in case f.is_Pow
* flatten g.degree() <= 1 branch