MathGroup Archive 2002

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

Search the Archive

Re: Bug in Sum causes index variable to remain set?


I'm sorry, it appears that all lines starting with "F r o m" have been
deleted from my original message.  So much for copy as text+paste from
Mathematica.  It should have looked more like this:

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
fr In[3]:= "Global`f"

In[4]:= Sum[1, {f[x, n], 1, 3}]
Out[4]= 3
In[5]:= ?f
fr In[5]:= "Global`f"
fr In[5]:= f[x, 1] = 3

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

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: Can I do MultipleListPlot with Color?
  • Next by Date: Re: Bug in NSolve?
  • Previous by thread: Bug in Sum causes index variable to remain set?
  • Next by thread: Re: Bug in Sum causes index variable to remain set?