MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Semantics of Sum for index set in reverse order. WasRe: is it a

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107274] Semantics of Sum for index set in reverse order. WasRe: is it a
  • From: Richard Fateman <fateman at cs.berkeley.edu>
  • Date: Sun, 7 Feb 2010 06:15:07 -0500 (EST)
  • References: <hkgl3d$6t8$1@smc.vnet.net> <hkj9ah$e7t$1@smc.vnet.net>

Nasser M. Abbasi wrote:
> "olfa" <olfa.mraihi at yahoo.fr> wrote in message 
> news:hkgl3d$6t8$1 at smc.vnet.net...
>> Hello mathematica community,
>> for Sum[k[i], {i, 1, n}] + Sum[k[i], {i, n + 1, m}]
>> why mathematica cannot give as output Sum[k[i],{i,1,m]]?!
>> please help.

There are two issues here.  One is, what is (for example)
Sum[f[i],{i, n, n-4}].

There appears to be a choice.
0 for "empty sum"  and another, perhaps surprising to some people,

-f[n-1]-f[n-2]-f[n-3]

The latter of these preserves the useful identity

Sum[k[i], {i, 1, n}] + Sum[k[i], {i, n + 1, m}]= Sum[k[i],{i,1,m}]

The one chosen by Mathematica does not preserve the identity.



>>
> (Nasser..)
> My guess is that "+" is currently not defined for Sum while it is in its 
> symbolic form?
> 
> But it works ok when one plugs in some actual integer values for n and m:
> 
> Clear[s1,s2,k,n,m,i]
> s1=Sum[k[i],{i,1,n}]
> s2=Sum[k[i],{i,n+1,m}]
> 
> s1+s2/.{n->5,m->7}
> 
> k[1]+k[2]+k[3]+k[4]+k[5]+k[6]+k[7]

Choose n->7, m->5   and you notice that it does not work for some actual 
integers.  For the other choice of semantics, it does work.
Why should you choose the one that Mathematica does not? It preserves
some very important properties of Sum.   The choice used by Mathematica
is the less sophisticated notatino that the Sum[f[i],{i,n,m}] resembles

(s = 0; Do[s += f[i], {i, n, m}]; s)

even for n>=m.

RJF


  • Prev by Date: Re: NDSolve with Dirichlet boundary condition
  • Next by Date: Re: Covariant derivatives of tensors?
  • Previous by thread: Re: Integral confusion
  • Next by thread: parallel table