Re: Just another Mathematica "Gotcha"
- To: mathgroup at smc.vnet.net
- Subject: [mg120787] Re: Just another Mathematica "Gotcha"
- From: James Stein <mathgroup at stein.org>
- Date: Wed, 10 Aug 2011 06:46:02 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201108091119.HAA15770@smc.vnet.net>
By normal rules or ordinary interpretations, one does not expect these two expressions to evaluate to each other: h(g(f(y,z))) g[h(f(y,z))) If you accept a slight abuse of notation, the above pair is equivalent to following pair: f(y,z) // g // h f(y,z) // h // g which are pretty much what what you have written (where 'f' is 'Series', 'g' is 'Normal', and 'h' is 'ReplaceAll', etc.). On Tue, Aug 9, 2011 at 4:19 AM, AES <siegman at stanford.edu> 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 conclusions: > > 1) By any normal rules of interpretation or ordinary interpretations > of these statements, they both should do the same same thing. > > 2) This is just another Mathematica "Gotcha" -- and not a > particularly forgivable one. > > > > > > > > > > > > > > > > Out[1]= a+(b1+b2) x > > Out[2]= a+b1 x > >
- References:
- Just another Mathematica "Gotcha"
- From: AES <siegman@stanford.edu>
- Just another Mathematica "Gotcha"