Re: Just another Mathematica "Gotcha"
- To: mathgroup at smc.vnet.net
- Subject: [mg120795] Re: Just another Mathematica "Gotcha"
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Thu, 11 Aug 2011 05:09:31 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <j1r5d3$fi4$1@smc.vnet.net> <201108101049.GAA26342@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
AES failed to take into account the precedence of operators??
Bobby
On Wed, 10 Aug 2011 05:49:57 -0500, Kevin J. McCann <kjm at kevinmccann.com>
wrote:
> I think that in the first, Mathematica is applying your rule to Normal,
> not to
> the output. Put parens around it (Series ...//Normal)/.b2->0 and it
> works.
>
> Kevin
>
> On 8/9/2011 7:24 AM, 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 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
>>
>
--
DrMajorBob at yahoo.com
- References:
- Re: Just another Mathematica "Gotcha"
- From: "Kevin J. McCann" <kjm@KevinMcCann.com>
- Re: Just another Mathematica "Gotcha"