Re: Re: Sum

• To: mathgroup at smc.vnet.net
• Subject: [mg55276] Re: [mg55232] Re: [mg55175] Sum
• From: yehuda ben-shimol <bsyehuda at gmail.com>
• Date: Fri, 18 Mar 2005 05:33:52 -0500 (EST)
• References: <200503161035.FAA23742@smc.vnet.net>
• Reply-to: yehuda ben-shimol <bsyehuda at gmail.com>
• Sender: owner-wri-mathgroup at wolfram.com

```As said before, the iterator of Sum is a LOCAL variable to the Sum
function as can be seen in the following example
Sum[(Print[i]; 1/i^2), {i, Infinity}]
and the functions prints
K\$18
and then returns the result
Pi^2/6
K\$18 is a local naming (as is used to in a Module[] for local
variables) so x must be evaluated with the local variables before the
summation takes place

yehuda

On Thu, 17 Mar 2005 03:29:08 -0500 (EST), DrBob <drbob at bigfoot.com> wrote:
> >> If the result weren't infinite, that would be a good idea.
>
> Oops, I take that back. It would almost always be a bad idea, so I don't know why Evaluate isn't automatic.
>
> Bobby
>
> On Wed, 16 Mar 2005 10:10:40 -0600, DrBob <drbob at bigfoot.com> wrote:
>
> > Sum tried to simplify BEFORE substituting the value of x. If the result weren't infinite, that would be a good idea. But in this case, it's not. But there's a simple fix:
> >
> > x = Exp[-k]
> > Sum[Evaluate@x, {k, 0, Infinity}]
> >
> > E^(-k)
> > E/(-1 + E)
> >
> > Bobby
> >
> > On Wed, 16 Mar 2005 05:35:51 -0500 (EST), mjumbo <mjumbo at nm.ru> wrote:
> >
> >> Can sombody explain me why
> >>
> >> Sum[Exp[- k], {k, 0, Infinity}]
> >>
> >> gives the correct result, while the following (imho equivalent) statements
> >>
> >> x = Exp[-k]
> >> Sum[x, {k, 0, Infinity}]
> >>
> >> don't? What should I do to make it work? It is rather vexing to copy/paste long expressions instead of using short placeholders like x.
> >> __________
> >> www.newmail.ru -- Íîâàÿ Ïî÷òà: âñå ïî-íîâîìó.
> >>
> >>
> >>
> >>
> >
> >
> >
>
> --
> DrBob at bigfoot.com
>
>

```

• References:
• Sum
• From: mjumbo <mjumbo@nm.ru>
• Prev by Date: Re: functional programming excercise from Mastering Mathematica
• Next by Date: Re: Re: Do loops in Mathematica
• Previous by thread: Re: Re: Sum
• Next by thread: Re: Re: Re: Sum