Representing sets

Introduction

This Mathematica notebook is licensed under a MouseOver 
It creates the demonstrations used in my post Representing Sets.

I hope anyone interested will feel free to improve this work and to use it in their own publications and coursework.

Initial definitions

StringJoin["{","a b c", "}"]

Union[{b,c,c,a}]

Grid[{Union[{3,1,5,3,4,7,7,6}]}]

sty[list_]:=Framed[Style[list,Medium, 12, FontFamily->"Arial",Background->White]]

showset[list_]:=sty[Grid[{Union[list]}]]

showset[{3,1,5,3,4,7,7,6}]

addtoset[s_,n_]:=showset[s~Union~{n}]

addtoset[{5,2,1},3]

addtoset[{},3]

Show set

Manipulate[
If[b=="empty",(s={};showset[s]),(s=s~Union~{b};showset[s])],
{{b,"empty",""},{"empty",1,2,3},ControlType->RadioButtonBar},
ControlPlacement->Bottom,
Paneled->False(*SaveDefinitions->True*)
]

addo[s0_,n0_]:=Module[{s=s0,n=n0},If[n=="empty",(s:={};showset[s]),(s:=s~Union~{n};showset[s])]]

addo[{1},"2"]

Manipulate[
If[b=="empty",(s={};showset[s]),(s=s~Union~{b};showset[s])],
{{b,"empty",""},{"empty",1,2,3,4,5,6,7,8,9},ControlType->RadioButtonBar},
ControlPlacement->Bottom,
Paneled->False,SaveDefinitions->True
]

Set hangers

Definitions

preop[x_,loc_]:=Text[Framed[Style[x,Medium,FontFamily->"Arial"],Background->White],loc]

preop["x",{0,1}]

Framed[Style[42555,Medium,FontFamily->"Arial"],ImageSize->45,FrameStyle->{{{Green,Red},{Blue,Black}}},Background->White]

fixedop[x_,loc_,width_]:=Text[Framed[Style[x,Medium,FontFamily->"Arial"],ImageSize->width,Background->White],loc]

fixedop[3.13,{0,0},100]

op[x_,loc_]:=preop[x,loc];op[x_,loc_,width_]:=fixedop[x,loc,width]

lab[x_,loc_]:=Text[Style[x,Small,FontFamily->"Arial",Background->White],loc]

edge[op1_,op2_,sf_]:=Arrow[{op1,op2},Scaled[sf]]

edge[op1_,op2_]:=edge[op1,op2,0]

ledge[op1_,op2_,label_]:=Sequence[edge[op1,op2],lab[label,.5(op1+op2)]]

fixedop[{Style["Power\n",LineSpacing->{0,1}],PaddedForm[255,4]}//TableForm,{0,0},50]

fixedop[x_,loc_,width_]:=Text[Framed[Style[x,Medium,FontFamily->"Arial"],ImageSize->width,Background->White],loc]

M=Style[(({{1, 2}, {0, 1}}))//MatrixForm,Small]

M//TeXForm

reals=ℝ

Manipulate[
Show[
Graphics[
{Arrowheads[0],
edge[{0,0},p],
edge[{0,0},q],
edge[{0,0},r],
edge[{0,0},t],
op["S",{0,0}],
op[3,p],
op[reals,q],
op[∅,r] ,
op[M,t]
},
ImageSize->300, AspectRatio->5/8, PlotRange->{{-4,4},{-2,1}}
]
],{{p,{-2,-1}},Locator,Appearance->None},{{q,{-2/3,-1}},Locator,Appearance->None},{{r,{2/3,-1}},Locator,Appearance->None},{{t,{2,-1}},Locator,Appearance->None},Paneled->False,SaveDefinitions->True
]