Subject: finding out if expr has the form F(y/x^a)
From: Richard Hennessy
Date: Thu, 13 Dec 2012 15:48:31 -0500
?It should be easy to fix, but:
(%i4) solution(1/(y-1/x),x,y);
expt: undefined: 0 to a negative exponent.
--Barton?
Thanks for pointing this out. I fixed two cases including the above which, I think, should be false. They include Barton?s case and additionally 1/(y-1/x^n). I think there are others, which I don?t know about yet. In any case, these are not ?easy to fix? IMHO. I hope I did not break anything by fixing these two.
load(pdiff)$
solution(g,x,y):=block
(
[g2,g3,g6,_a,inflag : true],
catch(g2:g*x/y,
if is(equal(at(denom(g2),y=1/x),0))=true then throw(false),
g3:at(g2,y=1/x),
if is(equal(g3,g2))=true then
(g6:1,a:%r)
else
(
if is(equal(at(denom(radcan(diff(g3,x))),x=1),0))=true then throw(false),
g4:at(diff(g3,x),x=1),
if is(equal(g4,0))=true then throw(false),
g6:at(diff(at(g,y=x),x)/g4,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]
)$