MathGroup Archive 2000

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

Search the Archive

Re: Applying position-dependent functions on lists.

  • To: mathgroup at
  • Subject: [mg23238] Re: Applying position-dependent functions on lists.
  • From: Jens-Peer Kuska <kuska at>
  • Date: Sat, 29 Apr 2000 22:04:47 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <8e0n0l$>
  • Sender: owner-wri-mathgroup at


MapIndexed may help you because


"MapIndexed[f, expr] applies f to the elements of expr, giving the part
specification of each element as a second argument to f. MapIndexed[f,
expr, \
levspec] applies f to all parts of expr on levels specified by levspec."


MapIndexed[(pos=First[2];elem=#1; doSomethingWithPosAndElem)

willgive you the positions.

Hope that helps

Manolis Petrakis wrote:
> Hi there
> I'm trying to write a program for solving the 2-D Ising model, but not using
> the standard Do[...] approach, to modify every spin on a spin list, using
> the Metropolis Function.
> This problem can be generalized if anyone wants to apply functions on
> matrices that depend on element positions, and require the values of nearest
> neighbor elements.
> If anyone understands my problem, i will be glad to receive any suggestion.
> -----------------------------
> Manolis Petrakis,
> University of Crete, Greece,
> Physics Dept.

  • Prev by Date: Periodic continued fractions -- suggestions wanted
  • Next by Date: Re: Please help with a Hypergeometric2F1 problem...
  • Previous by thread: Applying position-dependent functions on lists.
  • Next by thread: Re: Applying position-dependent functions on lists.