       Re: Just another Mathematica "Gotcha"

• To: mathgroup at smc.vnet.net
• Subject: [mg120820] Re: Just another Mathematica "Gotcha"
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Thu, 11 Aug 2011 07:55:11 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <201108110912.FAA07274@smc.vnet.net>

```On 11 Aug 2011, at 11:12, Glenn Carlson wrote:

> It seems not simply a matter of operator precedence since  evaluates to neither  nor .
>
> In:= Series[a + (b1 + b2) x, {x, 0, 1}];
> % // Normal;
> % /. {b2 -> 0}
>
> Out:= a+b1 x
>
> In:= Series[a + (b1 + b2) x, {x, 0, 1}];
> % /. {b2 -> 0};
> % // Normal
>
> Out:= a+b1 x
>
> In:= Series[a + (b1 + b2) x, {x, 0, 1}] // Normal /. {b2 -> 0}
>
> Out:= a + (b1+b2) x
>

Just put in the parentheses and you will see all the possible outcomes:

In:= Series[a + (b1 + b2) x, {x, 0, 1}] // (Normal /. {b2 -> 0})

Out= a+x (b1+b2)

In:= (Series[a + (b1 + b2) x, {x, 0, 1}] // Normal) /. {b2 -> 0}

Out= a+b1 x

I wonder when they stopped teaching about parentheses in primary schools.

Andrzej Kozlowski

```

• Prev by Date: Re: NMinimize fails to find a minimum value
• Next by Date: Re: How does Clear["Global`*"] work?
• Previous by thread: Re: Just another Mathematica "Gotcha"
• Next by thread: Re: Just another Mathematica "Gotcha"