NOTE: Please refresh the page if latex code is not converted to text
Topology on any set can be seen as numerous examples in lot of books out there, so I thought lets find out all the possible topological sets possible for any given set.
So, I wrote a small piece of code in Mathematica to see the complete list. And I think it did work appropriately.
I have written it as a module and if you want you can modify it to be a function. There is somewhat helpful for beginners in Mathematica.
Code:
X = {a,b,c} (*Create a list of set*)
T = Subsets[X] (* Find the subsets of set*)
Module[{newlist = List[], inlist = List[], fl1, elements, fele,
semiList = List[], sem = List[], sem1, s, workWith,
selecT}, {Length[T],
For[i = 1, i <= Length[T], i++, {
For[k = 1, k <= Length[T], k++, {
un = Union[T[[i]], T[[k]]], DeleteDuplicates[un],
in = Intersection[T[[i]], T[[k]]], DeleteDuplicates[in],
Print["Elements=", T[[i]], T[[k]], "Union=", un,
"Intersection=", in],
If[TrueQ[MemberQ[T, un]] && TrueQ[MemberQ[T, in]],
{fl1 = Flatten[{un, in}];
elements = fl1,
If[TrueQ[MemberQ[T, DeleteDuplicates[elements]]],
{
AppendTo[inlist, {}],
AppendTo[inlist, DeleteDuplicates[elements]]}, Continue]
},
Continue]}]
{
fele = DeleteDuplicates[inlist];
Print["Topological Set:=", fele],
AppendTo[newlist, fele];
(*Print["final_sublist=",fele],*)
inlist = List[];}
}]
Print[newlist]}]
Output:
When you will run the code in Mathematica, you will see more output in terms of elements under operation which shows how step by step it works but I have removed it considering it trivial. Following are for set {a,b,c} and {a,b,c,d} $\{\\ \{\{\},\{a\},\{b\},\{c\},\{a,b\},\{a,c\},\{b,c\},\{a,b,c\}\},\\ \{\{\},\{a\},\{a,b\},\{a,c\},\{a,b,c\}\},\\ \{\{\},\{b\},\{a,b\},\{b,c\},\{a,b,c\}\},\\ \{\{\},\{c\},\{a,c\},\{b,c\},\{a,b,c\}\},\\ \{\{\},\{a,b\},\{a,b,c\}\},\\ \{\{\},\{a,c\},\{a,b,c\}\},\\ \{\{\},\{b,c\},\{a,b,c\}\},\\ \{\{\},\{a,b,c\}\}\\ \} \\ \\$ $\{\\ \{\{\},\{a\},\{b\},\{c\},\{d\},\{a,b\},\{a,c\},\{a,d\},\{b,c\},\{b,d\},\{c,d\},\{a,b,c\},\{a,b,d\},\{a,c,d\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{a\},\{a,b\},\{a,c\},\{a,d\},\{a,b,c\},\{a,b,d\},\{a,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{b\},\{a,b\},\{b,c\},\{b,d\},\{a,b,c\},\{a,b,d\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{c\},\{a,c\},\{b,c\},\{c,d\},\{a,b,c\},\{a,c,d\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{d\},\{a,d\},\{b,d\},\{c,d\},\{a,b,d\},\{a,c,d\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{a,b\},\{a,b,c\},\{a,b,d\},\{a,b,c,d\}\},\\ \{\{\},\{a,c\},\{a,b,c\},\{a,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{a,d\},\{a,b,d\},\{a,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{b,c\},\{a,b,c\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{b,d\},\{a,b,d\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{c,d\},\{a,c,d\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{a,b,c\},\{a,b,c,d\}\},\\ \{\{\},\{a,b,d\},\{a,b,c,d\}\},\\ \{\{\},\{a,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{a,b,c,d\}\}\\ \} $
Topology on any set can be seen as numerous examples in lot of books out there, so I thought lets find out all the possible topological sets possible for any given set.
So, I wrote a small piece of code in Mathematica to see the complete list. And I think it did work appropriately.
I have written it as a module and if you want you can modify it to be a function. There is somewhat helpful for beginners in Mathematica.
Code:
X = {a,b,c} (*Create a list of set*)
T = Subsets[X] (* Find the subsets of set*)
Module[{newlist = List[], inlist = List[], fl1, elements, fele,
semiList = List[], sem = List[], sem1, s, workWith,
selecT}, {Length[T],
For[i = 1, i <= Length[T], i++, {
For[k = 1, k <= Length[T], k++, {
un = Union[T[[i]], T[[k]]], DeleteDuplicates[un],
in = Intersection[T[[i]], T[[k]]], DeleteDuplicates[in],
Print["Elements=", T[[i]], T[[k]], "Union=", un,
"Intersection=", in],
If[TrueQ[MemberQ[T, un]] && TrueQ[MemberQ[T, in]],
{fl1 = Flatten[{un, in}];
elements = fl1,
If[TrueQ[MemberQ[T, DeleteDuplicates[elements]]],
{
AppendTo[inlist, {}],
AppendTo[inlist, DeleteDuplicates[elements]]}, Continue]
},
Continue]}]
{
fele = DeleteDuplicates[inlist];
Print["Topological Set:=", fele],
AppendTo[newlist, fele];
(*Print["final_sublist=",fele],*)
inlist = List[];}
}]
Print[newlist]}]
Output:
When you will run the code in Mathematica, you will see more output in terms of elements under operation which shows how step by step it works but I have removed it considering it trivial. Following are for set {a,b,c} and {a,b,c,d} $\{\\ \{\{\},\{a\},\{b\},\{c\},\{a,b\},\{a,c\},\{b,c\},\{a,b,c\}\},\\ \{\{\},\{a\},\{a,b\},\{a,c\},\{a,b,c\}\},\\ \{\{\},\{b\},\{a,b\},\{b,c\},\{a,b,c\}\},\\ \{\{\},\{c\},\{a,c\},\{b,c\},\{a,b,c\}\},\\ \{\{\},\{a,b\},\{a,b,c\}\},\\ \{\{\},\{a,c\},\{a,b,c\}\},\\ \{\{\},\{b,c\},\{a,b,c\}\},\\ \{\{\},\{a,b,c\}\}\\ \} \\ \\$ $\{\\ \{\{\},\{a\},\{b\},\{c\},\{d\},\{a,b\},\{a,c\},\{a,d\},\{b,c\},\{b,d\},\{c,d\},\{a,b,c\},\{a,b,d\},\{a,c,d\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{a\},\{a,b\},\{a,c\},\{a,d\},\{a,b,c\},\{a,b,d\},\{a,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{b\},\{a,b\},\{b,c\},\{b,d\},\{a,b,c\},\{a,b,d\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{c\},\{a,c\},\{b,c\},\{c,d\},\{a,b,c\},\{a,c,d\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{d\},\{a,d\},\{b,d\},\{c,d\},\{a,b,d\},\{a,c,d\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{a,b\},\{a,b,c\},\{a,b,d\},\{a,b,c,d\}\},\\ \{\{\},\{a,c\},\{a,b,c\},\{a,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{a,d\},\{a,b,d\},\{a,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{b,c\},\{a,b,c\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{b,d\},\{a,b,d\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{c,d\},\{a,c,d\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{a,b,c\},\{a,b,c,d\}\},\\ \{\{\},\{a,b,d\},\{a,b,c,d\}\},\\ \{\{\},\{a,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{b,c,d\},\{a,b,c,d\}\},\\ \{\{\},\{a,b,c,d\}\}\\ \} $
No comments:
Post a Comment