You can load this session from /home/ceng303/maple/sessions as: ch3_1.mw


Session 3.1 Sets and Lists in Maple

> restart;

> uos:={x,y,x};

An unordered set defined by braces "{" and "}"

Note that the elements have to be distinct

uos := {x, y}

> uos[1];uos[2];uos[3];         We can extract elements from the unodered set, but the duplicates are not included.

x

y

Error, invalid subscript selector

> {{a,b},a,{b,b}};  an unordered set can be used as part of an unordered set.

{{a, b}, {b}, a}

> os:=[1,1,3,5];

An ordered set defined by brackets "[" and "]"

os := [1, 1, 3, 5]

> os[2];os[4];

An order exists for this set, therefore the kth expression can be extracted

1

5

> {[1,2,3],4};

The use of brackets within braces

{4, [1, 2, 3]}

> os2:=[{a,b},c,{d,d,d}];

The use of braces within brackets

os2 := [{a, b}, c, {d}]

> os2[3];

{d}

> a1:=[[1,2],[3,4],[5,6]];

This is a set consisting of sets of two numbers.  It can serve as a matrix.

a1 := [[1, 2], [3, 4], [5, 6]]

> a1[2];

Identify the second set in the overall set

[3, 4]

> a1[3][2];

Identify the second element of the third set in the overall set

6

>