Re: Just another Mathematica "Gotcha"
- To: mathgroup at smc.vnet.net
- Subject: [mg120864] Re: Just another Mathematica "Gotcha"
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Sat, 13 Aug 2011 06:49:38 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201108120905.FAA17157@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
The statement behavior is NO different from that of a + b * c where * has higher precedence than +. a = Series, b = Normal, c = {b2 -> 0}, // replaced by +, and /. replaced by *, and the two statements are identical. a + b*c /. {a -> Series, b -> Normal, c -> {b2 -> 0}, Times -> Replace, Plus -> PostFix} PostFix[Series, Normal] Some found it confusing that Normal /. {b2 -> 0} evaluates to Normal... but the same thing happens in b * c if c == 1. a + b*c /. c -> 1 a + b Bobby On Fri, 12 Aug 2011 04:05:46 -0500, gac <g.crlsn at gmail.com> wrote: > I think I see. If I compare your output with that for the other form: > > In[1]:= FullForm[Hold[ > Series[a + (b1 + b2) x, {x, 0, 1}] /. {b2 -> 0} // Normal]] > > Out[1]/FullForm= > Hold[Normal[ReplaceAll[Series[Plus[a,Times[Plus[b1,b2],x]],List[x,0,1]],List[Rule[b2,0]]]]] > > Normal acts only after ReplaceAll applies the List to the Series, yes? > > Someone suggested only using //-type operations at the end of statement, > e.g., // Normal, // MatrixForm, // TraditionalForm, etc. I think this > is a good idea. I've been doing this without having a good reason > (except that "form follows function" ^_^ ). Now, it seems that I have a > stronger reason. > > Thanks. > > Glenn > -- DrMajorBob at yahoo.com
- References:
- Re: Just another Mathematica "Gotcha"
- From: gac <g.crlsn@gmail.com>
- Re: Just another Mathematica "Gotcha"