Chapter 2 - Maple Basics

2.12 Lists, Sets, Sequences and Maps

A list is a sequence of expressions enclosed in square brackets. The ordering of the expressions is the ordering of the items in [,,,].

A set is a sequence of distinct expressions enclosed in braces, representing a set in the mathematical sense. The items in {,,,} are ordered and duplications are eliminated. In general, object ordering is first determined by quickly identifiable features like its size. For instance {bb,aaaaa} will be considered ordered.

The Maple command seq(expression,variable=range) generates a sequence of items according to the pattern implied in the expression, e.g., i^2 or f(i). The generated sequence can be assigned to a variable, in which case the various items in the sequence can be extracted via an array notation, e.g., "name[i]" to extract the ith items.

A sequence generated by seq(,) can be placed in [] or {} to form either a list or a set. This list or this set can be assigned to a variable.

The Maple command map(function,list) distributes the application of a function f(x) over a list or a set of arguments.

The seq(,) command can be very handy in generating plots of multiple functions characterized by an index.

The seq(,) command can also help generating sequences of plots as shown below. The plot structures can be stored in a variable and displayed via the command "plots[display]()". The latter is the "display()" command in the "plots" library. The statement with(plots); loads this library in memory. If the statement is terminated with; this command will display the content of the library; terminating the statement with : will turn this listing off.

The following worksheet illustrates a graph made out of straight lines joining points in a plane. In this case the plot() command accepts a list of points, each one specified by a list of two items, the x- and y- coordinates of each point. The seq(,) command can help generating such a list of points.

  Section 2.11 Chapter 2 Exercises       TOC

Any questions or suggestions should be directed to
Michel Vallieres at vallieres@physics.drexel.edu