finding out if expr has the form F(y/x^a)



Answer to Barton comment
http://www.math.utexas.edu/pipermail/maxima/2012/031150.html

Thank Barton for your comments.
I updated  check1 to check2.
Now  case u(x,y)=Q(y/x)*(y/x) included.

 Maxima by default  do not know chain rule for derivative of composite
function y=f(g(x)):
(%i1) diff(f(g(x)),x);
(%o1) 'diff(f(g(x)),x,1)
 For this we use package pdiff.  In maxima help I did not find
documentation  for this package.
(%i2) load(pdiff)$
(%i3) diff(f(g(x)),x);
(%o3) g[(1)](x)*f[(1)](g(x))
(%i4) convert_to_diff(%);
(%o4) ('diff(g(x),x,1))*(at('diff(f(g34113),g34113,1),[g34113=g(x)]))

(%i5) check2(g,x,y):=block([eq,sol,_a],local(sol,eq),
eq:_a*y*diff(u(x,y),y)+x*diff(u(x,y),x)=(_a-1)*u(x,y),
eq:convert_to_diff(eq),
subst(u(x,y)=g,eq), ev(%%,nouns),
sol:radcan(solve(%%,_a)),
if sol=all then sol:[a=%r],
if not freeof (x,y, sol) then return(false),
[g='f(y/x^a)*y/x,a=rhs(sol[1]),f(x)=radcan(subst([y=x^(_a+1),sol[1]],g*x/y))])$

(%i6) check2(Q(y/x)*(y/x),x,y);
(%o6) [(y*Q(y/x))/x=(y*f(y/x^a))/x,a=1,f(x)=Q(x)]

 Case u(x,y)=(y*(x^2*abs(y)-x^2*y))/x, y>0.
(%i7) assume(y>0);
(%o7) [y>0]
(%i8) (y*(x^2*abs(y)-x^2*y))/x;
(%o8) 0
 Then u(x,y)=0.
(%i9) check2((y*(x^2*abs(y)-x^2*y))/x,x,y);
(%o9) [0=(y*f(y/x^a))/x,a=%r,f(x)=0]

 Case u(x,y)=(y*(x^2*abs(y)-x^2*y))/x, y<0.
(%i10) forget(y>0)$ assume(y<0)$
(%i12) (y*(x^2*abs(y)-x^2*y))/x;
(%o12) -2*x*y^2
 Then u(x,y)=-2*x*y^2.
(%i13) check2((y*(x^2*abs(y)-x^2*y))/x,x,y);
(%o13) [-2*x*y^2=(y*f(y/x^a))/x,a=-2,f(x)=-2*x]

best
Aleksas