Menu

#4634 Divergent integral simplifies to -1/4 with simplify_sum

None
closed
nobody
6
2026-01-12
2025-11-18
kcrisman
No

In the Sage support list we have the following message about a divergent integral giving a solution with the optional package simplify_sum.

"In maxima 5.47.0 I get:

(%i1) load(simplify_sum)$
(%i2) simplify_sum( sum(n*(-1)^n,n,1,inf));
-1/4

This happens both on sage's ECL based one and on the system maxima (running on SBCL). "

That this is a reversion is seen from the following:

Maxima 5.42.2 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) load(simplify_sum)$

(%i2) simplify_sum( sum(n*(-1)^n,n,1,inf));
(%o2)                                 ind

Discussion

  • Barton Willis

    Barton Willis - 2025-11-18

    With Maxima 5.48.1, we're back to the incorrect value of ind

    (%i11)  simplify_sum(sum(n*(-1)^n,n,1,inf));
    (%o11)  ind
    

    This result is wrong and it is due to a bug in the limit

    (%i12)  simplify_sum(sum(n*(-1)^n,n,1,N));
    (%o12)  ((-1)^N*(2*N+1))/4-1/4
    
    (%i13)  limit(%,N,inf);
    (%o13)  ind
    

    The output %o12 is correct, but the output %o13 should be und, not ind.

    Thanks for this reporting this bug.

     
  • Barton Willis

    Barton Willis - 2025-11-18

    Specifically, this is a bug in simplimplus:

    (%i66) limit(((-1)^N*(2*N+1))/4-1/4,N,inf);
    
    1 Call   simplimplus [((-1)^N*N)/2+(-1)^N/4-1/4]
    1 Return simplimplus ind
    (%o66) ind
    
     
  • Robert Dodier

    Robert Dodier - 2025-11-24
    • labels: --> simplify_sum, limit, sum
     
  • Barton Willis

    Barton Willis - 2026-01-10

    For other simplimplus bugs, see #4137 simplimplus bugs.

    This bug can be eliminated by altering the bit of simplimplus1 code that returns the limit when one or more terms have an undefined limit:

     (cond (undl
           (cond ((and (or indl zerobl zeroal) 
                       (null infl) (null infinityl)) (return '$und))
                  ((or infl minfl infinityl)
                      (setq infinityl (append undl infinityl))); x^2 + x*sin(x)
                  (t (return '$und)))) ; 1 + x*sin(x)
    
     
  • Barton Willis

    Barton Willis - 2026-01-10

    Simplified:

    (undl
               (cond 
                     ;; When there are inf, minf, or infinity terms, the limit might not be und.
                     ;; For example, limit(x^2+x*sin(x),x,inf). For such cases, append the und 
                     ;; terms to the infinity terms.
                     ((or infl minfl infinityl)
                       (setq infinityl (append undl infinityl)))
                     ;; But when there are no infinity terms, the limit is und; for example
                     ;; limit(1 + x*sin(x),x,inf)
                     (t (return '$und))))
    

    This revision fixes two testsuite bugs

    **************** rtest_limit_extra.mac: Problem 271 (line 950) ****************
    
    Input:
    limit(sin(x) + x cos(x), x, inf)
    
    
    Result:
    und
    
    ... Which was correct, but was expected to be wrong due to a known bug in
     Maxima or SBCL.
    
    **************** rtest_limit_extra.mac: Problem 280 (line 1002) ***************
    
    Input:
           x
    limit(3  cos(x) + sin(x), x, inf)
    
    
    Result:
    und
    
    ... Which was correct, but was expected to be wrong due to a known bug in
     Maxima or SBCL.
    

    And it fixes the bug in the ticket:

    (%i1)  load(simplify_sum)$
    
    (%i2) simplify_sum( sum(n*(-1)^n,n,1,inf));
    (%o2)                                 und
    
     
  • Barton Willis

    Barton Willis - 2026-01-12
    • status: open --> closed
     
  • Barton Willis

    Barton Willis - 2026-01-12

    Fixed by Commit [bef598]. Tests appended tortest_simplify_sum andrtest_limit_extra. Closing this ticket.

     

    Related

    Commit: [bef598]


Log in to post a comment.

MongoDB Logo MongoDB