Menu

#4760 crazy question: Is "1" zero or nonzero? from one-arg limit

None
open
nobody
None
5
2026-06-25
2026-06-06
No

This should either ask for the parity of n, or return something like (-1)^n * minf. It should not ask if `1' is zero or nonzero.

(%i1)   declare(n,integer)$

(%i2)   assume(n < 0)$

(%i3)   limit((-1)^n/zerob);
"Is "1" zero or nonzero?"nz;
(%o3)   minf

Discussion

  • Stavros Macrakis

    Agreed this is a bug.

    Single-argument limit isn't supposed to return things like (-1)^n*minf, but to resolve them. In this case, I think the only correct result is infinity, which is what it returns for limit((-1)^x/zerob) and limit((-1)^(-x^2-1)/zerob) with no declarations on x.

     
  • Barton Willis

    Barton Willis - 2026-06-07

    FYI: For the bit of code I was working with, I worked around this bug by using ask-integer to determine the parity of the integer. Not ideal, but it works.

     
  • Barton Willis

    Barton Willis - 2026-06-25

    A simpler example

    (%i1) assume(n < 0);
    (%o1)                               [n < 0]
    
    (%i2) asksign(-(-1)^n);
    Is 1 zero or nonzero?
    
    nz;
    (%o2)                                 neg
    
     

Log in to post a comment.

Auth0 Logo