MathGroup Archive 2005

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

Search the Archive

Re: Confusing results with N[expr]?


In the following code, just put parenthesis around a^b and you get the
good result.  

f/@ a^b is the same as Map[f,a]^b (and Map[f,a]=a)
f/@(a^b) is the same as Map[f,a^b]

/@ has precedence over ^.

GL

On Tue, 22 Nov 2005 09:44:25 +0000 (UTC), Steven HANCOCK
<Steven.Hancock at cern.ch> wrote:

>There may be a clue in the following, equally distressing nonsense...
>
>In[1]:=
>$Version
>
>Out[1]=
>5.1 for Microsoft Windows (October 25, 2004)
>
>(* Map[f, expr] or f /@ expr applies f to each element on the first 
>level in expr. *)
>
>In[2]:=
>Map[f, a^b]
>
>Out[2]=
>     f[b]
>f[a]
>
>In[3]:=
>f /@ a^b
>
>Out[3]=
>  b
>a
>


  • Prev by Date: Re: Boolean Integral
  • Next by Date: Re: Re: Confusing results with N[expr]?
  • Previous by thread: Re: Confusing results with N[expr]?
  • Next by thread: Re: Confusing results with N[expr]?