Subject: finding out if expr has the form F(y/x^a)
From: Richard Hennessy
Date: Thu, 13 Dec 2012 20:13:16 -0500
?It should be easy to fix, but:
(%i4) solution(1/(y-1/x),x,y);
expt: undefined: 0 to a negative exponent.
--Barton?
Here is another try for someone to point out where it is broken. It never gives false positives but it may reject some true positives. I don?t know. This is kind of an obsession working on this (in a fun sort of way).
load(pdiff)$
solution(g,x,y):=block
(
[g2, g3, g4, g5, 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(radcan(g4),0))=true then
(
g5:at(diff(at(g,y=x),x),x=1),
_a:-abs(g5)+1
)
else
(
g6:at(diff(at(g,y=x),x)/g4,x=1),
_a:-ratsimp((g6+1)/(g6-1))
)
),
f:radcan(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]
)$