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



> (%i1) check1(g,x,y):=block([eq,sol,_a],
> eq:_a*y*diff(u(x,y),y)+x*diff(u(x,y),x)=(_a-1)*u(x,y),
> 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))])$

If u is defined to be a global function, this code will misbehave. Also, if the input g involves a
symbolic function, I think this code will also fail; for example

 (%i3) check1(Q(y/x)*(y/x),x,y);
 (%o3) false

The code posted a few days ago by Daniel Rupistraliz Avez handled this case OK. And a minor quibble: you need
to declare sol to be local, otherwise sol[1] will first check if sol is a global array. All you need to do is

   block([eq,sol,_a], local(sol),  ...)

Finally, you might enjoy testing your code on

 (%i16) subst(z = y*x^2, (y/x) * (abs(z)-z));
 (%o16) (y*(x^2*abs(y)-x^2*y))/x

and determine why check1 fails. Fixing this (and related problems isn't easy, I think).


--Barton