Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33896] Re: [mg33838] Bug in Sum causes index variable to remain set?
  • From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
  • Date: Sun, 21 Apr 2002 06:14:40 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I don't know whether this is a bug or not, and it seems to me that this 
is just the sort of situation where we lack a clear definition of what 
constitutes a bug (Behaviour undesirable to some users? Unintended 
undesirable behaviour? Easily avoidable undesirable behaviour?). 
However, I can point out that this behaviour is a universal feature of 
Mathematica design in analogous cases. The same thing will happen if you 
replace Sum by Product, Table or Do.  Integrate is not a good example 
because it does not assign values to the variable of integration (it 
just finds the antiderivative and evaluate limits). NIntegrate would 
have been a better example, but it actually also does not make 
assignments to an iterator. So bug or not it seems to be a feature 
(feature!) of  Mathematica"s design, more precisely of the way 
Matheamtica uses iterators.

  Andrzej Kozlowski
Toyama International University
JAPAN
http://platon.c.u-tokyo.ac.jp/andrzej/





On Friday, April 19, 2002, at 03:28  PM, Martin Jenkins wrote:

>
> 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: SurfaceOfRevolution
  • Next by Date: Best possible help to the developers
  • Previous by thread: Re: Bug in Sum causes index variable to remain set?
  • Next by thread: Re: Bug in Sum causes index variable to remain set?