       • To: mathgroup at smc.vnet.net
• Subject: [mg109115] Re: beginner question about syntax
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Mon, 12 Apr 2010 23:04:42 -0400 (EDT)

```a is an atom there is nothing to Map onto. Use

Function[x, x^2][a]

a^2

Map applies the function to each element on the first level of expression:

{a} // FullForm

List[a]

Map[Function[x, x^2], {a}] ==
List[Function[x, x^2][a]]

True

a + b + c // FullForm

Plus[a,b,c]

Map[Function[x, x^2], a + b + c] ==
Plus[
Function[x, x^2][a],
Function[x, x^2][b],
Function[x, x^2][c]]

True

Bob Hanlon

---- AK <aaarbk at googlemail.com> wrote:

=============
Hi,

I'm a fairly seasoned user of another system who's just started using
Mathematica. Although at the moment I'm just playing around with
Mathematica (without any specific task at hand), trying to figure out
the Mathematica way of doing things from the documentation
(particularly the examples) there are some things I can't seem to wrap
my head around. For example, can anyone explain the outputs for the
inputs below:
In:= Map[Function[x, x^2], a]
Out:= a
In:=Map[Function[x, x^2], a + b + c]
Out:= a^2 + b^2 + c^2

If I enclose the second argument of Map[] inside a list, I get the
expected output, but I don't understand what the operations given in
the example above represent and why the outputs are what they are.
Would appreciate an explanation for what's going here... thank you in