rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

limit misses some constant expressions #2698

Open rtoy opened 1 week ago

rtoy commented 1 week ago

Imported from SourceForge on 2024-07-06 18:10:29 Created by willisbl on 2024-03-22 12:11:31 Original: https://sourceforge.net/p/maxima/bugs/4277


When limsubst is false (the default), limit fails to detect some (not all) constant expressions

(%i29)  block([limsubst : false], limit(sum(f(x),x,1,inf),x, 3));
(%o29)  limit(sum(f(x),x,1,inf),x,3)

(%i30)  block([limsubst : true], limit(sum(f(x),x,1,inf),x, 3));
(%o30)  sum(f(x),x,1,inf)
rtoy commented 1 week ago

Imported from SourceForge on 2024-07-06 18:10:29 Created by willisbl on 2024-03-23 14:43:32 Original: https://sourceforge.net/p/maxima/bugs/4277/#c239


Likely a fix is to change (not (among var exp)) to (($freeof var exp) in the function limit. Specifically

(defun limit (exp var val *i*)
  (cond
    ((among '$und exp)  '$und)
    ((eq var exp)  val)
    ((atom exp)  exp)
    ((not (among var exp)) ;; Change to (($freeof var exp)
     (cond ((amongl '($inf $minf $infinity $ind) exp)
                 (simpinf exp))
           ((amongl '($zeroa $zerob) exp)
            ;; Simplify expression with zeroa or zerob.
            (simpab exp))
       (t exp)))
rtoy commented 1 week ago

Imported from SourceForge on 2024-07-08 21:35:24 Created by willisbl on 2024-07-08 23:59:50 Original: https://sourceforge.net/p/maxima/bugs/4277/#2eff


rtoy commented 1 week ago

Imported from SourceForge on 2024-07-08 21:35:28 Created by willisbl on 2024-07-08 23:59:50 Original: https://sourceforge.net/p/maxima/bugs/4277/#951e


This bug has been fixed, but I'm not sure how it was fixed. These tests were added to rtest_limit_extra, so I am closing this ticket.