(* 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[ 9459, 243] NotebookOptionsPosition[ 9036, 225] NotebookOutlinePosition[ 9442, 241] CellTagsIndexPosition[ 9399, 238] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[TextData[{ StyleBox["Hausdorff ", FontColor->RGBColor[1, 0, 0]], 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 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}, { 3.822202850175948*^9, 3.822202851256916*^9}, {3.822203090644414*^9, 3.822203136248438*^9}}, ExpressionUUID -> "e66d6e93-d6b2-4c5b-9154-8959b5b959a5"], Cell[TextData[{ StyleBox["Input:", FontColor->RGBColor[1, 0, 0]], StyleBox[" sets A,B;\n", FontColor->RGBColor[0, 0, 1]], StyleBox["Output:", FontColor->RGBColor[1, 0, 0]], StyleBox[" Hausdorff distance between sets A,B;\n", FontColor->RGBColor[0, 0, 1]], StyleBox["Submodules:", FontColor->RGBColor[1, 0, 0]], StyleBox[" none needed \n", FontColor->RGBColor[0, 0, 1]] }], "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.82220286249375*^9, 3.822202864766219*^9}, 3.822203133038885*^9, {3.8223100228504844`*^9, 3.822310028280366*^9}, 3.82231008681275*^9}, FontSize->12, ExpressionUUID -> "a16ffa28-7742-4592-bcc2-c1a697822085"], Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{"Hausdorff", " ", SubscriptBox["\[ScriptL]", "1"], " ", "distance"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"HD1", "[", RowBox[{"a_", ",", "b_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"m", ",", "n", ",", "a1", ",", "b1"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Length", "[", "a", "]"}], ">", RowBox[{"Length", "[", "b", "]"}]}], ",", RowBox[{ RowBox[{"a1", "=", "b"}], ";", RowBox[{"b1", "=", "a"}]}], ",", RowBox[{ RowBox[{"a1", "=", "a"}], ";", RowBox[{"b1", "=", "b"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"m", "=", RowBox[{"Length", "[", "a1", "]"}]}], ";", RowBox[{"n", "=", RowBox[{"Length", "[", "b1", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Max", "[", RowBox[{ RowBox[{"Max", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"Min", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{ RowBox[{"a1", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"b1", "[", RowBox[{"[", "j", "]"}], "]"}]}], ",", "1"}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "n"}], "}"}]}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}], "]"}], ",", RowBox[{"Max", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"Min", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{ RowBox[{"a1", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"b1", "[", RowBox[{"[", "j", "]"}], "]"}]}], ",", "1"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "n"}], "}"}]}], "]"}], "]"}]}], "]"}]}]}], "]"}]}], "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Hausdorff", " ", "LS", " ", "distance"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"HD2", "[", RowBox[{"a_", ",", "b_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"m", ",", "n", ",", "a1", ",", "b1"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Length", "[", "a", "]"}], ">", RowBox[{"Length", "[", "b", "]"}]}], ",", RowBox[{ RowBox[{"a1", "=", "b"}], ";", RowBox[{"b1", "=", "a"}]}], ",", RowBox[{ RowBox[{"a1", "=", "a"}], ";", RowBox[{"b1", "=", "b"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"m", "=", RowBox[{"Length", "[", "a1", "]"}]}], ";", RowBox[{"n", "=", RowBox[{"Length", "[", "b1", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Max", "[", RowBox[{ RowBox[{"Max", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"Min", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"a1", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"b1", "[", RowBox[{"[", "j", "]"}], "]"}]}], "]"}], "^", "2"}], ",", RowBox[{"{", RowBox[{"j", ",", "n"}], "}"}]}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}], "]"}], ",", RowBox[{"Max", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"Min", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"a1", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"b1", "[", RowBox[{"[", "j", "]"}], "]"}]}], "]"}], "^", "2"}], ",", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "n"}], "}"}]}], "]"}], "]"}]}], "]"}]}]}], "]"}]}]}]}]], "Input", CellChangeTimes->{{3.822202901499758*^9, 3.8222029562440977`*^9}, { 3.8222036621406302`*^9, 3.8222036984546547`*^9}}, ExpressionUUID -> "9685b8e3-6700-4ed9-958e-0decbc061042"] }, Open ]] }, WindowSize->{754, 463}, WindowMargins->{{0, Automatic}, {Automatic, 10}}, 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, 1331, 24, 39, "Subsubsection"], Cell[1914, 48, 2102, 38, 83, "Text"], Cell[4019, 88, 5001, 134, 240, "Input"] }, Open ]] } ] *)