$sum, dosum and simplifcation



I don't recall the resolution of this discussion, but I would just warn 
against making (yet another?)
change in the behavior of a function based on some particular bug 
report.  By stamping out
one putative bug one can break a behavior that is relied upon by many 
other programs.

Fixing these bugs can be done by reversing the change.

whose bugs become features?

sum(if i>5 then 0 else 1,  i, 1, 10)
comes out 6

but
i:10;

sum(if i>5 then 0 else 1,  i, 1, 10)

This now comes out 0.  so maxima is, in my view, buggy at the moment.

Commercial Macsyma gives 6 in both cases.

Whatever you are doing now is wrong; it appears that what you are proposing
is equally wrong, but it is perhaps not clear what the proposal is.

RJF

-


Robert Dodier wrote:
> On 2/20/10, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
>
>   
>> The current behavior is *not* the 40-year-old behavior -- it is something
>> that Dodier changed
>>     
>
> Yes. I changed it to fix various bug reports. Also I changed it after a
> lengthy correspondence with Barton W, and you as well on occasion.
> Finally, I changed it after posting a message to the mailing list about it
> (which drew no responses).
>
>   
>> (against your objections and mine if I remember correctly) a few years ago.
>>     
>
> I went back through my email and the bug reports and I found
> no evidence of this claim.
>
>   
>> Perhaps the clean but user-friendly thing to do is to define sum(a,b,c,d) as
>> syntactic sugar for sum(lambda([b],a),integer_sequence(c,d)) and have the
>> semantics follow from that.  But there are still the simplification problems
>> mentioned above.
>>     
>
> This is a good idea & worth considering, but at this point I think a
> simpler remedy is just to make sum an ordinary defun, like integrate.
> That will do away with the unusual evaluation mechanism, which
> allows the summation index to be considered a local variable, but
> that small benefit is outweighed by the grief brought on by
> unusual evaluation. The problem is that it is hard to understand
> what sum is going to do in some cases -- let's make it easy to
> predict by just making it a defun.
>
> FWIW
>
> Robert Dodier
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>