Menu

#3313 limit fails with domain complex

None
open
nobody
None
5
2024-01-10
2017-06-26
kcrisman
No

Apparently domain:complex doesn't play well with this limit.

Maxima 5.39.0 http://maxima.sourceforge.net
using Lisp ECL 16.1.2
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) limit((x*(4/log(x))^(2*log(x)/log(log(x)))),x,inf);
(%o1)                                  0
(%i2) domain:complex;
(%o2)                               complex
(%i3) limit((x*(4/log(x))^(2*log(x)/log(log(x)))),x,inf);

Condition of type: SIMPLE-CONDITION
Undefined limit product $INF * $ZEROB in lim-times

Available restarts:

1. (CONTINUE) Return from BREAK.
2. (MACSYMA-QUIT) Maxima top-level

Top level.
> ^D

Originally reported at https://trac.sagemath.org/ticket/23328

Discussion

  • Barton Willis

    Barton Willis - 2024-01-07

    The function lim-times, defined in hayat does a "break" when it should, I think call
    tay-error. I've experimented with this and a few other changes and now I get a limit nounform--that's not ideal, but it's an improvement

    (%i8) block([domain : 'complex], limit((x*(4/log(x))^(2*log(x)/log(log(x)))),x,inf));
    
    (%o8) 'limit(x*(4/log(x))^((2*log(x))/log(log(x))),x,inf)
    

    I don't entirely understand lim-times,, and my impression is that it has other bugs; for example I'd say %o1 is OK, but %o2 should be $inf, not $minf

    (%i1)   :lisp(defun \$larry (a b) (lim-times a b));
    $LARRY
    (%i1)   larry(inf,minf);
    (%o1)   -inf
    (%i2)   larry(minf,minf);
    (%o2)   -inf
    
     
  • Barton Willis

    Barton Willis - 2024-01-07

    Here is a change that allow this limit to return a limit nounform--I changed the break to a call to tay-error

    (defun lim-times (lim1 lim2)
      (let (lim)
       (cond ((or (eq lim1 '$zero) (eq lim2 '$zero)) (setq lim '$zero))
         ((and (lim-infp lim1) (lim-infp lim2)) (setq lim '$inf))
         ((and (lim-zerop lim1) (lim-zerop lim2)) (setq lim '$pos))
         ((or (when (lim-finitep lim2) (rotatef lim1 lim2) 't)
              (lim-finitep lim1))
          (when (and (eq lim1 '$finite) (lim-infp lim1))
             (tay-error "Undefined finite*inf in lim-times" lim2))
          (setq lim (lim-abs lim2)))
         (t (tay-error "Undefined limit product in lim-times" (list (list 'mtimes) lim1 lim2))))
       (if (or (lim-imagp lim1) (lim-imagp lim2))
           (if (lim-infp lim) '$infinity '$im)
          (if (and (lim-plusp lim1) (lim-plusp lim2)) lim (lim-minus lim)))))
    
     
  • Barton Willis

    Barton Willis - 2024-01-10

    Second thought: I think it's better to put an errcatch on the call to $taylor in the function calculate-series (defined in limit.lisp). Unlike only changing lim-times, this change will catch all errors from$taylor,not just the error from . Again, this proposed change doesn't fix the bug, but it allows the limit to return a nounform. And that's an improvement.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.