Message Boards Message Boards

[WSS16] Explorations for basic skills in elementary set theory

This is an idea to teach set theory from a perspective of computational thinking (as S. Wolfram defines it), basic programming, and concepts of set theory. In order to make the computer-based approach, a sufficient introduction to the Wolfram Language vocabulary and syntax is mandatory; therefore I should introduce both mathematical and Wolfram Language concepts.

One could start with the concept of what a set is and discuss how it can be implemented via lists (they are slightly different, sets may be infinite, don't have a particular order and no repetitions are allowed). After this, constructs like ConstantArray, Range and Table can be introduced, also the Data* functions (like MovieData**, etc), and entity lists (just as ways to get sets from the Wolfram Language). Something like

Table[{ElementData[z, "Name"], ElementData[z, "AtomicMass"]}, {z, 10}]

After sets, introduce subsets, Part (in all its different forms) can be discussed as a tool to get subsets from big lists. Manipulates showing how indexing work could be useful.

Manipulate[
 list = {Style["list", Blue, Bold], {"3", "{9,8}", "\[Pi]", "dog", 
     "cars"}} // Flatten;
 positive = {Style["index", Bold], 
    ReplacePart[{1, 2, 3, 4, 5}, i -> Style[i, Bold]]} // Flatten; 
 negative = {Style["negative", Bold], 
    ReplacePart[{-5, -4, -3, -2, -1}, 
     i -> Style[{-5, -4, -3, -2, -1}[[i]], Bold]]} // Flatten;
 Column[{Grid[
    {positive, negative,
     list}, Alignment -> Center, 
    Dividers -> {All, {1 -> Black, 3 -> Black, 4 -> Black}}],
   Style["list[[" <> ToString[i] <> "]] = " <> 
     ToString[Rest[list][[i]]], Large]}, Alignment -> Center],
 {{i, 1, "index"}, {1, 2, 3, 4, 5}}, ControlType -> Setter]

enter image description here

I think this is a good place to introduce the Select function (as a way to get subsets from other lists) and the idea of criteria (actually pure functions and *Q functions), a good objective to aim for can be things like

Select[data, 20 <= # <= 30 &]

SubsetQ can also be discussed here.

The properties of a set also have equivalent concepts on the Wolfram Language. Cardinality (Length) and equality (==) are examples. Since I would be talking about properties I would introduce the syntax of expressions on the Wolfram Language, explaining Head and FullForm would be justified if one uses the Cases or the Position functions to ask questions from lists. The learning objective for the student could be something like

Cases[{{1, 2, 3}, 3, {9, 8}, \[Pi], 1, "cars", {8, 9.}}, {_, _}]

or

 Cases[{{1, 2, 3}, 3, {9, 8}, \[Pi], 1, "cars", {8, 9.}}, _Symbol]

obviously, blank (_) should be discussed

Finally, one could go on to work with operations on and between sets. Union, Intersection, Complement, adding (subtracting, multiplying, dividing) by a number or two lists are examples of operations. Total, Accumulate, Max, Min and Apply can also be introduced.

POSTED BY: Jorge Villalobos
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract