(* 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[ 6476, 159] NotebookOptionsPosition[ 6052, 141] NotebookOutlinePosition[ 6460, 157] CellTagsIndexPosition[ 6417, 154] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[TextData[{ Cell[BoxData[ SubscriptBox["\[ScriptL]", "1"]], CellChangeTimes->{{3.8222001228730335`*^9, 3.8222001264974904`*^9}, { 3.8222002231101017`*^9, 3.822200367715189*^9}, {3.822201351982893*^9, 3.8222013534458165`*^9}, {3.8222014251653404`*^9, 3.822201455888179*^9}, { 3.822201548437482*^9, 3.822201575838107*^9}, {3.8222016085348268`*^9, 3.8222017036871862`*^9}, {3.8222017599592466`*^9, 3.822201892630003*^9}, { 3.822201925747697*^9, 3.822201966376397*^9}, {3.822201998330805*^9, 3.8222020356851745`*^9}}, FontColor->RGBColor[1, 0, 0], ExpressionUUID -> "660bef29-396d-4aad-b7d8-150261fbad57"], StyleBox[" and LS distance between centers of two sets A, B", FontColor->RGBColor[1, 0, 0]] }], "Subsubsection", CellChangeTimes->{{3.73112424028771*^9, 3.7311242546173754`*^9}, { 3.8106047392458076`*^9, 3.8106047456549196`*^9}, {3.8131286886441045`*^9, 3.8131286920600576`*^9}, 3.8210125983161287`*^9, {3.8210127933056593`*^9, 3.8210128227915487`*^9}, {3.82220226382094*^9, 3.8222022683675466`*^9}, 3.82220233336152*^9, {3.8222025416329203`*^9, 3.8222025824383435`*^9}}, ExpressionUUID -> "e66d6e93-d6b2-4c5b-9154-8959b5b959a5"], Cell[TextData[{ StyleBox["Input:", FontColor->RGBColor[1, 0, 0]], " sets A,B;\n", StyleBox["Output: ", FontColor->RGBColor[1, 0, 0]], "distance between sets A,B;\n", StyleBox["Submodules:", FontColor->RGBColor[1, 0, 0]], " none needed \n" }], "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.8210128351185436`*^9, 3.821012855257584*^9}, { 3.8222022864621735`*^9, 3.8222023004777803`*^9}, {3.82220260021601*^9, 3.822202614891529*^9}, {3.822306175262173*^9, 3.8223061859250526`*^9}, 3.8223062247188363`*^9}, FontSize->12, ExpressionUUID -> "a16ffa28-7742-4592-bcc2-c1a697822085"], Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{ SubscriptBox["\[ScriptL]", "1"], " ", "distance", " ", "between", " ", "sets"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"DC1", "[", RowBox[{"A_", ",", "B_"}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"cA", ",", "cB"}], "}"}], ",", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"cA", "=", RowBox[{"Median", "[", "A", "]"}]}], ",", "\"\<, cB=\>\"", ",", RowBox[{"cB", "=", RowBox[{"Median", "[", "B", "]"}]}], ",", "\"\<; d1(cA,cB)=\>\"", ",", RowBox[{"Norm", "[", RowBox[{ RowBox[{"cA", "-", "cB"}], ",", "1"}], "]"}]}], "]"}]}], "]"}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"LS", " ", "distance", " ", "between", " ", "sets"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"DC2", "[", RowBox[{"A_", ",", "B_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"cA", ",", "cB"}], "}"}], ",", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"cA", "=", RowBox[{ RowBox[{"Total", "[", "A", "]"}], "/", RowBox[{"Length", "[", "A", "]"}]}]}], ",", "\"\<, cB=\>\"", ",", RowBox[{"cB", "=", RowBox[{ RowBox[{"Total", "[", "B", "]"}], "/", RowBox[{"Length", "[", "B", "]"}]}]}], ",", "\"\<; dLS(cA,cB)=\>\"", ",", RowBox[{ RowBox[{"Norm", "[", RowBox[{"cA", "-", "cB"}], "]"}], "^", "2"}]}], "]"}]}], "]"}]}]}]}]], "Input", CellChangeTimes->{{3.639447190546379*^9, 3.6394471918879814`*^9}, 3.639447939160494*^9, 3.6394491349469953`*^9, {3.639533093390826*^9, 3.639533224181456*^9}, 3.639533261886722*^9, {3.639570115983263*^9, 3.639570116435664*^9}, 3.639572151833639*^9, {3.639572222330163*^9, 3.6395722354341855`*^9}, {3.6395723397983694`*^9, 3.63957234043797*^9}, 3.6395723938992643`*^9, {3.6398340141433954`*^9, 3.6398340823155155`*^9}, 3.765981134466308*^9, 3.7659826042679625`*^9, {3.8222026516053033`*^9, 3.822202702439432*^9}}, ExpressionUUID -> "544766d6-d2fe-43e8-890f-baebf302b87b"] }, Open ]] }, WindowSize->{1536, 779}, WindowMargins->{{-8, Automatic}, {Automatic, -8}}, TaggingRules->{"SlideshowSettings" -> {"Toolbar" -> True}}, FrontEndVersion->"11.0 for Microsoft Windows (64-bit) (September 21, 2016)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 1186, 20, 39, "Subsubsection"], Cell[1769, 44, 1898, 34, 83, "Text"], Cell[3670, 80, 2366, 58, 126, "Input"] }, Open ]] } ] *)