Wolfram ResearchProductsPurchasingServices & ResourcesAbout UsOur Sites

Work with Lists in Mathematica

The Table function allows you to create lists of data into recognizable patterns effortlessly. Once the data is captured into a list, Mathematica's other functions allow for easy data manipulation.

An Easy Example

In the following example, you create a list of sin(x) evaluated from 0 to 6 pi in intervals of pi/2.

[Graphics:Images/index2_gr_63.gif]
[Graphics:Images/index2_gr_64.gif]

You can also create two-dimensional lists, allowing you to keep records of ordered pairs.

[Graphics:Images/index2_gr_65.gif]
[Graphics:Images/index2_gr_66.gif]


Formatting Your Lists

To view this list as a table, use the TableForm command. In this example, % refers to the most recently evaluated results.

[Graphics:Images/index2_gr_67.gif]
0  1
1  e
2 [Graphics:Images/index2_gr_68.gif]
3 [Graphics:Images/index2_gr_69.gif]
4 [Graphics:Images/index2_gr_70.gif]
5 [Graphics:Images/index2_gr_71.gif]

Extracting Results

There are many ways of extracting information or specifying parts of the lists you have created. Examples using the Extract and Part commands can be seen below.

[Graphics:Images/index2_gr_72.gif]
[Graphics:Images/index2_gr_73.gif]
[Graphics:Images/index2_gr_74.gif]
[Graphics:Images/index2_gr_75.gif]

You can specify the Part function one of two ways, both of which are illustrated in the following example.

[Graphics:Images/index2_gr_76.gif]
[Graphics:Images/index2_gr_77.gif]


 © 2008 Wolfram Research, Inc.  Terms of Use  Privacy Policy | [ja] |
Sign up for our newsletter: