Re: Re: simplifying inside sum, Mathematica 5.1

*To*: mathgroup at smc.vnet.net*Subject*: [mg53797] Re: [mg53749] Re: simplifying inside sum, Mathematica 5.1*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Thu, 27 Jan 2005 05:41:47 -0500 (EST)*References*: <ct4h70$av2$1@smc.vnet.net> <ct56p1$eca$1@smc.vnet.net> <200501260936.EAA00194@smc.vnet.net> <opsk7uawdtiz9bcq@monster.ma.dl.cox.net> <41F7DE08.7090001@cs.berkeley.edu> <B2077717-6FEA-11D9-A87F-000A95B4967A@mimuw.edu.pl>*Sender*: owner-wri-mathgroup at wolfram.com

On 26 Jan 2005, at 22:36, Andrzej Kozlowski wrote: > On 26 Jan 2005, at 18:14, Richard Fateman wrote: >> As for Andrzej's comment, that this does the job... >> >> >> Block[{Power,Infinity}, >> 0^(i_) := KroneckerDelta[i, 0]; Sum[a[i]*x^i, {i, 0, Infinity}]/. >> x >> -> 0] >> >> Here are some comments: >> >> >> 1. There is no need for Infinity to be bound inside the Block. > > Indeed, I did not check that. I had reasons to think it was needed. > >> 4. Your solution gives the wrong answer for >> Sum[a[i]*x^i, {i, -1, Infinity}] > > Since any sum can be split into a finite sum over the negative indices > and an infinite sum over indices >=0 and since finite sums are handled > correctly this is essentially a cosmetic issue. In fact it is easy to > modify Sum to automatically split all sums in this way, and to use the > Block trick for the infinite part. But I don't think this is important > enough to bother. > > >> >> It also doesn't work for >> Sum[a[i]*x^(i^2), {i, -1, Infinity}] >> >> This latter problem suggests an inadequacy in the treatment of the >> simplification of Sum[KroneckerDelta[...]....] > > Well, yes. One can always find ways to trip up Mathematica (and all > other CAS) in this sort of thing. It's a bit like playing chess with a > computer program; however strong it is if you get to know it well > enough you will find ways to beat it (assuming of course you are a > good chess player and understand computers). But the difference is > that CAS is not meant to be your opponent and trying to trip it up > (which is also what most of Maxim's examples involve) is a pointless > exercise, which may amuse people who like such things but has nothing > to do with any serious work. > > Andrzej Kozlowski > > Perhaps I should have added that one can deal with the last point by adding additional rules for KroneckerDelta. In this case: Unprotect[KroneckerDelta]; KroneckerDelta[0,x_^n_]:=KroneckerDelta[0,x] Protect[KroneckerDelta]; Block[{Power}, 0^(i_) := KroneckerDelta[i, 0]; Sum[a[i]*x^(i^2),{i,-1,Infinity}]/. x -> 0] a(0) There are obviously lots more rules of this type that can be added. The question is: should this be built-in? Should countless other such things be built-in? How often is this going to be used and does it justify spending resources on it, particularly in view of the fact that the rare user who actually needs this can easily add it himself? The basic policy of WRI seems to me always to have been to include among the built-in functions only those that can be justified by there being a wide need for them, while other things are appropriate for AddOn packages. This applies even to interesting but rarely used functions such as ProvablePrimeQ etc. In my opinion, this is a sensible approach for a general purpose program like Mathematica. Andrzej Kozlowski

**References**:**Re: simplifying inside sum, Mathematica 5.1***From:*Richard Fateman <fateman@cs.berkeley.edu>