Subject: finding out if expr has the form F(y/x^a)
From: nijso beishuizen
Date: Fri, 14 Dec 2012 20:29:17 +0100
Thanks for all your input! In my program I substituted Z for y/x but then I didn't know what to do with x^a-1. It's nice to see the different approaches in maxima dealing with arbitrary powers of x like this.
Best,
NB
> > Dear all,
> >
> > I would like to find out if an expression is of (or can be written in)
> the general form (y/x)*f(y/x^a), with 'a' a nonzero constant.
>
> This version takes into account that a is required to be nonzero.
>
> load(pdiff);
>
> usol(g,a0):=block([f0,g0],
> if a0 = 0 then return([g,false]),
> if a0 = 'any then (f0:g*x/y,g0:ratsimp(y/x*f0),
> return(['a = a0,'f = f0,
> g =g0,is(ratsimp(g-g0) = 0)])),
> f0:ratsimp(at(ratsimp(g*x/y),y = x^(a0+1))),
> g0:ratsimp(y/x*at(f0,x = y/x^a0)),
> ['a = a0,'f = f0,g = g0,is(ratsimp(g-g0) = 0)]);
>
> sol3(g):=block([f0,a,f],
> f0:ratsimp(g*x/y),
> if freeof(x,y,f0) then return(usol(g,'any)),
> if diff(f0,x) = 0 or diff(f0,y) = 0 then return([g,false]),
> a0:ratsimp((-1)/at(diff(f0,y)/diff(f0,x),y = t*x)/t),
> if not freeof(x,y,t,a0) then return([g,false])
> else return(usol(g,a0)));
>
> test:[0,7,1/x,y/x,y/x*h(y/x^m),1/(y-1/x),
> y^3+1/x^(3/2),h(x*y)*y/x,1/x^2,1/(y-1/x^n)];
>
> map(sol3,test);