Mathematica - turning two lists into an array

AI Thread Summary
To convert two lists into an array format in Mathematica, the function Transpose can be used effectively. By applying Transpose to a nested list structure, such as {{a1, a2, a3}, {b1, b2, b3}}, the desired output of {{a1, b1}, {a2, b2}, {a3, b3}} is achieved. The alternative method mentioned, Riffle, does not produce the required format. Users seeking to manipulate list structures in Mathematica can rely on these functions for efficient results. This approach simplifies the process of pairing elements from two separate lists.
tomrob123
Messages
1
Reaction score
0
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
 
Physics news on Phys.org
Hi,
Maybe this:
Transpose[{{a1, a2, a3}, {b1, b2, b3}}]
 
Equivalently, {{a1, a2, a3}, {b1, b2, b3}}TR. (The transpose symbol comes from hitting Esc, tr, Esc.)
 
Back
Top