Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

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

Search the Archive

Re: Changing a list with the information of other

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131425] Re: Changing a list with the information of other
  • From: Themis Matsoukas <tmatsoukas at me.com>
  • Date: Wed, 3 Jul 2013 22:04:02 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net

Here is one way:

a = {{0, 1}, {1, w}, {2, 1 + w}, {3, 1 + 2 w}, {4, 2}, {5, 2 w}, {6, 
    2 + 2 w}, {7, 2 + w}};
b = {1, 1 + w, 2 + w, 2 w, 2, 2 + 2 w, 1 + 2 w, w};

Apply[#1 &, 
 Flatten[Table[Select[a, #[[2]] == b[[i]] &, 2], {i, 1, b // Length}],
   1], 1]

{0, 2, 7, 5, 4, 6, 3, 1}



  • Prev by Date: Re: Calculating derivate in Mathematica 9 giving wrong result
  • Next by Date: Re: Animate Command and Vector Reference
  • Previous by thread: Re: Changing a list with the information of other
  • Next by thread: files