MathGroup Archive 2002

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

Search the Archive

Bug in Sum causes index variable to remain set?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33838] Bug in Sum causes index variable to remain set?
  • From: "Martin Jenkins" <lamarth at optushome.com.au>
  • Date: Fri, 19 Apr 2002 02:28:35 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hello, I have found what appears to be a bug in Sum in Mathematica 4.0.  
I stumbled across is trying to sum an expression with subscripts.  
Anyway:

In[1]:= n = 1;

In[2]:= Sum[1, {f[x, 1], 1, 3}]
Out[2]= 3
In[3]:= ?f
In[4]:= Sum[1, {f[x, n], 1, 3}]
Out[4]= 3
In[5]:= ?f

In[6]:= Clear[f];
In[7]:= Sum[1, {f[x, 1*1], 1, 3}]
Out[7]= 3
In[8]:= ?f

The way that f gets set by the Sum to the final value is a bug is it 
not?  I would guess that Sum unsets the literal expression f[x, n] or 
f[x, 1*1], rather than exactly what it set in the first place.  I can 
get around this by f[x,n]=. whenever I use it... but I would rather 
not have a line with a comment saying "Mathematica bug work-around".  
Integrate works fine under similar circumstances.

Thanks,
Martin



  • Prev by Date: Re: Forcing a Tick at Zero?
  • Next by Date: Re: Driving me nuts
  • Previous by thread: Re: double integral
  • Next by thread: Re: Bug in Sum causes index variable to remain set?