(* 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[ 30109, 695] NotebookOptionsPosition[ 29584, 678] NotebookOutlinePosition[ 29928, 693] CellTagsIndexPosition[ 29885, 690] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Mahalanobis weighted \[ScriptK] - means algorithm", "Subsection", CellChangeTimes->{3.5854097085807176`*^9, 3.585637218737363*^9, 3.8067555638956704`*^9, 3.822207054504098*^9},ExpressionUUID->"40480428-912f-47e8-bf93-\ a11e4a6190d7"], Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"Input", ":", " ", RowBox[{ RowBox[{"data", " ", "set", " ", "\[ScriptCapitalA]"}], " ", "\[Subset]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", "n"]}]}], ",", " ", RowBox[{ RowBox[{"data", " ", "weights", " ", "w"}], " ", "\[Element]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", "n"]}], ",", " ", RowBox[{"initial", " ", "centers", " ", SubscriptBox["z", "1"]}], ",", "\[TripleDot]", ",", RowBox[{ SubscriptBox["z", "k"], " ", "\[Element]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", "n"]}], ",", " ", RowBox[{";", "\[IndentingNewLine]", RowBox[{ RowBox[{"Output", ":", " ", RowBox[{"partition", " ", "\[CapitalPi]"}]}], "=", RowBox[{ RowBox[{"{", RowBox[{ SubscriptBox["\[Pi]", "1"], ",", "\[TripleDot]", ",", SubscriptBox["\[Pi]", "k"]}], "}"}], " ", RowBox[{"(", RowBox[{ RowBox[{ "each", " ", "partition", " ", "consists", " ", "of", " ", "clus"}], "-", RowBox[{ "ters", " ", "with", " ", "corresponding", " ", "weights", " ", "associated", " ", "\[IndentingNewLine]", "to", " ", "their", " ", "elements"}]}], ")"}]}]}]}], ",", " ", RowBox[{"centers", " ", SubscriptBox["c", "1"]}], ",", "\[TripleDot]", ",", RowBox[{ SubscriptBox["c", "k"], " ", "\[Element]", " ", SuperscriptBox["\[DoubleStruckCapitalR]", "n"]}], ",", " ", RowBox[{ RowBox[{"covariance", " ", "matrices", " ", UnderscriptBox["\[Sum]", "j"]}], "\[Element]", SuperscriptBox["\[DoubleStruckCapitalR]", RowBox[{"n", "\[Cross]", "n"}]]}], ",", " ", RowBox[{"j", "=", RowBox[{"1", "\[TripleDot]k"}]}], ",", " ", RowBox[{ RowBox[{"number", " ", "of", " ", "iterations", " ", "It"}], ";", "\[IndentingNewLine]", RowBox[{"Submodules", ":", " ", RowBox[{"dM", "[", "]"}]}]}], ",", " ", RowBox[{"DIRECT", "[", "]"}]}], " ", "\[IndentingNewLine]", "*)"}], "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.5886541897699375`*^9, 3.5886541909877396`*^9}, { 3.588654263023868*^9, 3.588654339794004*^9}, {3.5917588683674088`*^9, 3.591758869047409*^9}, {3.5917590328866577`*^9, 3.591759044816675*^9}, { 3.5937444692479725`*^9, 3.5937444771129847`*^9}, {3.8067251659311037`*^9, 3.8067252085746784`*^9}, {3.8067252462048798`*^9, 3.806725247420523*^9}, { 3.8067555742205267`*^9, 3.8067555768738213`*^9}, {3.8071002028759546`*^9, 3.807100208919777*^9}, {3.8107927170556965`*^9, 3.8107927208402033`*^9}, { 3.813128996198531*^9, 3.81312899765561*^9}, {3.8131290871131477`*^9, 3.8131291044656687`*^9}, 3.813129162727297*^9, {3.813129217851308*^9, 3.81312926039266*^9}, {3.8131293311074486`*^9, 3.813129508676306*^9}, { 3.8208235288040915`*^9, 3.8208235296679153`*^9}, {3.820823683703711*^9, 3.820823686279229*^9}, 3.8222070315393133`*^9, {3.822207092628523*^9, 3.8222071768599997`*^9}, {3.822207301571575*^9, 3.8222073795291257`*^9}, { 3.822207424813982*^9, 3.8222074303311787`*^9}, {3.82220747503852*^9, 3.8222075014187794`*^9}, {3.8222075319138308`*^9, 3.822207547370372*^9}, { 3.890874475492508*^9, 3.8908744825306005`*^9}},ExpressionUUID->"4f6001e5-4731-4da1-898f-\ f0f23cdb63d0"], Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{"Koristi", " ", "se", " ", "dM"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MWKMeans", "[", RowBox[{"w_", ",", "A_", ",", "z_", ",", RowBox[{"Ind_:", "0"}]}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"m", "=", RowBox[{"Length", "[", "w", "]"}]}], ",", RowBox[{"k", "=", RowBox[{"Length", "[", "z", "]"}]}], ",", RowBox[{"W", "=", RowBox[{"Total", "[", "w", "]"}]}], ",", "PI0", ",", "PIpriv", ",", "tab", ",", "min", ",", "imin", ",", "Pod", ",", "c", ",", "c0", ",", RowBox[{"n", "=", RowBox[{"Length", "[", RowBox[{"z", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], ",", "Scov", ",", "pom", ",", "corr", ",", RowBox[{"It", "=", "0"}], ",", RowBox[{"epsilon", "=", ".000000001"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"Pod", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"w", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"c0", "=", "z"}], ";", "\[IndentingNewLine]", "\t\t\t\t\t\t", RowBox[{"(*", " ", RowBox[{"Ra\[CHacek]unanje", " ", "particije"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"PI", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}]}], ";", RowBox[{"Scov", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}]}], ";", RowBox[{"pom", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}]}], ";", RowBox[{"mj", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"tab", "=", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{ RowBox[{"Pod", "[", RowBox[{"[", "i", "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "-", RowBox[{"z", "[", RowBox[{"[", "j", "]"}], "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}], "//", "N"}]}], ";", "\[IndentingNewLine]", RowBox[{"imin", "=", RowBox[{ RowBox[{"Ordering", "[", RowBox[{"tab", ",", "1"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"PI", "[", RowBox[{"[", "imin", "]"}], "]"}], "=", RowBox[{"Append", "[", RowBox[{ RowBox[{"PI", "[", RowBox[{"[", "imin", "]"}], "]"}], ",", RowBox[{"Pod", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}]}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"PI", "=", RowBox[{"DeleteCases", "[", RowBox[{"PI", ",", RowBox[{"{", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"k", "=", RowBox[{"Length", "[", "PI", "]"}]}], ";", "\[IndentingNewLine]", " ", RowBox[{"(*", " ", RowBox[{"Ra\[CHacek]unanje", " ", "centara"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"c", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{"PI", "[", RowBox[{"[", RowBox[{"j", ",", "s", ",", "1"}], "]"}], "]"}], "*", RowBox[{"PI", "[", RowBox[{"[", RowBox[{"j", ",", "s", ",", "2"}], "]"}], "]"}]}], ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", RowBox[{"PI", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}]}], "}"}]}], "]"}], "/", RowBox[{"Sum", "[", RowBox[{ RowBox[{"PI", "[", RowBox[{"[", RowBox[{"j", ",", "s", ",", "1"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", RowBox[{"PI", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}]}], "}"}]}], "]"}]}], ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\t\t\t\t\t\t\t", RowBox[{"(*", " ", "LOOP", " ", "*)"}], "\[IndentingNewLine]", RowBox[{"While", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Chop", "[", RowBox[{"Norm", "[", RowBox[{"c0", "-", "c"}], "]"}], "]"}], "\[NotEqual]", "0"}], ",", RowBox[{ RowBox[{"c0", "=", "c"}], ";", RowBox[{"It", "=", RowBox[{"It", "+", "1"}]}], ";", "\[IndentingNewLine]", "\t\t\t\t", RowBox[{"(*", " ", RowBox[{"Racunanje", " ", "matrica", " ", "Scov"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"mj", "[", RowBox[{"[", "j", "]"}], "]"}], "=", RowBox[{"Sum", "[", RowBox[{ RowBox[{"PI", "[", RowBox[{"[", RowBox[{"j", ",", "s", ",", "1"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", RowBox[{"PI", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"Scov", "[", RowBox[{"[", "j", "]"}], "]"}], "=", RowBox[{ RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{"PI", "[", RowBox[{"[", RowBox[{"j", ",", "s", ",", "1"}], "]"}], "]"}], "*", RowBox[{"KroneckerProduct", "[", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"PI", "[", RowBox[{"[", RowBox[{"j", ",", "All", ",", "2"}], "]"}], "]"}], "[", RowBox[{"[", "s", "]"}], "]"}], "-", RowBox[{"c", "[", RowBox[{"[", "j", "]"}], "]"}]}], ")"}], ",", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"PI", "[", RowBox[{"[", RowBox[{"j", ",", "All", ",", "2"}], "]"}], "]"}], "[", RowBox[{"[", "s", "]"}], "]"}], "-", RowBox[{"c", "[", RowBox[{"[", "j", "]"}], "]"}]}], ")"}]}], "]"}]}], ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", RowBox[{"PI", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}]}], "}"}]}], "]"}], "/", RowBox[{"mj", "[", RowBox[{"[", "j", "]"}], "]"}]}]}]}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Min", "[", RowBox[{"Eigenvalues", "[", RowBox[{"Scov", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}], "]"}], "<", "epsilon"}], ",", RowBox[{ RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", "j", ",", "\"\<-tog centra (\>\"", ",", RowBox[{"c", "[", RowBox[{"[", "j", "]"}], "]"}], ",", "\"\<): \>\"", ",", RowBox[{"Scov", "[", RowBox[{"[", "j", "]"}], "]"}], ",", "\"\< je singularna\>\""}], "]"}], ";", RowBox[{"Print", "[", RowBox[{"\"\<|PI[j]|: \>\"", ",", RowBox[{"Length", "[", RowBox[{"PI", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}], ",", "\"\<, Eigen_min=\>\"", ",", RowBox[{"Min", "[", RowBox[{"Eigenvalues", "[", RowBox[{"Scov", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}], "]"}]}], "]"}], ";", RowBox[{ RowBox[{"Scov", "[", RowBox[{"[", "j", "]"}], "]"}], "=", RowBox[{"IdentityMatrix", "[", "n", "]"}]}]}]}], " ", "]"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"PIpriv", "=", "PI"}], ";", "\[IndentingNewLine]", RowBox[{"PI", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "k"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"corr", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Log", "[", RowBox[{ RowBox[{"m", "^", "2"}], " ", RowBox[{ RowBox[{"Det", "[", RowBox[{"Scov", "[", RowBox[{"[", "jj", "]"}], "]"}], "]"}], "/", RowBox[{ RowBox[{"mj", "[", RowBox[{"[", "jj", "]"}], "]"}], "^", "2"}]}]}], "]"}], ",", RowBox[{"{", RowBox[{"jj", ",", "k"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"tab", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"dM", "[", RowBox[{ RowBox[{"PIpriv", "[", RowBox[{"[", RowBox[{"jj", ",", "s", ",", "2"}], "]"}], "]"}], ",", RowBox[{"c", "[", RowBox[{"[", "j", "]"}], "]"}], ",", RowBox[{"Scov", "[", RowBox[{"[", "j", "]"}], "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"imin", "=", RowBox[{ RowBox[{"Ordering", "[", RowBox[{"tab", ",", "1"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"PI", "[", RowBox[{"[", "imin", "]"}], "]"}], "=", RowBox[{"Append", "[", RowBox[{ RowBox[{"PI", "[", RowBox[{"[", "imin", "]"}], "]"}], ",", RowBox[{"PIpriv", "[", RowBox[{"[", RowBox[{"jj", ",", "s"}], "]"}], "]"}]}], " ", "]"}]}]}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", RowBox[{"PIpriv", "[", RowBox[{"[", "jj", "]"}], "]"}], "]"}]}], "}"}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"jj", ",", "k"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"PI", "=", RowBox[{"DeleteCases", "[", RowBox[{"PI", ",", RowBox[{"{", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"k", "=", RowBox[{"Length", "[", "PI", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"c", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{"PI", "[", RowBox[{"[", RowBox[{"j", ",", "s", ",", "1"}], "]"}], "]"}], "*", RowBox[{"PI", "[", RowBox[{"[", RowBox[{"j", ",", "s", ",", "2"}], "]"}], "]"}]}], ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", RowBox[{"PI", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}]}], "}"}]}], "]"}], "/", RowBox[{"Sum", "[", RowBox[{ RowBox[{"PI", "[", RowBox[{"[", RowBox[{"j", ",", "s", ",", "1"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", RowBox[{"PI", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}]}], "}"}]}], "]"}]}], ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", " ", "\[IndentingNewLine]", "\t\t\t\t", RowBox[{"(*", " ", RowBox[{ "Slucaj", " ", "smanjenja", " ", "broja", " ", "klastera", " ", "u", " ", "particiji"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Length", "[", "c", "]"}], "<", RowBox[{"Length", "[", "c0", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"F2", "[", RowBox[{"u_", ",", "v_"}], "]"}], ":=", RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{"w", "[", RowBox[{"[", "i", "]"}], "]"}], RowBox[{"Min", "[", RowBox[{"Append", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"c", "[", RowBox[{"[", "s", "]"}], "]"}]}], "]"}], "^", "2"}], ",", RowBox[{"{", RowBox[{"s", ",", RowBox[{"Length", "[", "c", "]"}]}], "}"}]}], "]"}], ",", RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"{", RowBox[{"u", ",", "v"}], "}"}]}], "]"}], "^", "2"}]}], "]"}], "]"}]}], ",", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"dom", "=", RowBox[{"{", RowBox[{"xG", ",", "yG"}], "}"}]}], ";", "\[IndentingNewLine]", "\t\t\t\t\t\t\t\t", RowBox[{"(*", " ", RowBox[{"Novi", " ", "DIRECT", " ", "centar"}], "*)"}], "\[IndentingNewLine]", RowBox[{"minp", "=", RowBox[{ RowBox[{"DIRECT", "[", RowBox[{"F2", ",", "dom", ",", RowBox[{"DMin", "\[Rule]", RowBox[{"10.", "^", RowBox[{"(", RowBox[{"-", "3"}], ")"}]}]}], ",", RowBox[{"MaxIter", "\[Rule]", "50"}], ",", " ", RowBox[{"Eps", "\[Rule]", RowBox[{"10", "^", RowBox[{"(", RowBox[{"-", "4"}], ")"}]}]}]}], "]"}], "//", "Timing"}]}], ";", " ", RowBox[{"min", "=", RowBox[{"minp", "[", RowBox[{"[", "2", "]"}], "]"}]}], ";", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", "min"}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"c", "=", RowBox[{"Append", "[", RowBox[{"c", ",", RowBox[{"min", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", "c"}], "]"}], ";", StyleBox["\[IndentingNewLine]", FontColor->RGBColor[0.5, 0, 0.5]], RowBox[{"k", "=", RowBox[{"Length", "[", "c", "]"}]}], ";", " ", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", "k"}], "]"}], ";", "\[IndentingNewLine]", "\t\t\t\t\t\t\t\t", RowBox[{"(*", " ", RowBox[{"Nova", " ", "particija"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"PI", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"tab", "=", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"Norm", "[", RowBox[{ RowBox[{ RowBox[{"Pod", "[", RowBox[{"[", "i", "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "-", RowBox[{"c", "[", RowBox[{"[", "j", "]"}], "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "k"}], "}"}]}], "]"}], "//", "N"}]}], ";", "\[IndentingNewLine]", RowBox[{"imin", "=", RowBox[{ RowBox[{"Ordering", "[", RowBox[{"tab", ",", "1"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"PI", "[", RowBox[{"[", "imin", "]"}], "]"}], "=", RowBox[{"Append", "[", RowBox[{ RowBox[{"PI", "[", RowBox[{"[", "imin", "]"}], "]"}], ",", RowBox[{"Pod", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}]}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"i", ",", "m"}], "}"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"PI", ",", "c", ",", "Scov", ",", "It"}], "}"}]}]}], "\[IndentingNewLine]", "]"}]}]}]], "Input", CellChangeTimes->{{3.5854097343735633`*^9, 3.5854097510841928`*^9}, 3.5854422528934937`*^9, {3.5854427134983077`*^9, 3.585442775474617*^9}, { 3.585442845922742*^9, 3.585442875636194*^9}, {3.5854429350570993`*^9, 3.5854429395977077`*^9}, 3.585443159258896*^9, {3.5854443563520174`*^9, 3.585444366291235*^9}, {3.5854451379360123`*^9, 3.585445157845647*^9}, { 3.5854451929985094`*^9, 3.585445215093148*^9}, {3.585460068733981*^9, 3.585460069155182*^9}, {3.5856127989916306`*^9, 3.585612806047843*^9}, { 3.585670796116366*^9, 3.5856708026693773`*^9}, {3.5856708981689477`*^9, 3.585670918390583*^9}, {3.5858299052484636`*^9, 3.5858299388735228`*^9}, { 3.5858300073706436`*^9, 3.5858300077450447`*^9}, {3.585900458600043*^9, 3.5859004840018873`*^9}, {3.588248751354031*^9, 3.588248821404038*^9}, { 3.5882498810556464`*^9, 3.5882498973515787`*^9}, {3.588250161090664*^9, 3.5882502911901045`*^9}, {3.5882503246970215`*^9, 3.5882503277241945`*^9}, {3.5882503790181284`*^9, 3.588250383606391*^9}, { 3.5882504242917175`*^9, 3.588250464820036*^9}, {3.5882505105736527`*^9, 3.5882505114917054`*^9}, 3.5882507453700824`*^9, {3.588251032786522*^9, 3.5882510334005566`*^9}, {3.588487947786691*^9, 3.588487962672117*^9}, { 3.5884882407794094`*^9, 3.5884882441656156`*^9}, {3.588488355868213*^9, 3.5884883708804398`*^9}, {3.588488563666781*^9, 3.5884887402542934`*^9}, { 3.5885630334504766`*^9, 3.58856304123589*^9}, 3.5885632791621113`*^9, { 3.588563325440793*^9, 3.588563336488612*^9}, {3.5885633979365215`*^9, 3.5885634398929954`*^9}, {3.588563483504072*^9, 3.5885635078451157`*^9}, { 3.5885635511265917`*^9, 3.588563551610193*^9}, {3.5885636088742943`*^9, 3.588563625007723*^9}, {3.588563680617221*^9, 3.5885636883090343`*^9}, { 3.588563741765729*^9, 3.588563801354234*^9}, {3.588564036274249*^9, 3.588564058010088*^9}, {3.5885642241571817`*^9, 3.5885642437392163`*^9}, { 3.588564286960293*^9, 3.5885642917973013`*^9}, {3.588564427386545*^9, 3.5885644656448126`*^9}, {3.5885647028756323`*^9, 3.5885647307296815`*^9}, {3.588564767833547*^9, 3.5885647697689505`*^9}, 3.5885648242386465`*^9, {3.58856492207082*^9, 3.588564987698738*^9}, { 3.588572135897002*^9, 3.58857213993841*^9}, {3.5886546813328094`*^9, 3.588654739615913*^9}, 3.588655124544796*^9, {3.5886556751016054`*^9, 3.5886556860392246`*^9}, {3.5916293696412287`*^9, 3.5916293705512304`*^9}, {3.5916294227753096`*^9, 3.591629511524443*^9}, { 3.591629572599535*^9, 3.5916296059665856`*^9}, {3.5916296768786955`*^9, 3.5916297152957535`*^9}, {3.5916297727758408`*^9, 3.5916297974568777`*^9}, {3.591629847631954*^9, 3.591629849641957*^9}, { 3.5916299076980443`*^9, 3.591629908578046*^9}, {3.5916299990101824`*^9, 3.5916300010101852`*^9}, {3.591630323283673*^9, 3.5916303379066944`*^9}, { 3.5916305268829803`*^9, 3.5916305270929804`*^9}, {3.591660714605068*^9, 3.5916607198970757`*^9}, {3.5916607650771446`*^9, 3.591660803309202*^9}, { 3.59166166890351*^9, 3.591661669693511*^9}, {3.59166726848798*^9, 3.591667269147981*^9}, {3.591667312366047*^9, 3.591667313666049*^9}, { 3.591667570940436*^9, 3.5916676610655746`*^9}, {3.591667694300625*^9, 3.591667696650628*^9}, {3.5916677544017158`*^9, 3.591667773155744*^9}, 3.5917551025947275`*^9, {3.591755366982127*^9, 3.5917554493482513`*^9}, { 3.591755489010311*^9, 3.5917556047644854`*^9}, {3.5917556648575764`*^9, 3.59175569379862*^9}, {3.5917557618687215`*^9, 3.5917557873157606`*^9}, { 3.5917558408288403`*^9, 3.5917558610128703`*^9}, {3.5917558994739285`*^9, 3.591755929475973*^9}, {3.591756176614344*^9, 3.5917561773743453`*^9}, 3.5917562151114016`*^9, {3.591756366958629*^9, 3.591756392572668*^9}, { 3.5917579616330385`*^9, 3.591758013264118*^9}, {3.5917581921473875`*^9, 3.591758226619439*^9}, {3.5917582888085327`*^9, 3.591758291098536*^9}, { 3.5917590973337555`*^9, 3.5917590999237595`*^9}, {3.5917591371568155`*^9, 3.591759166136859*^9}, {3.591759256893997*^9, 3.5917592790000315`*^9}, { 3.591759533142414*^9, 3.5917595431854286`*^9}, {3.591843598531943*^9, 3.5918436338009963`*^9}, {3.591844425669197*^9, 3.591844426039197*^9}, { 3.5924640713958273`*^9, 3.5924641798789835`*^9}, {3.592464248131085*^9, 3.5924642487210855`*^9}, {3.5925376899035196`*^9, 3.592537705867544*^9}, { 3.592576875063138*^9, 3.592576875413139*^9}, {3.5925781562650175`*^9, 3.592578156475018*^9}, {3.592964548924782*^9, 3.592964555166792*^9}, { 3.592964585219837*^9, 3.5929645888298426`*^9}, {3.5929682001042895`*^9, 3.5929682159073133`*^9}, 3.5929763390111504`*^9, {3.5929764515003147`*^9, 3.592976467183339*^9}, {3.593053072760112*^9, 3.593053073730113*^9}, { 3.5930538105942287`*^9, 3.593053812714232*^9}, {3.593053856404299*^9, 3.5930538572843*^9}, {3.593053927802407*^9, 3.5930539356244183`*^9}, 3.593058968659049*^9, {3.593059020562127*^9, 3.5930590479781685`*^9}, { 3.5930590835552225`*^9, 3.5930590844352236`*^9}, {3.5930591188302755`*^9, 3.593059264793499*^9}, {3.5930605185343647`*^9, 3.593060519054365*^9}, { 3.5930684136272135`*^9, 3.593068453909273*^9}, {3.5930685369283977`*^9, 3.5930685378793993`*^9}, 3.593744511931036*^9, {3.5963702044622517`*^9, 3.596370223206278*^9}, 3.8064685397774334`*^9, {3.8069286765088053`*^9, 3.8069286828591075`*^9}, {3.8069296662564898`*^9, 3.8069296715367703`*^9}, {3.8908744428349886`*^9, 3.8908744492197723`*^9}},ExpressionUUID->"9cad05ff-cdce-4448-a1d7-\ 57ed67c66c1b"] }, Open ]] }, WindowSize->{889, 750}, WindowMargins->{{-1917, Automatic}, {0, 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, 246, 4, 53, "Subsection",ExpressionUUID->"40480428-912f-47e8-bf93-a11e4a6190d7"], Cell[829, 28, 3430, 71, 148, "Input",ExpressionUUID->"4f6001e5-4731-4da1-898f-f0f23cdb63d0"], Cell[4262, 101, 25306, 574, 1416, "Input",ExpressionUUID->"9cad05ff-cdce-4448-a1d7-57ed67c66c1b"] }, Open ]] } ] *)