#690 askinteger involving %pi wrong/FIX

closed
nobody
5
2012-12-04
2005-02-14
No

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)
...)

Discussion

  • Robert Dodier

    Robert Dodier - 2006-08-11
    • labels: --> Lisp Core - Assume
     
  • Robert Dodier

    Robert Dodier - 2006-09-09
    • milestone: --> Includes_proposed_fix
     
  • Barton Willis

    Barton Willis - 2007-01-26

    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.

     
  • Barton Willis

    Barton Willis - 2008-03-09
    • status: open --> closed
     
  • Barton Willis

    Barton Willis - 2008-03-09

    Logged In: YES
    user_id=895922
    Originator: NO

    fixed by askp.lisp cvs revision 1.9.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks