Re: Sum
- To: mathgroup at smc.vnet.net
- Subject: [mg55210] Re: Sum
- From: dh <dh at metrohm.ch>
- Date: Thu, 17 Mar 2005 03:28:29 -0500 (EST)
- References: <d192qe$ng4$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi mjumbo,
Auxilliary variables like k in Sum[..,{k,..}] are handled apart from
ordinary variables. Otherwise the following example would give an error:
k=2;
Sum[k,{k,1,2}]
Mathematica does this by taking the unevaluated expression in:
Sum[expr,{k,1,2}] and literally replace all "external" k against
"internal" k's. In your casae it takes x (there is nothing to replace).
Then it calculates the Sum, giving x times Infinity, then it replaces x
by Exp[-k] giving Exp[-k] times Infinity.
If you want Mathematica to evaulate x first before replacing variables,
you have to tell Mathematica by:
x=Exp[-k];
Sum[ Evaluate[x] ,{k,0,Infinity}]
Daniel
mjumbo 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 -- Íîâàÿ Ïî÷òà: âñå ïî-íîâîìó.
>