Subject: finding out if expr has the form F(y/x^a)
From: Richard Hennessy
Date: Wed, 12 Dec 2012 23:18:58 -0500
"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. The difficulty I
have here is the generality of the function f. You can have:
expr:y^3+1/x^(3/2);
or:
expr:(y/x)*sin(y^2/x^4 + y^3/x^6);
I think it reduces to this:
(after dividing by y/x,) How to find out if there is a constant 'a' for
which
a substitution H=y/x^a leads to an expression free of x and y?
Best,
NB"
?but it fails for some trivial cases (as does rich.hennessy's version):?
If my understanding of the rat() function is correct then this new version
is better. I pass in the values x,y because someone might be interested in
the more general case when x = someothervar, y=someothervar2. It catches a
lot of cases that would be rejected without using rat(). I can?t claim it
works in every case, but I think it is a pretty good answer for what was
originally asked. I can?t take credit for it, I did not think of the basic
premise of using pdiff package. I would not have done it that way since I
don?t know much about pdiff.
solution(g,x,y):=block
(
[g2,g3,g6,a],
g2:g*x/y,
g3:at(g2,y=1/x),
if is(equal(g3,g2))=true then
(g6:1,a:%r)
else
(g6:at(diff(at(g,y=x),x)/diff(g3,x),x=1),a:-ratsimp((g6+1)/(g6-1))),
f:at(g*x/y,y=x^(a+1)),
if is(equal(radcan(rat(g-y/x*at(f,[x=y/x^a]))),0))=true then
['a=a,'f(x)=f]
)$
The end. This is my last unsolicited post on this, sorry if I am annoying
anyone. Please let me know if this is good enough NB.