MathGroup Archive 2011

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

Search the Archive

Re: Just another Mathematica "Gotcha"

  • To: mathgroup at
  • Subject: [mg120780] Re: Just another Mathematica "Gotcha"
  • From: David Bailey <dave at>
  • Date: Wed, 10 Aug 2011 06:44:45 -0400 (EDT)
  • Delivered-to:
  • References: <j1r5d3$fi4$>

On 09/08/2011 12:24, AES wrote:
> Seems as if the following two expression should yield the same output
> -- seems that way to me anyway -- but they don't.  I'll hide the
> actual outputs down below so Mathematica gurus (or "ordinary users")
> can make their predictions as to which one does what.
> In[1]:= Series[a+(b1+b2)x,{x,0,1}] //Normal /.{b2->0}
> In[2]:= Series[a+(b1+b2)x,{x,0,1}] /.{b2->0} //Normal
My conclusion is that you have simply ignored the precedence of the 
various operators:



I don't know how you think the Mathematica language should be changed to 
avoid mistakes of this sort, but of course, you do not need to use a 
single operator in your code if you prefer!

David Bailey

  • Prev by Date: Re: More robust pattern based replacement rules?
  • Next by Date: Re: Just another Mathematica "Gotcha"
  • Previous by thread: Re: Just another Mathematica "Gotcha"
  • Next by thread: Re: Just another Mathematica "Gotcha"