(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 12.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 11760, 288] NotebookOptionsPosition[ 11233, 271] NotebookOutlinePosition[ 11577, 286] CellTagsIndexPosition[ 11534, 283] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[TextData[{ StyleBox["Minimal distance between two clusters in", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontSize->14, FontColor->RGBColor[1, 0, 0]], Cell[BoxData[ SuperscriptBox["\[DoubleStruckCapitalR]", "2"]], CellChangeTimes->{{3.7311239388490767`*^9, 3.7311241887665453`*^9}, { 3.731124262852821*^9, 3.7311242818390455`*^9}, {3.731124334688675*^9, 3.7311243931480875`*^9}, {3.731124464437002*^9, 3.7311245820590296`*^9}, { 3.731124626641944*^9, 3.7311246685996666`*^9}, 3.73112478187739*^9, 3.7311249716632557`*^9, 3.731125008229858*^9, {3.731131363164089*^9, 3.7311315307912507`*^9}, {3.8106047626816826`*^9, 3.810604763185858*^9}, { 3.810606445967278*^9, 3.810606530225013*^9}, {3.810606641466092*^9, 3.810606684833495*^9}, {3.810606749868683*^9, 3.810606752984932*^9}, { 3.8106068274532113`*^9, 3.810606866094061*^9}, {3.810606901083395*^9, 3.810607019637113*^9}, {3.810607054277118*^9, 3.8106071829172134`*^9}, { 3.8106072199097958`*^9, 3.8106072546405845`*^9}, 3.8106074697262*^9, { 3.8131282699269085`*^9, 3.813128270182798*^9}, {3.8131283217992973`*^9, 3.8131283433443713`*^9}, {3.8131285602764816`*^9, 3.813128631734671*^9}, { 3.813128716159551*^9, 3.8131287310664387`*^9}, {3.813128829720832*^9, 3.8131288437367177`*^9}, {3.8131288968861256`*^9, 3.8131288976456766`*^9}, {3.8208206004327154`*^9, 3.820820602339464*^9}, { 3.8208232348027654`*^9, 3.820823235970901*^9}, {3.8210126257677174`*^9, 3.8210126431522183`*^9}, {3.8210126931585455`*^9, 3.8210127495586214`*^9}, {3.82227632906433*^9, 3.8222763387744713`*^9}, { 3.822286682657259*^9, 3.8222866948935103`*^9}}, FontSize->14, FontColor->RGBColor[1, 0, 0],ExpressionUUID-> "b405b989-b86c-4869-9bf5-34818f113848"] }], "Subsubsection", CellChangeTimes->{{3.73112424028771*^9, 3.7311242546173754`*^9}, { 3.8106047392458076`*^9, 3.8106047456549196`*^9}, {3.8131286886441045`*^9, 3.8131286920600576`*^9}, 3.8210125983161287`*^9, 3.8210128058509197`*^9, { 3.837309634726879*^9, 3.837309689749876*^9}, {3.837309767846963*^9, 3.837309768116458*^9}},ExpressionUUID->"6d67d834-ea21-456d-860e-\ 89283b2a0226"], Cell[BoxData[{ RowBox[{ RowBox[{ StyleBox["Input", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], " ", RowBox[{ "skup", " ", "to\[CHacek]aka", " ", "klastera", " ", "\[Pi]j", " ", "koje", " ", "ripadaju", " ", "ellipsoidu", " ", "E", " ", "p", " ", RowBox[{"(", RowBox[{"c", "?", "j"}], ")"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ StyleBox["Output", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], " ", RowBox[{ "Minimal", " ", "distance", " ", "between", " ", "two", " ", "clusters", " ", "of", " ", "the", " ", "partition", " ", "\[CapitalPi]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ StyleBox["Submodules", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], " ", RowBox[{"MinEl", "[", "]"}]}], " "}], "\[IndentingNewLine]"}], "Text", CellChangeTimes->{{3.7311239388490767`*^9, 3.7311241887665453`*^9}, { 3.731124262852821*^9, 3.7311242818390455`*^9}, {3.731124334688675*^9, 3.7311243931480875`*^9}, {3.731124464437002*^9, 3.7311245820590296`*^9}, { 3.731124626641944*^9, 3.7311246685996666`*^9}, 3.73112478187739*^9, 3.7311249716632557`*^9, 3.731125008229858*^9, {3.731131363164089*^9, 3.7311315307912507`*^9}, {3.8106047626816826`*^9, 3.810604763185858*^9}, { 3.810606445967278*^9, 3.810606530225013*^9}, {3.810606641466092*^9, 3.810606684833495*^9}, {3.810606749868683*^9, 3.810606752984932*^9}, { 3.8106068274532113`*^9, 3.810606866094061*^9}, {3.810606901083395*^9, 3.810607019637113*^9}, {3.810607054277118*^9, 3.8106071829172134`*^9}, { 3.8106072199097958`*^9, 3.8106072546405845`*^9}, 3.8106074697262*^9, { 3.8131282699269085`*^9, 3.813128270182798*^9}, {3.8131283217992973`*^9, 3.8131283433443713`*^9}, {3.8131285602764816`*^9, 3.813128631734671*^9}, { 3.813128716159551*^9, 3.8131287310664387`*^9}, {3.813128829720832*^9, 3.8131288437367177`*^9}, {3.8131288968861256`*^9, 3.8131288976456766`*^9}, {3.8208206004327154`*^9, 3.820820602339464*^9}, { 3.8208232348027654`*^9, 3.820823235970901*^9}, {3.8210126257677174`*^9, 3.8210126431522183`*^9}, {3.8210126931585455`*^9, 3.8210127495586214`*^9}, {3.82227632906433*^9, 3.8222763387744713`*^9}, { 3.822286682657259*^9, 3.8222866948935103`*^9}, {3.8373094399726963`*^9, 3.837309515995839*^9}, {3.837309563402701*^9, 3.837309608937623*^9}}, FontSize->12, FontColor->RGBColor[ 0, 0, 1],ExpressionUUID->"1169044d-e1d9-4ece-b092-630663468e3f"], Cell[BoxData[{ RowBox[{"Clear", "[", StyleBox["MDInd2", FontColor->RGBColor[1, 0, 0]], "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MDInd2", "[", "Mdisk_", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"k", "=", RowBox[{"Length", "[", "Mdisk", "]"}]}], ",", "DDD", ",", "konv", ",", "poly", ",", "dist", ",", "minPts"}], "}"}], ",", " ", "\[IndentingNewLine]", "\t\t\t\t\t\t", RowBox[{"(*", " ", RowBox[{"Convex", " ", "Hull"}], " ", "*)"}], "\t\t\t ", "\[IndentingNewLine]", RowBox[{ RowBox[{"konv", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"ConvexHull", "[", RowBox[{"Mdisk", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", RowBox[{"Length", "[", "Mdisk", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"poly", "[", "j", "]"}], "=", RowBox[{"Polygon", "[", RowBox[{"Mdisk", "[", RowBox[{"[", RowBox[{"j", ",", RowBox[{"konv", "[", RowBox[{"[", "j", "]"}], "]"}]}], "]"}], "]"}], "]"}]}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"j", ",", RowBox[{"Length", "[", "Mdisk", "]"}]}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"pol", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"poly", "[", "j", "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"DDD", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"r", ",", RowBox[{"Length", "[", "Mdisk", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", "Mdisk", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{"(*", " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"RegionDimension", "[", RowBox[{"RegionIntersection", "[", RowBox[{ RowBox[{"poly", "[", "r", "]"}], ",", RowBox[{"poly", "[", "s", "]"}]}], "]"}], "]"}], "\[Equal]", "2"}], ",", RowBox[{ RowBox[{"DDD", "[", RowBox[{"[", RowBox[{"r", ",", "s"}], "]"}], "]"}], "=", "0"}], ",", RowBox[{ RowBox[{"DDD", "[", RowBox[{"[", RowBox[{"r", ",", "s"}], "]"}], "]"}], "=", RowBox[{"Dmin", "[", RowBox[{ RowBox[{"Mdisk", "[", RowBox[{"[", RowBox[{"r", ",", RowBox[{"konv", "[", RowBox[{"[", "r", "]"}], "]"}]}], "]"}], "]"}], ",", RowBox[{"Mdisk", "[", RowBox[{"[", RowBox[{"s", ",", RowBox[{"konv", "[", RowBox[{"[", "s", "]"}], "]"}]}], "]"}], "]"}]}], "]"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"\[ScriptCapitalR]", "=", RowBox[{"RegionIntersection", "[", RowBox[{ RowBox[{"poly", "[", "r", "]"}], ",", RowBox[{"poly", "[", "s", "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"\[ScriptCapitalR]", "==", RowBox[{"EmptyRegion", "[", "2", "]"}]}], ",", RowBox[{ RowBox[{"DDD", "[", RowBox[{"[", RowBox[{"r", ",", "s"}], "]"}], "]"}], "=", RowBox[{"Dmin", "[", RowBox[{ RowBox[{"Mdisk", "[", RowBox[{"[", RowBox[{"r", ",", RowBox[{"konv", "[", RowBox[{"[", "r", "]"}], "]"}]}], "]"}], "]"}], ",", RowBox[{"Mdisk", "[", RowBox[{"[", RowBox[{"s", ",", RowBox[{"konv", "[", RowBox[{"[", "s", "]"}], "]"}]}], "]"}], "]"}]}], "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"DDD", "[", RowBox[{"[", RowBox[{"r", ",", "s"}], "]"}], "]"}], "=", "0"}]}], "]"}]}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"r", "+", "1"}], ",", RowBox[{"Length", "[", "Mdisk", "]"}]}], "}"}]}], "]"}], ";"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"r", ",", RowBox[{"Length", "[", "Mdisk", "]"}]}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"MatrixForm", "[", "DDD", "]"}], ",", "\"\< - distance matrix between clusters\>\""}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"MinEl", "[", "DDD", "]"}], ",", "pol"}], "}"}]}]}], "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]"}], "Input", CellChangeTimes->{{3.8373091225306635`*^9, 3.837309123115984*^9}, 3.837309792534196*^9},ExpressionUUID->"d58091f3-5f96-466b-807c-\ 75e3dbf5d79a"] }, Open ]] }, WindowSize->{809, 760}, WindowMargins->{{257, Automatic}, {-56, Automatic}}, FrontEndVersion->"12.0 for Microsoft Windows (64-bit) (April 8, 2019)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 2193, 37, 44, "Subsubsection",ExpressionUUID->"6d67d834-ea21-456d-860e-89283b2a0226"], Cell[2776, 61, 2581, 52, 84, "Text",ExpressionUUID->"1169044d-e1d9-4ece-b092-630663468e3f"], Cell[5360, 115, 5857, 153, 466, "Input",ExpressionUUID->"d58091f3-5f96-466b-807c-75e3dbf5d79a"] }, Open ]] } ] *)