c Bo 9780511972942 a 015

download c Bo 9780511972942 a 015

of 27

Transcript of c Bo 9780511972942 a 015

  • 7/26/2019 c Bo 9780511972942 a 015

    1/27

    Cambridge ooks Online

    http://ebooks.cambridge.org/

    Programming with Mathematica

    An Introduction

    Paul Wellin

    Book DOI: http://dx.doi.org/10.1017/CBO9780511972942

    Online ISBN: 9780511972942

    Hardback ISBN: 9781107009462

    Chapter

    3 - Lists pp. 57-82

    Chapter DOI: http://dx.doi.org/10.1017/CBO9780511972942.004

    Cambridge University Press

  • 7/26/2019 c Bo 9780511972942 a 015

    2/27

    3

    ListsStructure and syntax of lists Creating lists Displaying lists Arrays Analyzing lists Testing

    lists Measuring lists Extracting elements of lists Rearranging lists List component

    assignment Working with multiple lists

    Lists are the fundamental data structure used in Mathematica to group objects together. They are

    quite general and they can be used to represent a vast array of objects: vectors, matrices, tensors,

    iterator and parameter specifications, and much more. An extensive set of built-in functions is

    available to manipulate lists in a variety of ways, ranging from simple operations, such as rearrang-

    ing the order of list elements to more sophisticated operations such as partitioning, sorting, or

    applying a function to a list. For example, this sorts a list numerically.

    In[1]:= Sort@84, 16, 1, 77, 23

  • 7/26/2019 c Bo 9780511972942 a 015

    3/27

    Lists are also used to delineate a range of values for some variable or iterator. For example, the

    second argument to the Table function is a list that specifies the iterator variable and the values

    that it should range over.

    In[5]:= TableAi2,8i, 1, 5

  • 7/26/2019 c Bo 9780511972942 a 015

    4/27

    The arguments of the List function (the list elements) can be any type of expression, including

    numbers, symbols, functions, strings, images, and even other lists.

    In[2]:=

    :2.4, Sin, "ossifrage", ,

    85, 3