Creating Simple Arrays in Mathematica for Beginners

  • Context: Mathematica 
  • Thread starter Thread starter nezse
  • Start date Start date
  • Tags Tags
    Array Mathematica
Click For Summary
SUMMARY

The discussion focuses on creating simple arrays in Mathematica, specifically transforming a list into a desired array format. The user starts with a list {a,b,c,d} and seeks to create an array {{a,b},{b,c},{c,d}}. The solution provided utilizes the functions Transpose, Most, and Rest to achieve this transformation efficiently. The final code snippet is: Transpose[{Most[lst],Rest[lst]}].

PREREQUISITES
  • Basic understanding of Mathematica syntax and functions
  • Familiarity with list manipulation in Mathematica
  • Knowledge of array structures and their representation in Mathematica
  • Experience with functional programming concepts
NEXT STEPS
  • Explore advanced list manipulation techniques in Mathematica
  • Learn about the use of the Map function for array transformations
  • Investigate the use of Nest and Fold functions for more complex data structures
  • Study the documentation for Mathematica's built-in array functions
USEFUL FOR

Beginners in Mathematica, educators teaching programming concepts, and anyone interested in data manipulation within 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 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 23 ·
Replies
23
Views
3K