Mathematica Creating Simple Arrays in Mathematica for Beginners

  • Thread starter Thread starter nezse
  • Start date Start date
  • Tags Tags
    Array Mathematica
AI Thread Summary
To create a simple array in Mathematica from a list, the user can utilize the Transpose function combined with Most and Rest functions. Given the list {a, b, c, d}, the desired array format is achieved by executing Transpose[{Most[lst], Rest[lst]}], resulting in {{a, b}, {b, c}, {c, d}}. This method effectively pairs adjacent elements from the original list into sublists. The solution is straightforward for beginners looking to manipulate lists in Mathematica. Understanding these functions can enhance array creation skills in Mathematica.
nezse
Messages
7
Reaction score
0
Hello,
I have a list {a,b,c,d}
and i want a array of the form:
{{a,b},{b,c},{c,d}}
I think it is easy, but I'm new in mathematica and I don't know what funtion to use.
Thanks.
 
Physics news on Phys.org
lst={a,b,c,d};
Transpose[{Most[lst],Rest[lst]}]
 
Thanks!
 

Similar threads

Replies
1
Views
2K
Replies
4
Views
3K
Replies
5
Views
2K
Replies
5
Views
3K
Replies
23
Views
3K
Back
Top