Re: Misbehaving Sum[..,{n,0,Infinity}]
- To: mathgroup at smc.vnet.net
- Subject: [mg37716] Re: [mg37676] Misbehaving Sum[..,{n,0,Infinity}]
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Sat, 9 Nov 2002 00:30:34 -0500 (EST)
- References: <200211080715.CAA07371@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"David M. Wood" wrote: > > Aaaargh. > > What is with Mathematica (4.2 here) and infinite sums?! (The > following has annoyed me for years. I'm finally indignant enough to > pose this query.) > > A nominally infinite sum for which only a finite number of terms > contribute FAILS to evaluate for an uppper index limit of Infinity, > but evaluates PROPERLY for an (arbitrary) finite upper index limit. > > Example: > > cn = If[n == 0, 1, 0] - 1/2 If[n == 1, 1, 0]; > Sum[x^(n-1) cn,{n,0,Infinity}] > > gives > > If[n == 0, 1, 0] - 1/2 If[n == 1, 1, 0]/((1 - x) x) > > while > > Sum[x^(n-1) cn,{n,0,731}] > > gives > > -1/2 + 1/x > > (which is, of course, what I want). I've Google-searched to no avail, > nested Evaluate every which way, but only a finite upper limit works > properly--inconvenient for formal results. > > Can anybody explain what's going on, or how to coerce Mathematica into not > choking on an infinite number of non-contributing terms? > > Thanks! > > David M. Wood, Department of Physics, Colorado School of Mines, > Golden, CO 80401; Phone: (303) 273-3853; Fax: (303) 273-3919 > http://www.mines.edu/Academic/physics/people/pages/wood.html > > -- > David M. Wood, Dept. of Physics, Colorado School of Mines, Golden, CO 80401 > Phone: (303) 273-3853; Fax: (303) 273-3919; e-mail: dmwood at Mines.EDU You get the desired result for concrete upper bounds because the sum is evaluated "procedurally", that is, it is explicitly summed. I should mention that this is a bit of a design controversy in that procedural and functional summation are not separated. You do not get a sum using a symbolic or infinite upper bound because the symbolic summation code is not able to handle If. You can get what you want if you rewrite your function in terms of, say, KroneckerDelta. For example: In[1]:= cn[r_] := KroneckerDelta[r] + KroneckerDelta[r-1]/2 In[2]:= InputForm[Sum[x^(n-1) cn[n],{n,0,Infinity}]] Out[2]//InputForm= 1/2 + x^(-1) In[3]:= InputForm[Sum[x^(n-1)*cn[n],{n,0,t}]] Out[3]//InputForm= UnitStep[-1 + t]/2 + UnitStep[t]/x Daniel Lichtblau Wolfram Research
- References:
- Misbehaving Sum[..,{n,0,Infinity}]
- From: "David M. Wood" <dmwood@slate.Mines.EDU>
- Misbehaving Sum[..,{n,0,Infinity}]