Difference in interactivity with two sums



On 2012-11-16, Karl-Dieter Crisman <kcrisman at gmail.com> wrote:

> At http://trac.sagemath.org/sage_trac/ticket/11990, the question is
> raised about the discrepancy in behavior below.

> (%i3) simplify_sum(sum(m,m,0,inf));
> Is  m  positive, negative, or zero?

That seems to be a bug -- it should report "divergent" without asking
about the sign of m.

The observed behavior originates in ISUM1 (src/combin.lisp). (Looks like
simplify_sum punts to ev(sum(...), simpsum=true) before trying any fancy
stuff.)

(defun isum1 (e lo)   
  (cond ((or (free e *var*) (atom e))
         (unless (eq (asksign e) '$zero)
           (throw 'isumout 'divergent)))
        ((ratp e *var*)
         (adsum (ipolysum e lo)))
        ((eq (caar e) 'mplus)
         (mapc #'(lambda (x) (isum1 x lo)) (cdr e)))
        ( (isgeo e lo)) 
        ((adusum e)))) 

Note the first condition -- if the summand is just m then the first test
fails but the second succeeds! That bit of code has been like that since
at least 2004 (when the code was reformatted).

I don't understand what's the intent of (or (free e *var*) (atom e)) --
if E is not free of *VAR* and it's an atom, E must be *VAR*, right?

HTH

Robert Dodier