Re: simplifying inside sum, Mathematica 5.1

*To*: mathgroup at smc.vnet.net*Subject*: [mg53726] Re: [mg53709] simplifying inside sum, Mathematica 5.1*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Tue, 25 Jan 2005 05:03:25 -0500 (EST)*References*: <200501240837.DAA28210@smc.vnet.net> <B0C62081-6E02-11D9-890F-000A95B4967A@mimuw.edu.pl>*Sender*: owner-wri-mathgroup at wolfram.com

On 24 Jan 2005, at 13:23, Andrzej Kozlowski wrote: > > On 24 Jan 2005, at 09:37, Richard Fateman wrote: > >> Sum[a[i]*x^i,{i,0,Infinity}] >> >> %/. x->0 >> >> >> leaves 0^i inside the sum, unsimplified. >> >> So does the sum from 1 to Inf. >> >> The correct answers are presumably a[0] and 0. >> >> Is there a way to get Mathematica to do this? >> >> RJF >> >> >> > > First, note that even if Mathematica did "simplify" 0^i inside the sum > it would not return what you are (presumably) expecting since: > > Sum[0*a[i],{i,0,Infinity}] > > Indeterminate expression 0*Infinity encountered. > > Indeterminate > > > > The way to deal with this is to replace Infinity by some symbol m and > after evaluating replace m by Infinity: > > > Sum[0*a[i],{i,0,m}]/.m->Infinity > > 0 > > Curiously using Hold[Infinity] in place of Infinity does not work: > > In[18]:= > Sum[0*a[i], {i, 0, Hold[Infinity]}] > > Indeterminate expression 0*Infinity encountered. > > Indeterminate > > Nevertheless, this works: > > ReleaseHold[Sum[a[i]*x^i, {i, 0, Hold[Infinity]}] /. > x -> 0 /. 0^(i_) :> KroneckerDelta[i, 0]] > > > a[0] > > or > > > Sum[a[i]*x^i, {i, 0, Hold[Infinity]}]; > > > ReleaseHold[Block[{Power}, > 0^(i_) := KroneckerDelta[i, 0]; % /. x -> 0]] > > a[0] > > If you prefer you can use m and m->Infinity instead of Hold and > ReleaseHold and you could of course globally re-define 0^i as > KroneckerDelta[i, 0]. > > > > Andrzej Kozlowski > Perhaps a slightly more elegant approach is to do everything inside Block, as follows: Block[{Power,Infinity}, 0^(i_) := KroneckerDelta[i, 0]; Sum[a[i]*x^i, {i, 0, Infinity}]/. x -> 0] a(0) Andrzej Kozlowski

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