(* 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[ 31319, 749] NotebookOptionsPosition[ 30859, 732] NotebookOutlinePosition[ 31204, 747] CellTagsIndexPosition[ 31161, 744] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["DIRECT Modul", "Subsubsection", CellChangeTimes->{{3.5690314804148345`*^9, 3.5690315052572556`*^9}, { 3.569034142379568*^9, 3.569034143986371*^9}},ExpressionUUID->"b1a4dadf-7ffe-4660-a745-\ 5bbcaa917f2d"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"Options", "[", "DIRECT", "]"}], "=", RowBox[{"{", RowBox[{ RowBox[{"Eps", "\[Rule]", "0"}], ",", RowBox[{"MaxIter", "\[Rule]", "20"}], ",", RowBox[{"DMin", "\[Rule]", RowBox[{"10.", "^", RowBox[{"(", RowBox[{"-", "2"}], ")"}]}]}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"DIRECT", "[", RowBox[{"f_", ",", "dom_", ",", RowBox[{"OptionsPattern", "[", "]"}]}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ "n", ",", "ff", ",", "c", ",", "d", ",", "dmax", ",", "fc", ",", "dmaxrazni", ",", "pot0", ",", "pot1", ",", "pot2", ",", "temp", ",", "ind", ",", "novic", ",", "novid", ",", "novifc", ",", "red", ",", "TMin", ",", RowBox[{"iter", "=", "0"}], ",", "dtest", ",", RowBox[{"anim", "=", RowBox[{"{", "}"}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"dtest", "=", RowBox[{"N", "[", RowBox[{ RowBox[{"OptionValue", "[", "DMin", "]"}], "/", RowBox[{"Max", "[", RowBox[{"(", RowBox[{ RowBox[{"dom", "[", RowBox[{"[", RowBox[{"All", ",", "2"}], "]"}], "]"}], "-", RowBox[{"dom", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ")"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"DIRECT", "::", "maxiter"}], "=", "\"\\""}], ";", "\[IndentingNewLine]", RowBox[{"n", "=", RowBox[{"Length", "[", "dom", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ "Scaling", " ", "the", " ", "function", " ", "onto", " ", "the", " ", "unit", " ", "hypercube"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"ff", "=", RowBox[{"Function", "[", RowBox[{"N", "[", RowBox[{ RowBox[{"f", "@@", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"{", "##", "}"}], RowBox[{"(", RowBox[{ RowBox[{"dom", "[", RowBox[{"[", RowBox[{"All", ",", "2"}], "]"}], "]"}], "-", RowBox[{"dom", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ")"}]}], "+", RowBox[{"dom", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ")"}]}], ",", "50"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Initial", " ", "centers", " ", "and", " ", "diameters"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"c", "=", RowBox[{"{", RowBox[{"Table", "[", RowBox[{ RowBox[{"1", "/", "2"}], ",", RowBox[{"{", RowBox[{"i", ",", "n"}], "}"}]}], "]"}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"d", "=", RowBox[{"{", RowBox[{"Table", "[", RowBox[{"1", ",", RowBox[{"{", RowBox[{"i", ",", "n"}], "}"}]}], "]"}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"dmax", "=", RowBox[{"{", RowBox[{"Max", "[", RowBox[{"d", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"dmaxrazni", "=", RowBox[{"Union", "[", "dmax", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"fc", "=", RowBox[{"{", RowBox[{"ff", "@@", RowBox[{"c", "[", RowBox[{"[", "1", "]"}], "]"}]}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"TMin", "=", RowBox[{"{", RowBox[{ RowBox[{"c", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"fc", "[", RowBox[{"[", "1", "]"}], "]"}]}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"MAIN", " ", "LOOP"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"Monitor", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"While", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"dmaxrazni", "[", RowBox[{"[", "1", "]"}], "]"}], ">", "dtest"}], ")"}], "&&", RowBox[{"(", RowBox[{"iter", "<", RowBox[{"OptionValue", "[", "MaxIter", "]"}]}], ")"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"iter", "++"}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{"STEP", " ", "1"}], ":", " ", RowBox[{ "Searching", " ", "for", " ", "the", " ", "potentially", " ", "optimal", " ", "hyperrectangle"}]}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"dmaxrazni", "=", RowBox[{"Union", "[", "dmax", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ "all", " ", "data", " ", "grouped", " ", "according", " ", "to", " ", "d"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"pot0", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Select", "[", RowBox[{ RowBox[{"Range", "[", RowBox[{"Length", "[", "fc", "]"}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"dmax", "[", RowBox[{"[", "#", "]"}], "]"}], "\[Equal]", RowBox[{"dmaxrazni", "[", RowBox[{"[", "i", "]"}], "]"}]}], "&"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"Length", "[", "dmaxrazni", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{ "data", " ", "with", " ", "the", " ", "lawest", " ", "f"}], "-", RowBox[{ "value", " ", "grouped", " ", "according", " ", "to", " ", "d"}]}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"pot1", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"pot0", "[", RowBox[{"[", RowBox[{"i", ",", RowBox[{ RowBox[{"Position", "[", RowBox[{ RowBox[{"fc", "[", RowBox[{"[", RowBox[{"pot0", "[", RowBox[{"[", "i", "]"}], "]"}], "]"}], "]"}], ",", RowBox[{"Min", "[", RowBox[{"fc", "[", RowBox[{"[", RowBox[{"pot0", "[", RowBox[{"[", "i", "]"}], "]"}], "]"}], "]"}], "]"}]}], "]"}], "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"Length", "[", "dmaxrazni", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ "checking", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "requirements"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"pot2", "=", RowBox[{"{", RowBox[{"pot1", "[", RowBox[{"[", RowBox[{"-", "1"}], "]"}], "]"}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", RowBox[{ RowBox[{ RowBox[{"temp", "=", RowBox[{"Min", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"fc", "[", RowBox[{"[", RowBox[{"pot1", "[", RowBox[{"[", RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], "]"}], "-", RowBox[{"fc", "[", RowBox[{"[", RowBox[{"pot2", "[", RowBox[{"[", RowBox[{"j", ",", "1"}], "]"}], "]"}], "]"}], "]"}]}], ")"}], "/", RowBox[{"(", RowBox[{ RowBox[{"dmax", "[", RowBox[{"[", RowBox[{"pot1", "[", RowBox[{"[", RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], "]"}], "-", RowBox[{"dmax", "[", RowBox[{"[", RowBox[{"pot2", "[", RowBox[{"[", RowBox[{"j", ",", "1"}], "]"}], "]"}], "]"}], "]"}]}], ")"}]}], ",", RowBox[{"{", RowBox[{"j", ",", RowBox[{"Length", "[", "pot2", "]"}]}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"temp", ">", RowBox[{"OptionValue", "[", "Eps", "]"}]}], "&&", RowBox[{"(", RowBox[{ RowBox[{"i", "\[Equal]", "1"}], "||", RowBox[{ RowBox[{"Max", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"fc", "[", RowBox[{"[", RowBox[{"pot1", "[", RowBox[{"[", RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], "]"}], "-", RowBox[{"fc", "[", RowBox[{"[", RowBox[{"pot1", "[", RowBox[{"[", RowBox[{"j", ",", "1"}], "]"}], "]"}], "]"}], "]"}]}], ")"}], "/", RowBox[{"(", RowBox[{ RowBox[{"dmax", "[", RowBox[{"[", RowBox[{"pot1", "[", RowBox[{"[", RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], "]"}], "-", RowBox[{"dmax", "[", RowBox[{"[", RowBox[{"pot1", "[", RowBox[{"[", RowBox[{"j", ",", "1"}], "]"}], "]"}], "]"}], "]"}]}], ")"}]}], ",", RowBox[{"{", RowBox[{"j", ",", RowBox[{"i", "-", "1"}]}], "}"}]}], "]"}], "]"}], "<", "temp"}]}], ")"}]}], "\[IndentingNewLine]", ",", RowBox[{"AppendTo", "[", RowBox[{"pot2", ",", RowBox[{"pot1", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}], "]"}], ";"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{ RowBox[{"Length", "[", "dmaxrazni", "]"}], "-", "1"}], ",", "1", ",", RowBox[{"-", "1"}]}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"pot2", "=", RowBox[{"Flatten", "[", RowBox[{"pot2", ",", "1"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{"STEP", " ", "2"}], ":", " ", RowBox[{ "dividing", " ", "the", " ", "potentially", " ", "optimal", " ", "directions"}]}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"dividing", " ", "directions"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"ind", "=", RowBox[{"Flatten", "[", RowBox[{"Position", "[", RowBox[{ RowBox[{"d", "[", RowBox[{"[", "pot", "]"}], "]"}], ",", RowBox[{"Max", "[", RowBox[{"d", "[", RowBox[{"[", "pot", "]"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"novic", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"c", "[", RowBox[{"[", "pot", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"2", "*", RowBox[{"Length", "[", "ind", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"novid", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"d", "[", RowBox[{"[", "pot", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"2", "*", RowBox[{"Length", "[", "ind", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"d", "[", RowBox[{"[", RowBox[{"pot", ",", "ind"}], "]"}], "]"}], "/=", "3"}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"dmax", "[", RowBox[{"[", "pot", "]"}], "]"}], "/=", "3"}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"novic", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "1"}], ",", RowBox[{"ind", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}], "]"}], "-=", RowBox[{"d", "[", RowBox[{"[", RowBox[{"pot", ",", RowBox[{"ind", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"novic", "[", RowBox[{"[", RowBox[{ RowBox[{"2", "i"}], ",", RowBox[{"ind", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}], "]"}], "+=", RowBox[{"d", "[", RowBox[{"[", RowBox[{"pot", ",", RowBox[{"ind", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"Length", "[", "ind", "]"}]}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"novifc", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"ff", "@@", RowBox[{"novic", "[", RowBox[{"[", "i", "]"}], "]"}]}], ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"Length", "[", "novic", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"red", "=", RowBox[{"Ordering", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"Min", "[", RowBox[{"{", RowBox[{ RowBox[{"novifc", "[", RowBox[{"[", RowBox[{ RowBox[{"2", "i"}], "-", "1"}], "]"}], "]"}], ",", RowBox[{"novifc", "[", RowBox[{"[", RowBox[{"2", "i"}], "]"}], "]"}]}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"Length", "[", "ind", "]"}]}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", RowBox[{ RowBox[{ RowBox[{"novid", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", RowBox[{"red", "[", RowBox[{"[", "j", "]"}], "]"}]}], "-", "1"}], ",", RowBox[{"ind", "[", RowBox[{"[", RowBox[{"red", "[", RowBox[{"[", "i", "]"}], "]"}], "]"}], "]"}]}], "]"}], "]"}], "=", RowBox[{ RowBox[{"novid", "[", RowBox[{"[", RowBox[{ RowBox[{"2", RowBox[{"red", "[", RowBox[{"[", "j", "]"}], "]"}]}], ",", RowBox[{"ind", "[", RowBox[{"[", RowBox[{"red", "[", RowBox[{"[", "i", "]"}], "]"}], "]"}], "]"}]}], "]"}], "]"}], "/=", "3"}]}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "red", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "i", ",", RowBox[{"Length", "[", "red", "]"}]}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"c", "=", RowBox[{"Join", "[", RowBox[{"c", ",", "novic"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"d", "=", RowBox[{"Join", "[", RowBox[{"d", ",", "novid"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"dmax", "=", RowBox[{"Join", "[", RowBox[{"dmax", ",", RowBox[{"Map", "[", RowBox[{"Max", ",", "novid"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"fc", "=", RowBox[{"Join", "[", RowBox[{"fc", ",", "novifc"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"novifc", "[", RowBox[{"[", RowBox[{ RowBox[{"2", RowBox[{"red", "[", RowBox[{"[", "1", "]"}], "]"}]}], "-", "1"}], "]"}], "]"}], "<", RowBox[{"TMin", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"TMin", "=", RowBox[{"N", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"novic", "[", RowBox[{"[", RowBox[{ RowBox[{"2", RowBox[{"red", "[", RowBox[{"[", "1", "]"}], "]"}]}], "-", "1"}], "]"}], "]"}], ",", RowBox[{"novifc", "[", RowBox[{"[", RowBox[{ RowBox[{"2", RowBox[{"red", "[", RowBox[{"[", "1", "]"}], "]"}]}], "-", "1"}], "]"}], "]"}]}], "}"}], ",", "10"}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"novifc", "[", RowBox[{"[", RowBox[{"2", RowBox[{"red", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}], "]"}], "<", RowBox[{"TMin", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"TMin", "=", RowBox[{"N", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"novic", "[", RowBox[{"[", RowBox[{"2", RowBox[{"red", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}], "]"}], ",", RowBox[{"novifc", "[", RowBox[{"[", RowBox[{"2", RowBox[{"red", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}], "]"}]}], "}"}], ",", "10"}], "]"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"pot", ",", "pot2"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"Print", "[", RowBox[{"iter", ",", "\"\<: \>\"", ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"TMin", "[", RowBox[{"[", "1", "]"}], "]"}], RowBox[{"(", RowBox[{ RowBox[{"dom", "[", RowBox[{"[", RowBox[{"All", ",", "2"}], "]"}], "]"}], "-", RowBox[{"dom", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ")"}]}], "+", RowBox[{"dom", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ",", RowBox[{"TMin", "[", RowBox[{"[", "2", "]"}], "]"}]}], "}"}]}], "]"}], ";"}], "*)"}], "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"iter", "\[Equal]", RowBox[{"OptionValue", "[", "MaxIter", "]"}]}], ",", RowBox[{ RowBox[{"Message", "[", RowBox[{ RowBox[{"DIRECT", "::", "maxiter"}], ",", RowBox[{"OptionValue", "[", "MaxIter", "]"}]}], "]"}], ";"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ "figure", " ", "for", " ", "the", " ", "2", "D", " ", "case"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"n", "\[Equal]", "2"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"AppendTo", "[", RowBox[{"anim", ",", "\[IndentingNewLine]", RowBox[{"Graphics", "[", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"Green", ",", RowBox[{"Rectangle", "[", "]"}]}], "}"}], ",", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"Blue", ",", RowBox[{"Rectangle", "[", RowBox[{ RowBox[{ RowBox[{"c", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{ RowBox[{"d", "[", RowBox[{"[", "i", "]"}], "]"}], "/", "2"}], "+", RowBox[{ RowBox[{"d", "[", RowBox[{"[", "i", "]"}], "]"}], "/", "10"}]}], ",", RowBox[{ RowBox[{"c", "[", RowBox[{"[", "i", "]"}], "]"}], "+", RowBox[{ RowBox[{"d", "[", RowBox[{"[", "i", "]"}], "]"}], "/", "2"}], "-", RowBox[{ RowBox[{"d", "[", RowBox[{"[", "i", "]"}], "]"}], "/", "10"}]}]}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"Length", "[", "d", "]"}]}], "}"}]}], "]"}], ",", RowBox[{"Point", "[", "c", "]"}]}], "}"}], "]"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}], "*)"}], "\[IndentingNewLine]", "]"}], ";"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"iter", ",", RowBox[{"Length", "[", "pot2", "]"}]}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"back", " ", "to", " ", "the", " ", "original", " ", "domain"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"TMin", "[", RowBox[{"[", "1", "]"}], "]"}], "=", RowBox[{ RowBox[{ RowBox[{"TMin", "[", RowBox[{"[", "1", "]"}], "]"}], RowBox[{"(", RowBox[{ RowBox[{"dom", "[", RowBox[{"[", RowBox[{"All", ",", "2"}], "]"}], "]"}], "-", RowBox[{"dom", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ")"}]}], "+", RowBox[{"dom", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ "printing", " ", "the", " ", "figure", " ", "in", " ", "the", " ", "2", "D", " ", "case"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"n", "\[Equal]", "2"}], ",", RowBox[{"Print", "[", RowBox[{"ListAnimate", "[", RowBox[{"anim", ",", RowBox[{"AnimationRunning", "\[Rule]", "False"}]}], "]"}], "]"}]}], "]"}], ";"}], "*)"}], "\[IndentingNewLine]", RowBox[{"Return", "[", "TMin", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}]}], "Input", InitializationCell->True, CellChangeTimes->{{3.5690282685181246`*^9, 3.5690282948786325`*^9}, { 3.5690283325717883`*^9, 3.569028377147338*^9}, {3.569028413363409*^9, 3.5690286275636606`*^9}, {3.5690287842946253`*^9, 3.5690288741987677`*^9}, {3.569028980607854*^9, 3.569028994988676*^9}, { 3.569029032554825*^9, 3.569029066964793*^9}, {3.5690291360257435`*^9, 3.569029139034915*^9}, {3.56902925171036*^9, 3.5690292912066193`*^9}, { 3.5690293287337656`*^9, 3.569029578720064*^9}, {3.569029619052371*^9, 3.569029657783586*^9}, {3.5690297936363564`*^9, 3.5690298040639524`*^9}, { 3.5690298854446077`*^9, 3.569029902780599*^9}, {3.5690299349124365`*^9, 3.569029937610591*^9}, {3.569030118563941*^9, 3.5690301319407063`*^9}, { 3.5690303469260025`*^9, 3.569030514669597*^9}, {3.569030550332637*^9, 3.569030568032649*^9}, {3.5690306363415565`*^9, 3.569030704429451*^9}, { 3.569030736262272*^9, 3.569030736604291*^9}, {3.569030814541749*^9, 3.5690308150677786`*^9}, {3.569030908481122*^9, 3.569030908938148*^9}, { 3.5690309721747646`*^9, 3.5690310044736123`*^9}, {3.5690310928516674`*^9, 3.569031133166973*^9}, {3.5690311721072006`*^9, 3.5690311755913997`*^9}, { 3.5690312057081223`*^9, 3.569031217839816*^9}, {3.569031298839449*^9, 3.5690313839433165`*^9}, {3.569031619688801*^9, 3.569031661484191*^9}, { 3.569031724786812*^9, 3.569031725743867*^9}, {3.5690318972166743`*^9, 3.5690319638634863`*^9}, {3.569032172902443*^9, 3.5690321734804754`*^9}, { 3.569032891911168*^9, 3.569032901895186*^9}, {3.5690329675713015`*^9, 3.5690330484262433`*^9}, {3.56903308638111*^9, 3.5690330867867107`*^9}, { 3.5690331529620266`*^9, 3.569033158858837*^9}, {3.5690332237549515`*^9, 3.569033273300638*^9}, {3.5690352716967516`*^9, 3.569035277187961*^9}, { 3.569035826121725*^9, 3.5690358340621395`*^9}, {3.569035877508216*^9, 3.5690358814862223`*^9}, {3.5690359230602956`*^9, 3.5690359400019255`*^9}, {3.5690359730271835`*^9, 3.569035989329212*^9}, { 3.5690361887755623`*^9, 3.569036191614767*^9}, {3.5690364020123367`*^9, 3.5690364135563574`*^9}, {3.5773906689475393`*^9, 3.5773907267398443`*^9}, {3.577390996030247*^9, 3.5773910663622704`*^9}, { 3.577392570136281*^9, 3.5773925795128174`*^9}, {3.577392625737461*^9, 3.577392644063509*^9}, 3.577394464618639*^9, {3.5799564494489346`*^9, 3.579956456710088*^9}, 3.5799565094498143`*^9, {3.5799565923496127`*^9, 3.579956592755282*^9}, {3.579956689879714*^9, 3.579956690221757*^9}, { 3.5799568985275793`*^9, 3.579956928013508*^9}, {3.5799570732540507`*^9, 3.579957077511533*^9}, {3.5799571531770415`*^9, 3.579957218341297*^9}, { 3.5799573896899137`*^9, 3.579957413402238*^9}, 3.5799574788229003`*^9, { 3.5799577604256535`*^9, 3.5799578140170593`*^9}, {3.5799578873582363`*^9, 3.579957938052377*^9}, {3.579957979011134*^9, 3.5799580262320967`*^9}, { 3.579958085262991*^9, 3.5799580879113255`*^9}, {3.869460644144539*^9, 3.8694606865037937`*^9}, {3.8694607220951033`*^9, 3.8694607742159557`*^9}, {3.8694608843660603`*^9, 3.869460969901916*^9}, { 3.8694610109540157`*^9, 3.86946115454287*^9}, {3.869461203278627*^9, 3.869461274069944*^9}, {3.869461443267308*^9, 3.869461495513445*^9}, { 3.8694616349847813`*^9, 3.869461646018703*^9}, {3.869461703042687*^9, 3.8694617514492607`*^9}, {3.86946180126527*^9, 3.869461846207727*^9}, 3.869461902227141*^9, {3.869461996532527*^9, 3.869462170604724*^9}, 3.8697178888060284`*^9}, CellLabel->"In[63]:=",ExpressionUUID->"b6d9f8a6-38fd-4a3a-a52b-9e820891f7a9"] }, Closed]] }, WindowSize->{1154, 889}, WindowMargins->{{-1920, Automatic}, {Automatic, 0}}, 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, 216, 4, 44, "Subsubsection",ExpressionUUID->"b1a4dadf-7ffe-4660-a745-5bbcaa917f2d"], Cell[799, 28, 30044, 701, 1394, "Input",ExpressionUUID->"b6d9f8a6-38fd-4a3a-a52b-9e820891f7a9", InitializationCell->True] }, Closed]] } ] *) (* End of internal cache information *)