(* 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[ 7465, 232] NotebookOptionsPosition[ 7106, 215] NotebookOutlinePosition[ 7452, 230] CellTagsIndexPosition[ 7409, 227] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[TextData[StyleBox["Mahalanobis distance-like function and Normalized \ Mahalanobis distance-like function", FontColor->RGBColor[1, 0, 0]]], "Subsection", CellChangeTimes->{ 3.5854096427658014`*^9, {3.585636902492603*^9, 3.5856369150848255`*^9}, 3.8131270320776124`*^9, {3.813127824072362*^9, 3.813127841439308*^9}, { 3.8208185056215267`*^9, 3.8208185069556737`*^9}, {3.820818775063345*^9, 3.820818791392598*^9}, {3.820820759967064*^9, 3.820820768912135*^9}, { 3.822306435196814*^9, 3.8223064357209473`*^9}}, ExpressionUUID -> "f8413325-a084-476e-a74f-4fecf0d1b055"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{ StyleBox["Input", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"data", " ", "points", " ", "x"}], FontColor->RGBColor[0, 0, 1]]}], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"y", " ", "\[Element]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", "n"]}], FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{ RowBox[{ RowBox[{ "symmetric", " ", "positive", " ", "definite", " ", "matrix", " ", "\[Sum]"}], " ", "\[Element]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", RowBox[{"n", "\[Cross]", "n"}]]}], ";"}], FontColor->RGBColor[0, 0, 1]]}], StyleBox[" ", FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ StyleBox["Output", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[1, 0, 0]], StyleBox[ RowBox[{"dm", ":"}], FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mahalanobis", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["distance", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["between", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["the", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["points", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["x", FontColor->RGBColor[0, 0, 1]]}], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{ RowBox[{"y", " ", "\[Element]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", "n"]}], ";"}], FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ StyleBox["Output", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[1, 0, 0]], StyleBox[ RowBox[{"dM", ":"}], FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["normalized", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mahalanobis", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["distance", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["between", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["the", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["points", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["x", FontColor->RGBColor[0, 0, 1]]}], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{ RowBox[{"y", " ", "\[Element]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", "n"]}], ";"}], FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ StyleBox["Submodules", FontColor->RGBColor[1, 0, 0]], StyleBox[":", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"none", " ", "needed"}], FontColor->RGBColor[0, 0, 1]]}], StyleBox[" ", FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]"}], "Text", CellChangeTimes->{{3.5866502699378433`*^9, 3.586650277895857*^9}, 3.5942185551808147`*^9, {3.805594762105279*^9, 3.805594764641291*^9}, { 3.8064680185995092`*^9, 3.806468028080453*^9}, {3.8099095382941337`*^9, 3.809909549475051*^9}, {3.8099095801234965`*^9, 3.809909601944172*^9}, { 3.813127071112588*^9, 3.813127071297781*^9}, 3.8131274310490584`*^9, { 3.813127472749838*^9, 3.813127475439375*^9}, 3.813127611601438*^9, { 3.813127720333233*^9, 3.813127766302763*^9}, {3.8131280374231367`*^9, 3.813128072050006*^9}, {3.8208190891837435`*^9, 3.8208190913077726`*^9}, { 3.8223064542549105`*^9, 3.8223064685591793`*^9}, 3.822306532413664*^9}, FontSize->12, ExpressionUUID -> "78687b16-6bbe-4f35-9ffd-1bb9af9fd39b"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"dm", "[", RowBox[{"x_", ",", "y_", ",", "S_"}], "]"}], ":=", RowBox[{ RowBox[{"(", RowBox[{"x", "-", "y"}], ")"}], ".", RowBox[{"Inverse", "[", "S", "]"}], ".", RowBox[{"(", RowBox[{"x", "-", "y"}], ")"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"dM", "[", RowBox[{"x_", ",", "y_", ",", "S_"}], "]"}], ":=", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Det", "[", "S", "]"}], "^", RowBox[{"(", RowBox[{"1", "/", "n"}], ")"}]}], ")"}], RowBox[{ RowBox[{"(", RowBox[{"x", "-", "y"}], ")"}], ".", RowBox[{"Inverse", "[", "S", "]"}], ".", RowBox[{"(", RowBox[{"x", "-", "y"}], ")"}]}]}]}], ";"}]}], "Input", CellChangeTimes->{{3.5866502699378433`*^9, 3.586650277895857*^9}, 3.5942185551808147`*^9, {3.805594762105279*^9, 3.805594764641291*^9}, { 3.8064680185995092`*^9, 3.806468028080453*^9}, {3.8099095382941337`*^9, 3.809909549475051*^9}, {3.8099095801234965`*^9, 3.809909601944172*^9}, { 3.813127071112588*^9, 3.813127071297781*^9}, 3.8131274310490584`*^9, { 3.813127472749838*^9, 3.813127475439375*^9}, 3.813127611601438*^9, { 3.813127720333233*^9, 3.813127766302763*^9}, {3.8131280374231367`*^9, 3.813128072050006*^9}, {3.8208190891837435`*^9, 3.8208190913077726`*^9}, 3.8223064542549105`*^9}, ExpressionUUID -> "78687b16-6bbe-4f35-9ffd-1bb9af9fd39b"] }, Open ]] }, WindowSize->{789, 266}, WindowMargins->{{0, Automatic}, {Automatic, 21}}, 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, 589, 9, 49, "Subsection"], Cell[1172, 33, 4452, 141, 110, "Text"], Cell[5627, 176, 1463, 36, 50, "Input"] }, Open ]] } ] *)