Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Mathematica - turning two lists into an array

  1. Mar 9, 2009 #1
    Hi

    I need to turn two lists in the form {a1,a2,a3...} {b1,b2,b3...}
    into {{a1,b1},{a2,b2},{a3,b3}..}

    I've looked everywhere on the Wolfram website and the best i found was:

    Riffle[{list1},{list2}] which gives me {a1,b1,a2,b2,a3,b3}

    does anyone know the function to use?

    Thanks
     
  2. jcsd
  3. Mar 27, 2011 #2
    Hi,
    Maybe this:
    Transpose[{{a1, a2, a3}, {b1, b2, b3}}]
     
  4. Mar 27, 2011 #3

    Mapes

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Equivalently, {{a1, a2, a3}, {b1, b2, b3}}TR. (The transpose symbol comes from hitting Esc, tr, Esc.)
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook