MathGroup Archive 2013

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

Search the Archive

Re: Map

  • To: mathgroup at
  • Subject: [mg130915] Re: Map
  • From: Bill Rowe <readnews at>
  • Date: Sat, 25 May 2013 05:38:59 -0400 (EDT)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:

On 5/24/13 at 6:25 AM, djpmorris at (Jon Morris) wrote:

>I'm new to Mathematica and I've been given some code to help me
>analyse some data. I'm trying to understand what the Map function
>does, specifically what the {2,2} means?

>qbarlist = Map[(# - bragg) &, hkllist,{2, 2}];

>hklist is a 3 column list, bragg is a three element vector.

>When I try the same line with {2} or {1} I seem to get the same
>answer. The online explanation of this term does not make that much
>sense to me. I'd be very grateful if someone could explain the
>purpose of the last term of the Map syntax.

The {2,2} refers to the level of hklist to map the function
(#-bragg)& onto

In the form {n,m} Mathematica will map the specified function to
levels n through m. In the form {n} Mathematica will map the
specified function at level n only. So, using {n,n} is exactly
equivalent to {n}.

You can get more information about levels in expressions by
searching on Level in the Documentation Center. And if you do
so, don't fail to scroll down to the bottom of the page returned
to find two tutorials that give more details.

  • Prev by Date: Re: Reduce an expression into a given form.
  • Next by Date: insert graph
  • Previous by thread: Re: Map
  • Next by thread: Re: Map