(* 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[ 12959, 331] NotebookOptionsPosition[ 11792, 302] NotebookOutlinePosition[ 12196, 318] CellTagsIndexPosition[ 12153, 315] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["\<\ Position of the minimal element of an upper triangular matrix\ \>", "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},ExpressionUUID->"e66d6e93-d6b2-4c5b-9154-\ 8959b5b959a5"], Cell[BoxData[ RowBox[{"(*", " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"Input", ":", " ", RowBox[{"upper", " ", "triangular", " ", "matrix"}]}], ";", "\[IndentingNewLine]", RowBox[{"Output", ":", " ", RowBox[{ "position", " ", "of", " ", "the", " ", "minimal", " ", "element"}]}], ";", "\[IndentingNewLine]", RowBox[{"Submodules", ":", " ", RowBox[{"none", " ", "needed"}]}]}], " ", "\[IndentingNewLine]", "*)"}]], "Input", 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}},ExpressionUUID->"a16ffa28-7742-4592-bcc2-\ c1a697822085"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"MinEl", "[", "R_", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"n", "=", RowBox[{"Length", "[", RowBox[{"R", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], ",", RowBox[{"min", "=", "Infinity"}], ",", "red", ",", "ord", ",", "imin"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"red", "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{"R", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"1", ",", "i"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ord", "=", RowBox[{ RowBox[{"Ordering", "[", RowBox[{"red", ",", "1"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"red", "[", RowBox[{"[", "ord", "]"}], "]"}], "<", "min"}], ",", RowBox[{ RowBox[{"min", "=", RowBox[{"red", "[", RowBox[{"[", "ord", "]"}], "]"}]}], ";", RowBox[{"imin", "=", RowBox[{"{", RowBox[{"i", ",", RowBox[{"ord", "+", "i"}]}], "}"}]}]}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"Print", "[", RowBox[{ "i", ",", "red", ",", "ord", ",", "\"\<: \>\"", ",", "imin"}], "]"}], ";"}], "*)"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", "imin"}]}], "]"}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", Cell["\<\ Position of the maximal element of an upper triangular matrix\ \>", "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},ExpressionUUID-> "0f312099-0098-4358-af17-ade8179068f4"], " ", "*)"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MaxEl", "[", "R_", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"n", "=", RowBox[{"Length", "[", RowBox[{"R", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], ",", RowBox[{"max", "=", RowBox[{"-", "Infinity"}]}], ",", "red", ",", "ord", ",", "imax"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"red", "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{"R", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"1", ",", "i"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ord", "=", RowBox[{ RowBox[{"Ordering", "[", RowBox[{"red", ",", RowBox[{"-", "1"}]}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"red", "[", RowBox[{"[", "ord", "]"}], "]"}], ">", "max"}], ",", RowBox[{ RowBox[{"max", "=", RowBox[{"red", "[", RowBox[{"[", "ord", "]"}], "]"}]}], ";", RowBox[{"imax", "=", RowBox[{"{", RowBox[{"i", ",", RowBox[{"ord", "+", "i"}]}], "}"}]}]}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"Print", "[", RowBox[{ "i", ",", "red", ",", "ord", ",", "\"\<: \>\"", ",", "imax"}], "]"}], ";"}], "*)"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", "imax"}]}], "]"}]}]}], "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.82911387561845*^9, 3.82911387980996*^9}, {3.8291140601880813`*^9, 3.829114077233012*^9}, { 3.8291142346848373`*^9, 3.829114310000332*^9}, {3.8291143579819193`*^9, 3.8291143584671655`*^9}, {3.82911460663354*^9, 3.8291146215208473`*^9}, { 3.8291147439320517`*^9, 3.829114776610063*^9}}, CellLabel->"In[41]:=",ExpressionUUID->"544766d6-d2fe-43e8-890f-baebf302b87b"] }, Open ]], Cell[CellGroupData[{ Cell["Example", "Subsubsection", CellChangeTimes->{{3.8291145847748156`*^9, 3.8291145928899574`*^9}},ExpressionUUID->"8e247b42-b063-46ef-9864-\ 48a8418a179b"], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"R", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "11", ",", "3", ",", "6", ",", "4"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", "11", ",", "5", ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", "0", ",", "6", ",", "12"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", "0", ",", "0", ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", "0", ",", "0", ",", "0"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", "R", "]"}], "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"MinEl", "[", "R", "]"}]}], "]"}], "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"MaxEl", "[", "R", "]"}]}], "]"}]}], "Input", CellChangeTimes->{{3.8291139150908103`*^9, 3.829114037760685*^9}, { 3.8291143229600487`*^9, 3.8291143299426847`*^9}, 3.8291144219492884`*^9, { 3.829114628133978*^9, 3.8291146829541216`*^9}, 3.829114715593754*^9}, CellLabel->"In[43]:=",ExpressionUUID->"6e5308b3-ac78-499d-806b-1fa959d89274"], Cell[BoxData[ TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ {"0", "11", "3", "6", "4"}, {"0", "0", "11", "5", "2"}, {"0", "0", "0", "6", "12"}, {"0", "0", "0", "0", "6"}, {"0", "0", "0", "0", "0"} }, GridBoxAlignment->{"Columns" -> {{Center}}, "Rows" -> {{Baseline}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]], "Output", CellChangeTimes->{{3.8291139986427937`*^9, 3.8291140389003444`*^9}, 3.829114331013178*^9, 3.8291143624371963`*^9, 3.8291144233200316`*^9, { 3.829114684093872*^9, 3.829114716316805*^9}, 3.8291147923215456`*^9}, CellLabel-> "Out[44]//MatrixForm=",ExpressionUUID->"5c4853e5-9ac7-43f0-a85d-\ 63c4de1b559a"], Cell[CellGroupData[{ Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"PossitionMinEl: \"\>", "\[InvisibleSpace]", RowBox[{"{", RowBox[{"2", ",", "5"}], "}"}]}], SequenceForm["PossitionMinEl: ", {2, 5}], Editable->False]], "Print", CellChangeTimes->{ 3.829114038916011*^9, 3.829114331028802*^9, 3.829114362452814*^9, 3.8291144233200316`*^9, {3.829114684109494*^9, 3.829114716332445*^9}, 3.8291147923371644`*^9}, CellLabel-> "During evaluation of \ In[43]:=",ExpressionUUID->"9daaf6e6-b64a-485c-9514-af5690dfb45d"], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"PossitionMinEl: \"\>", "\[InvisibleSpace]", RowBox[{"{", RowBox[{"3", ",", "5"}], "}"}]}], SequenceForm["PossitionMinEl: ", {3, 5}], Editable->False]], "Print", CellChangeTimes->{ 3.829114038916011*^9, 3.829114331028802*^9, 3.829114362452814*^9, 3.8291144233200316`*^9, {3.829114684109494*^9, 3.829114716332445*^9}, 3.8291147923371644`*^9}, CellLabel-> "During evaluation of \ In[43]:=",ExpressionUUID->"3c5d9a4d-a0ed-4c60-977e-a72125487c77"] }, Open ]] }, Open ]] }, Open ]] }, WindowSize->{754, 463}, WindowMargins->{{Automatic, 244}, {142, Automatic}}, TaggingRules->{"SlideshowSettings" -> {"Toolbar" -> True}}, 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, 476, 8, 44, "Subsubsection",ExpressionUUID->"e66d6e93-d6b2-4c5b-9154-8959b5b959a5"], Cell[1059, 32, 1968, 34, 105, "Input",ExpressionUUID->"a16ffa28-7742-4592-bcc2-c1a697822085"], Cell[3030, 68, 5298, 133, 363, "Input",ExpressionUUID->"544766d6-d2fe-43e8-890f-baebf302b87b"] }, Open ]], Cell[CellGroupData[{ Cell[8365, 206, 162, 3, 44, "Subsubsection",ExpressionUUID->"8e247b42-b063-46ef-9864-48a8418a179b"], Cell[CellGroupData[{ Cell[8552, 213, 1208, 26, 86, "Input",ExpressionUUID->"6e5308b3-ac78-499d-806b-1fa959d89274"], Cell[9763, 241, 925, 24, 113, "Output",ExpressionUUID->"5c4853e5-9ac7-43f0-a85d-63c4de1b559a"], Cell[CellGroupData[{ Cell[10713, 269, 518, 13, 22, "Print",ExpressionUUID->"9daaf6e6-b64a-485c-9514-af5690dfb45d"], Cell[11234, 284, 518, 13, 22, "Print",ExpressionUUID->"3c5d9a4d-a0ed-4c60-977e-a72125487c77"] }, Open ]] }, Open ]] }, Open ]] } ] *)