Menu

#3592 Wrong limit

None
closed
nobody
limit (163)
5
2022-12-05
2019-11-05
No

This very simple limit:

(%i1) limit((z^(2*n)-1)/(z^2-1),z,-1);
(%o1)                              infinity

goes catastrophically wrong. We can think that a reasonable solution will be

(%i1) declare(n,integer);
(%o1)                                done
(%i2) limit((z^(2*n)-1)/(z^2-1),z,-1);
(%o2)                                  0

And wrong again! BTW all (well, actually I haven't checked all, :-)) the particular cases are correct:

(%i1) limit((z^(2*99)-1)/(z^2-1),z,-1);
(%o1)                                 99

More mystery: the function is even and the other limit

(%i1) limit((z^(2*n)-1)/(z^2-1),z,1);
(%o1)                                  n

Is OK! (even without the declare) Why?

Discussion

  • Robert Dodier

    Robert Dodier - 2019-11-14
    • labels: --> limit
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,24 +1,23 @@
    -
     This very simple limit:
    -
    +~~~~
     (%i1) limit((z^(2*n)-1)/(z^2-1),z,-1);
     (%o1)                              infinity
    -
    +~~~~
     goes catastrophically wrong. We can think that a reasonable solution will be
    -
    +~~~~
     (%i1) declare(n,integer);
     (%o1)                                done
     (%i2) limit((z^(2*n)-1)/(z^2-1),z,-1);
     (%o2)                                  0
    -
    +~~~~
     And wrong again! BTW all (well, actually I haven't checked all, :-)) the particular cases are correct:
    -
    +~~~~
     (%i1) limit((z^(2*99)-1)/(z^2-1),z,-1);
     (%o1)                                 99
    -
    +~~~~
     More mystery: the function is even and the other limit
    -
    +~~~~
     (%i1) limit((z^(2*n)-1)/(z^2-1),z,1);
     (%o1)                                  n
    -
    +~~~~
     Is OK! (even without the declare) Why?
    
     
  • Robert Dodier

    Robert Dodier - 2019-11-14

    I see the same behavior, working with Maxima 5.43.0.

     
  • Barton Willis

    Barton Willis - 2022-01-03

    Possible fix: When the limit point isn'tinf, apply sratsimp to the first two arguments of lhospital.

    What happens, I think, is that when n is an integer, the vanishing expression
    ((-1) ^n - 1)*((-1)^n + 1) doesn't simplify to zero and that confuses the function lhospital.

    Why only apply sratsimp when the limit point isn't an infinity? That's a mystery, but doing so results in limit((-x)*log(%e^x+1)-li[2](-%e^x)+x^2/2,x,inf) returning a nounform, not the correct value of %pi^2/6.

    Maybe there is a more logical criteria for applying sratsimp?

    (defun lhospital (n d ind)
      (declare (special val lhp?))
       (when (not (infinityp val))  ;proposed fix
          (setq n (sratsimp n)
                d (sratsimp d)))
           ...
    
     
  • Barton Willis

    Barton Willis - 2022-12-05
    • status: open --> closed
     
  • Barton Willis

    Barton Willis - 2022-12-05

    Fixed by Commit [37f222], not by the patch I first suggested. This patch fixes the function lhsimp.

     

    Related

    Commit: [37f222]


Log in to post a comment.

MongoDB Logo MongoDB