- labels: --> Lisp Core - Assume
askinteger((1+%i)*(1-%i)) => false (!!)
declare(i1,integer)
askinteger(exp(%i*%pi*i1)) => false (!!)
askinteger(%pi^(sin(x)^2+cos(x)^2-1) => false (!!)
The problem is that askinteger assumes that if the
expression *syntactically* includes %pi or %i (why not %
e, %gamma, ...?), then it cannot be integral.
Fix is simple: remove the special case. Of course, there
is room to be cleverer here if someone wants to go to
the trouble, but I'd think that it would be more important
to start with cases like sqrt(2), which currently doesn't
know.
BEFORE:
(cond ((or (not (free x '$%pi))
(not (free x '$%i))
(ratnump x))
'$no)
...)
AFTER:
(cond ((ratnump x) '$no)
...)
Logged In: YES
user_id=895922
Originator: NO
I applied the suggested fix. But askinteger has lots of ofther problems:
(%i1) load("askp.lisp");
(%i2) askinteger(%i);
Is %i an integer ? yes;
(%o2) yes
(%i3) facts();
(%o3) [kind(%i,integer)] <--- Yikes!
(%i4) askinteger(sqrt(5));
Is sqrt(5) an integer ? yes;
(%o4) yes
(%i5) facts();
(%o5) [kind(%i,integer)] <--- funny kind(sqrt(5),integer) rejected.
Maybe this bug should be closed and another one filed.
Logged In: YES
user_id=895922
Originator: NO
fixed by askp.lisp cvs revision 1.9.
Log in to post a comment.