2 List Creation and Manipulation: Vectors and Matrices

2.1 Introduction

A list is an object that is composed of a collection of other objects: expressions, numbers, arrays, graphical entities, and just about any legitimate Mathematica quantity. A pair of open/closed braces {…} encloses the list. Each element of the list is separated by a comma: {…, …, …}. In addition, each element of a list can itself be a list. There are effectively no size restrictions on the number of elements that a list can contain. In addition, about 40% of Mathematica’s functions can operate on lists. In this chapter, we shall concentrate on the construction of lists and on the operations to these lists that are most useful in obtaining solutions to engineering applications. Consequently, it will be seen that a list whose elements are numerical values or variable names and do not contain any other lists can be considered a vector and those lists whose elements are themselves lists of numerical values or variable names meeting certain size requirements can be considered matrices. A summary of several list creation and manipulation commands is shown in Table 2.1 and a summary of several matrix creation and manipulation commands are presented in Tables 2.2 and 2.3. The application of many of these commands will be illustrated in the sections that follow.

2.2 Creating Lists and Vectors

2.2.1 Introduction

A list of numerical values is created by entering


c={1.,3.,5.,7.,9.}

which is a five-element vector. ...

Get An Engineer's Guide to Mathematica now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.