Week 4
Assignment #5
Feb.11 (Wednesday) -- end of day
Email me a link to your program (stored on class web space) that accepts as input any two sets (A and B) and outputs
- their union A∪B
- their intersection A∩B
- their symmetric difference
- the truth or falsity of the statements A⊂B and B⊂A.
- A - B
- B - A
Unicode chart for many mathematical symbols
Math
Tuples, relations, strings, graphs, trees, operations.
Some definitions (extra credit if you can find differences between these definitions and those in the book)
A n-tuple is an element of the Cartesian product of n sets (typically those n sets may all be the same).
A string is an n-tuple over the same finite set: an ordered sequence of characters from a finite set called an alphabet.
A relation is a subset of the Cartesian product of a collection of sets. If the relation is defined over n sets then it is called n-ary.
A graph is a binary relation which is symmetric and antireflexive.
drawing program for graphs (must use IE) (though here is one for other browsers)
(exercise: using mathematical symbols contained in the alphabet and , define antireflexive)
A function is a binary relation f on a set S, such that if a, b, c ∈S and
f(a,b) and f(a,c), then necessarily c=b.
If f(a,b), we will generally write the function as f(a)→b since a function f
affiliates with each element in the "domain" (the first element, in this case
a), one unique element. We may, clearly, extend the definition of functions to
multinary relations by stating that if f(x1,x2,x3,...xn)→a
and f(x1,x2,x3,...xn)→b then a=b.
See also the discussion of partial functions in wikipedia.
A (binary) operation is a ternary (tri-nary) relation, ⊗, that associates with each ordered pair (a,b) ∈ S x S, a unique element c. It is, thus, a function that takes two inputs and yields one (consistent) output.
Exercise: Show that addition modulo four and multiplication on the four roots of unity are different (non-isomorphic) operations on a set of four elements.
JavaScript
starting on assignment #5 --
using uniq, concat, sort, splice, push, etc. to define union, intersection, difference, subset, etc.