(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 8.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 157, 7] NotebookDataLength[ 116746, 2592] NotebookOptionsPosition[ 116064, 2565] NotebookOutlinePosition[ 116442, 2582] CellTagsIndexPosition[ 116399, 2579] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"ClearAll", "[", "\"\\"", "]"}], ";"}], "\n", RowBox[{ RowBox[{ RowBox[{"Remove", "[", "\"\\"", "]"}], ";"}], " "}]}], "Input"], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"Remove", "::", "rmnsm"}], "MessageName"], ":", " ", "\<\"There are no symbols matching \ \\\"\[NoBreak]\\!\\(\\\"Global`*\\\"\\)\[NoBreak]\\\". \ \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", ButtonStyle->\\\"Link\\\", \ ButtonFrame->None, ButtonData:>\\\"paclet:ref/message/Remove/rmnsm\\\", \ ButtonNote -> \\\"Remove::rmnsm\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.6077577366794863`*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"Monitor", "[", RowBox[{ RowBox[{"Monitor", "[", RowBox[{ RowBox[{"Monitor", "[", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"For", "[", RowBox[{ RowBox[{"K", "=", "0.6"}], ",", RowBox[{"K", "\[LessEqual]", "0.85"}], ",", RowBox[{"K", "=", RowBox[{"K", "+", "0.01"}]}], ","}]}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"kick", "=", "0.1"}], ",", RowBox[{"kick", "\[LessEqual]", "0.1"}], ",", RowBox[{"kick", "=", RowBox[{"kick", "+", "0.5"}]}], ",", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"prob", "=", "1"}], ",", " ", RowBox[{"prob", "\[LessEqual]", "1"}], ",", " ", RowBox[{"prob", "=", RowBox[{"prob", "+", "0.1"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"JJ", "=", "1"}], ",", RowBox[{"JJ", "\[LessEqual]", "10"}], ",", RowBox[{"JJ", "++"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"A", " ", "=", " ", "3"}], ";", " ", "\n", RowBox[{"\[Epsilon]", " ", "=", " ", "0.2"}], ";", "\n", RowBox[{"\[Alpha]", " ", "=", " ", "3"}], ";", " ", RowBox[{"(*", " ", RowBox[{ "Changes", " ", "height", " ", "of", " ", "cubic", " ", "nullcline", " ", "peak"}], " ", "*)"}], "\n", RowBox[{"\[Gamma]", " ", "=", " ", "0.05"}], ";", " ", RowBox[{"(*", " ", RowBox[{ RowBox[{ RowBox[{"1", "/", "\[Gamma]"}], " ", "is", " ", "the", " ", "gradient", " ", "of", " ", "the", " ", "straight"}], "-", RowBox[{"line", " ", "nullcline"}]}], " ", "*)"}], "\n", RowBox[{"v0", " ", "=", " ", "0.4"}], ";", " ", RowBox[{"(*", " ", RowBox[{ RowBox[{ RowBox[{ RowBox[{"-", "1"}], "/", "\[Gamma]"}], " ", "v0", " ", "is", " ", "the", " ", "y", " ", "intercept", " ", "of", " ", "the", " ", "straight"}], "-", RowBox[{"line", " ", "nullcline"}]}], " ", "*)"}], "\n", RowBox[{"w0", " ", "=", " ", "0.4"}], ";", "\n", RowBox[{"T", " ", "=", " ", "27"}], ";", "\n", RowBox[{"n", " ", "=", " ", "27"}], ";", "\n", RowBox[{"m", " ", "=", " ", "27"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"prob", "=", " ", "1"}], ";"}], "*)"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"kick", " ", "=", " ", "1"}], ";"}], "*)"}], "\[IndentingNewLine]", "\n", "\n", RowBox[{"initial", " ", "=", " ", RowBox[{"Solve", "[", RowBox[{ RowBox[{ RowBox[{"wi", " ", "==", " ", RowBox[{ RowBox[{"A", "*", "vi", "*", RowBox[{"(", RowBox[{"vi", "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", "vi"}], ")"}]}], "-", "w0"}]}], " ", "&&", " ", RowBox[{"wi", " ", "==", " ", RowBox[{ RowBox[{"(", RowBox[{"vi", "-", "v0"}], ")"}], "/", "\[Gamma]"}]}]}], ",", " ", RowBox[{"{", RowBox[{"vi", ",", "wi"}], "}"}], ",", " ", "Reals"}], "]"}]}], ";", "\n", RowBox[{"initialline", " ", "=", " ", RowBox[{"Solve", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"wj", " ", "==", " ", RowBox[{ RowBox[{"A", "*", "vj", "*", RowBox[{"(", RowBox[{"vj", "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", "vj"}], ")"}]}], "-", "w0"}]}], " ", "&&", " ", RowBox[{"wj", " ", "==", " ", "wi"}]}], "/.", RowBox[{"initial", "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", RowBox[{"{", RowBox[{"vj", ",", "wj"}], "}"}], ",", "Reals"}], "]"}]}], ";", "\n", RowBox[{"localmax", " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"FindMaxValue", "[", RowBox[{ RowBox[{ RowBox[{"A", "*", "vi", "*", RowBox[{"(", RowBox[{"vi", "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", "vi"}], ")"}]}], "-", "w0"}], ",", " ", RowBox[{"{", RowBox[{"vi", ",", RowBox[{"vj", "/.", RowBox[{"initialline", "[", RowBox[{"[", "3", "]"}], "]"}]}]}], "}"}]}], "]"}], "-", "wi"}], "/.", RowBox[{"initial", "[", RowBox[{"[", "1", "]"}], "]"}]}]}], ";", "\n", "\n", RowBox[{"kickleftN", " ", "=", " ", RowBox[{"Floor", "[", RowBox[{ RowBox[{"(", RowBox[{"n", "-", "1"}], ")"}], "/", "2"}], "]"}]}], ";", "\n", RowBox[{"kickrightN", " ", "=", " ", RowBox[{"Floor", "[", RowBox[{ RowBox[{"(", RowBox[{"n", "+", "3"}], ")"}], "/", "2"}], "]"}]}], ";", "\t", "\n", RowBox[{"kickcellN", " ", "=", " ", RowBox[{"Floor", "[", RowBox[{ RowBox[{"(", RowBox[{"n", "+", "1"}], ")"}], "/", "2"}], "]"}]}], ";", "\n", "\n", RowBox[{"kickleftM", " ", "=", " ", RowBox[{"Floor", "[", RowBox[{ RowBox[{"(", RowBox[{"m", "-", "1"}], ")"}], "/", "2"}], "]"}]}], ";", "\n", RowBox[{"kickrightM", " ", "=", " ", RowBox[{"Floor", "[", RowBox[{ RowBox[{"(", RowBox[{"m", "+", "3"}], ")"}], "/", "2"}], "]"}]}], ";", "\t", "\n", RowBox[{"kickcellM", " ", "=", " ", RowBox[{"Floor", "[", RowBox[{ RowBox[{"(", RowBox[{"m", "+", "1"}], ")"}], "/", "2"}], "]"}]}], ";", "\n", "\n", RowBox[{"maxw1", " ", "=", " ", "0"}], ";", "\n", "\[IndentingNewLine]", RowBox[{"minscale", "=", RowBox[{"-", "0.25"}]}], ";", "\n", RowBox[{"maxscale", "=", "1.2"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"K", " ", "=", " ", "1"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"RRh", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"RandomChoice", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"1", "-", "prob"}], ",", "prob"}], "}"}], "->", RowBox[{"{", RowBox[{"0", ",", RowBox[{"RandomReal", "[", RowBox[{"{", RowBox[{"0.5", ",", "10"}], "}"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", "n", "}"}], ",", RowBox[{"{", RowBox[{"m", "+", "1"}], "}"}]}], "]"}]}], ";", "\n", RowBox[{"RRv", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"RandomChoice", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"1", "-", "prob"}], ",", "prob"}], "}"}], "->", RowBox[{"{", RowBox[{"0", ",", RowBox[{"RandomReal", "[", RowBox[{"{", RowBox[{"0.5", ",", "10"}], "}"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"n", "+", "1"}], "}"}], ",", RowBox[{"{", "m", "}"}]}], "]"}]}], ";", "\n", RowBox[{"RRh", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"RRh", ",", RowBox[{ RowBox[{"{", RowBox[{"_", ",", RowBox[{"1", "|", RowBox[{"m", "+", "1"}]}]}], "}"}], "->", "0"}]}], "]"}]}], ";", "\n", RowBox[{"RRv", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"RRv", ",", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"1", "|", RowBox[{"n", "+", "1"}]}], ",", "_"}], "}"}], "->", "0"}]}], "]"}]}], ";"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"RRh", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"RandomChoice", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"1", "-", "prob"}], ",", "prob"}], "}"}], "->", RowBox[{"{", RowBox[{"0", ",", "K"}], "}"}]}], "]"}], ",", RowBox[{"{", "n", "}"}], ",", RowBox[{"{", RowBox[{"m", "+", "1"}], "}"}]}], "]"}]}], ";", "\n", RowBox[{"RRv", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"RandomChoice", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"1", "-", "prob"}], ",", "prob"}], "}"}], "->", RowBox[{"{", RowBox[{"0", ",", "K"}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"n", "+", "1"}], "}"}], ",", RowBox[{"{", "m", "}"}]}], "]"}]}], ";", "\n", RowBox[{"RRh", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"RRh", ",", RowBox[{ RowBox[{"{", RowBox[{"_", ",", RowBox[{"1", "|", RowBox[{"m", "+", "1"}]}]}], "}"}], "->", "0"}]}], "]"}]}], ";", "\n", RowBox[{"RRv", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"RRv", ",", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"1", "|", RowBox[{"n", "+", "1"}]}], ",", "_"}], "}"}], "->", "0"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", "\[IndentingNewLine]", RowBox[{ RowBox[{"While", "[", RowBox[{ RowBox[{ RowBox[{"Mean", "[", RowBox[{"{", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "]"}], ",", RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"kickcellN", ",", RowBox[{"kickcellM", "+", "1"}]}], "]"}], "]"}], ",", RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "]"}], ",", RowBox[{"RRv", "[", RowBox[{"[", RowBox[{ RowBox[{"kickcellN", "+", "1"}], ",", "kickcellM"}], "]"}], "]"}]}], "}"}], "]"}], "\[Equal]", "0"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"RRh", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"RandomChoice", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"1", "-", "prob"}], ",", "prob"}], "}"}], "->", RowBox[{"{", RowBox[{"0", ",", "K"}], "}"}]}], "]"}], ",", RowBox[{"{", "n", "}"}], ",", RowBox[{"{", RowBox[{"m", "+", "1"}], "}"}]}], "]"}]}], ";", "\n", RowBox[{"RRv", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"RandomChoice", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"1", "-", "prob"}], ",", "prob"}], "}"}], "->", RowBox[{"{", RowBox[{"0", ",", "K"}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"n", "+", "1"}], "}"}], ",", RowBox[{"{", "m", "}"}]}], "]"}]}], ";", "\n", RowBox[{"RRh", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"RRh", ",", RowBox[{ RowBox[{"{", RowBox[{"_", ",", RowBox[{"1", "|", RowBox[{"m", "+", "1"}]}]}], "}"}], "->", "0"}]}], "]"}]}], ";", "\n", RowBox[{"RRv", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"RRv", ",", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"1", "|", RowBox[{"n", "+", "1"}]}], ",", "_"}], "}"}], "->", "0"}]}], "]"}]}]}]}], "]"}], ";"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Closed", " ", "Boundary", " ", "Conditions"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", "\n", RowBox[{"fitz", " ", "=", " ", RowBox[{"NDSolve", "[", RowBox[{ RowBox[{"Join", "[", StyleBox["\[IndentingNewLine]", FontSize->14], RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "1"}], "]"}], "'"}], "[", "t", "]"}], "==", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"A", "*", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "1"}], "]"}], "[", "t", "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "1"}], "]"}], "[", "t", "]"}], "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "1"}], "]"}], "[", "t", "]"}]}], ")"}]}], "-", RowBox[{ RowBox[{"w", "[", RowBox[{"1", ",", "1"}], "]"}], "[", "t", "]"}], "-", "w0"}], ")"}], "/", "\[Epsilon]"}], ")"}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "2"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "1"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"2", ",", "1"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"2", ",", "1"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "1"}], "]"}], "[", "t", "]"}]}], ")"}]}]}]}], "}"}], ",", "\n", "\n", "\t\t\t", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "i"}], "]"}], "'"}], "[", "t", "]"}], "==", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"A", "*", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "i"}], "]"}], "[", "t", "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "i"}], "]"}], "[", "t", "]"}], "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "i"}], "]"}], "[", "t", "]"}]}], ")"}]}], "-", RowBox[{ RowBox[{"w", "[", RowBox[{"1", ",", "i"}], "]"}], "[", "t", "]"}], "-", "w0"}], ")"}], "/", "\[Epsilon]"}], ")"}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"1", ",", "i"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", RowBox[{"i", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "i"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"2", ",", "i"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"2", ",", "i"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "i"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"1", ",", RowBox[{"i", "+", "1"}]}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", RowBox[{"i", "+", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "i"}], "]"}], "[", "t", "]"}]}], ")"}]}]}]}], ",", RowBox[{"{", RowBox[{"i", ",", "2", ",", RowBox[{"m", "-", "1"}]}], "}"}]}], "]"}], ",", "\n", "\t\t\t", "\n", "\t\t\t", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "m"}], "]"}], "'"}], "[", "t", "]"}], "==", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"A", "*", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "m"}], "]"}], "[", "t", "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "m"}], "]"}], "[", "t", "]"}], "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}], "-", RowBox[{ RowBox[{"w", "[", RowBox[{"1", ",", "m"}], "]"}], "[", "t", "]"}], "-", "w0"}], ")"}], "/", "\[Epsilon]"}], ")"}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"1", ",", "m"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", RowBox[{"m", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"2", ",", "m"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"2", ",", "m"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}]}]}], "}"}], ",", "\n", "\n", "\t\t\t", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "1"}], "]"}], "'"}], "[", "t", "]"}], "==", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"A", "*", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "1"}], "]"}], "[", "t", "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "1"}], "]"}], "[", "t", "]"}], "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "1"}], "]"}], "[", "t", "]"}]}], ")"}]}], "-", RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "1"}], "]"}], "[", "t", "]"}], "-", "w0"}], ")"}], "/", "\[Epsilon]"}], ")"}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"i", ",", "1"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "-", "1"}], ",", "1"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "1"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"i", ",", "2"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "2"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "1"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRv", "[", RowBox[{"[", RowBox[{ RowBox[{"i", "+", "1"}], ",", "1"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "+", "1"}], ",", "1"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "1"}], "]"}], "[", "t", "]"}]}], ")"}]}]}]}], ",", RowBox[{"{", RowBox[{"i", ",", "2", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}], ",", "\n", "\n", "\t\t\t", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "m"}], "]"}], "'"}], "[", "t", "]"}], "==", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"A", "*", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "m"}], "]"}], "[", "t", "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "m"}], "]"}], "[", "t", "]"}], "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}], "-", RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "m"}], "]"}], "[", "t", "]"}], "-", "w0"}], ")"}], "/", "\[Epsilon]"}], ")"}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"i", ",", "m"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "-", "1"}], ",", "m"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"i", ",", "m"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", RowBox[{"m", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRv", "[", RowBox[{"[", RowBox[{ RowBox[{"i", "+", "1"}], ",", "m"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "+", "1"}], ",", "m"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}]}]}], ",", RowBox[{"{", RowBox[{"i", ",", "2", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}], ",", "\n", "\n", "\t\t\t", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "1"}], "]"}], "'"}], "[", "t", "]"}], "==", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"A", "*", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "1"}], "]"}], "[", "t", "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "1"}], "]"}], "[", "t", "]"}], "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "1"}], "]"}], "[", "t", "]"}]}], ")"}]}], "-", RowBox[{ RowBox[{"w", "[", RowBox[{"n", ",", "1"}], "]"}], "[", "t", "]"}], "-", "w0"}], ")"}], "/", "\[Epsilon]"}], ")"}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"n", ",", "2"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "2"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "1"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"n", ",", "1"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"n", "-", "1"}], ",", "1"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "1"}], "]"}], "[", "t", "]"}]}], ")"}]}]}]}], "}"}], ",", "\n", "\n", "\t\t\t", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "i"}], "]"}], "'"}], "[", "t", "]"}], "==", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"A", "*", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "i"}], "]"}], "[", "t", "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "i"}], "]"}], "[", "t", "]"}], "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "i"}], "]"}], "[", "t", "]"}]}], ")"}]}], "-", RowBox[{ RowBox[{"w", "[", RowBox[{"n", ",", "i"}], "]"}], "[", "t", "]"}], "-", "w0"}], ")"}], "/", "\[Epsilon]"}], ")"}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"n", ",", "i"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", RowBox[{"i", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "i"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"n", ",", "i"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"n", "-", "1"}], ",", "i"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "i"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"n", ",", RowBox[{"i", "+", "1"}]}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", RowBox[{"i", "+", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "i"}], "]"}], "[", "t", "]"}]}], ")"}]}]}]}], ",", RowBox[{"{", RowBox[{"i", ",", "2", ",", RowBox[{"m", "-", "1"}]}], "}"}]}], "]"}], ",", "\n", "\n", "\t\t\t", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "m"}], "]"}], "'"}], "[", "t", "]"}], "==", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"A", "*", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "m"}], "]"}], "[", "t", "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "m"}], "]"}], "[", "t", "]"}], "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}], "-", RowBox[{ RowBox[{"w", "[", RowBox[{"n", ",", "m"}], "]"}], "[", "t", "]"}], "-", "w0"}], ")"}], "/", "\[Epsilon]"}], ")"}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"n", ",", "m"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", RowBox[{"m", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"n", ",", "m"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"n", "-", "1"}], ",", "m"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}]}]}], "}"}], ",", "\n", "\[IndentingNewLine]", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "'"}], "[", "t", "]"}], "==", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"A", "*", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}], "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], ")"}]}], "-", RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}], "-", "w0"}], ")"}], "/", "\[Epsilon]"}], ")"}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "-", "1"}], ",", "j"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", RowBox[{"j", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRv", "[", RowBox[{"[", RowBox[{ RowBox[{"i", "+", "1"}], ",", "j"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "+", "1"}], ",", "j"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], ")"}]}], "\[IndentingNewLine]", "+", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"i", ",", RowBox[{"j", "+", "1"}]}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", RowBox[{"j", "+", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], ")"}]}]}]}], ",", RowBox[{"{", RowBox[{"i", ",", "2", ",", RowBox[{"n", "-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "2", ",", RowBox[{"m", "-", "1"}]}], "}"}]}], "]"}], "]"}], ",", "\n", "\n", "\t\t\t", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "j"}], "]"}], "'"}], "[", "t", "]"}], "==", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}], "-", RowBox[{"\[Gamma]", "*", RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], "-", "v0"}]}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "m"}], "}"}]}], "]"}], "]"}], ",", "\n", "\n", "\t\t\t", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "0", "]"}], "==", RowBox[{"Evaluate", "[", RowBox[{"initial", "[", RowBox[{"[", RowBox[{"1", ",", "1", ",", "2"}], "]"}], "]"}], "]"}]}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "kickleftN"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "m"}], "}"}]}], "]"}], "]"}], ",", "\n", "\t\t\t", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "0", "]"}], "==", RowBox[{"Evaluate", "[", RowBox[{"initial", "[", RowBox[{"[", RowBox[{"1", ",", "1", ",", "2"}], "]"}], "]"}], "]"}]}], ",", RowBox[{"{", RowBox[{"i", ",", "kickrightN", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "m"}], "}"}]}], "]"}], "]"}], ",", "\n", "\t\t\t", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", "j"}], "]"}], "[", "0", "]"}], "==", RowBox[{"Evaluate", "[", RowBox[{"initial", "[", RowBox[{"[", RowBox[{"1", ",", "1", ",", "2"}], "]"}], "]"}], "]"}]}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "kickleftM"}], "}"}]}], "]"}], "]"}], ",", "\n", "\t\t\t", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", "j"}], "]"}], "[", "0", "]"}], "==", RowBox[{"Evaluate", "[", RowBox[{"initial", "[", RowBox[{"[", RowBox[{"1", ",", "1", ",", "2"}], "]"}], "]"}], "]"}]}], ",", RowBox[{"{", RowBox[{"j", ",", "kickrightM", ",", "m"}], "}"}]}], "]"}], "]"}], ",", "\n", "\t\t\t", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "[", "0", "]"}], "==", RowBox[{"kick", "+", RowBox[{"Evaluate", "[", RowBox[{"initial", "[", RowBox[{"[", RowBox[{"1", ",", "1", ",", "2"}], "]"}], "]"}], "]"}]}]}], "}"}], ",", "\n", "\t\t\t", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "0", "]"}], "==", RowBox[{"Evaluate", "[", RowBox[{"initial", "[", RowBox[{"[", RowBox[{"1", ",", "2", ",", "2"}], "]"}], "]"}], "]"}]}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "m"}], "}"}]}], "]"}], "]"}]}], "]"}], ",", "\n", "\n", "\t\t\t", RowBox[{"Flatten", "[", RowBox[{"Join", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "m"}], "}"}]}], "]"}], ",", RowBox[{"Table", "[", RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "j"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "m"}], "}"}]}], "]"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", "\n", "\t\t\t", RowBox[{"{", RowBox[{"t", ",", "0", ",", "T"}], "}"}], ",", " ", RowBox[{"MaxSteps", "->", "100000"}]}], "]"}]}], ";", "\n", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"Locationmatrix", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", "j"}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "m"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Generations", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"Total", "[", RowBox[{"Abs", "[", RowBox[{ RowBox[{"Locationmatrix", "[", RowBox[{"[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "]"}], "-", RowBox[{"Locationmatrix", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}]}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "m"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Gaverage", "=", RowBox[{"Table", "[", RowBox[{"i", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"NumberExcited", "=", RowBox[{"Table", "[", RowBox[{"i", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"ExciteRatio", "=", RowBox[{"Table", "[", RowBox[{"i", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Surrounding", " ", "kicked", " ", "cell"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"GenerationCoordinates", "=", RowBox[{"Position", "[", RowBox[{"Generations", ",", "1"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"DD1", "=", RowBox[{"{", "1", "}"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"s", "=", "1"}], ",", RowBox[{"s", "\[LessEqual]", RowBox[{"Length", "[", "GenerationCoordinates", "]"}]}], ",", RowBox[{"s", "++"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"i", "=", RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"s", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"j", "=", RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"s", ",", "2"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"DD1", "=", RowBox[{"Append", "[", RowBox[{"DD1", ",", RowBox[{"Max", "[", RowBox[{"Last", "/@", RowBox[{"Level", "[", RowBox[{ RowBox[{"Cases", "[", RowBox[{ RowBox[{"ParametricPlot", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}], ",", RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], "}"}], "/.", RowBox[{"fitz", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "T"}], "}"}], ",", RowBox[{"PlotStyle", "->", RowBox[{"{", RowBox[{"{", RowBox[{"Purple", ",", RowBox[{"Thickness", "[", "Large", "]"}]}], "}"}], "}"}]}], ",", RowBox[{"Background", "->", "White"}], ",", RowBox[{"PlotRange", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "3.5"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "3"}], ",", "10"}], "}"}]}], "}"}]}]}], "]"}], "\n", ",", "_Line", ",", "Infinity"}], "]"}], ",", RowBox[{"{", RowBox[{"-", "2"}], "}"}]}], "]"}]}], "]"}]}], "]"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"NumberExcited", "[", RowBox[{"[", "1", "]"}], "]"}], "=", RowBox[{"Count", "[", RowBox[{ RowBox[{"Positive", "[", RowBox[{"Flatten", "[", RowBox[{"Delete", "[", RowBox[{"DD1", ",", "1"}], "]"}], "]"}], "]"}], ",", "True"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"ExciteRatio", "[", RowBox[{"[", "1", "]"}], "]"}], "=", RowBox[{ RowBox[{"NumberExcited", "[", RowBox[{"[", "1", "]"}], "]"}], "/", RowBox[{"Length", "[", "GenerationCoordinates", "]"}]}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Gaverage", "[", RowBox[{"[", "1", "]"}], "]"}], " ", "=", " ", RowBox[{"{", RowBox[{"1", ",", RowBox[{"Mean", "[", RowBox[{"{", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "]"}], ",", RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"kickcellN", ",", RowBox[{"kickcellM", "+", "1"}]}], "]"}], "]"}], ",", RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "]"}], ",", RowBox[{"RRv", "[", RowBox[{"[", RowBox[{ RowBox[{"kickcellN", "+", "1"}], ",", "kickcellM"}], "]"}], "]"}]}], "}"}], "]"}], ",", RowBox[{"ExciteRatio", "[", RowBox[{"[", "1", "]"}], "]"}]}], "}"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Middle", " ", "Generations"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"ii", "=", "2"}], ",", RowBox[{"ii", "\[LessEqual]", RowBox[{"n", "-", "2"}]}], ",", RowBox[{"ii", "++"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"GenerationCoordinates", "=", RowBox[{"Position", "[", RowBox[{"Generations", ",", "ii"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"valuestore", "=", RowBox[{"{", "1", "}"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"GG", "=", "1"}], ",", RowBox[{"GG", "\[LessEqual]", RowBox[{"Length", "[", "GenerationCoordinates", "]"}]}], ",", RowBox[{"GG", "++"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"GG", ",", "1"}], "]"}], "]"}], "-", "kickcellN"}], "<", "0"}], ",", "\[IndentingNewLine]", RowBox[{"valuestore", "=", RowBox[{"Append", "[", RowBox[{"valuestore", ",", RowBox[{"RRv", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"GG", ",", "1"}], "]"}], "]"}], "+", "1"}], ",", RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"GG", ",", "2"}], "]"}], "]"}]}], "]"}], "]"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"GG", ",", "1"}], "]"}], "]"}], "-", "kickcellN"}], ">", "0"}], ",", "\[IndentingNewLine]", RowBox[{"valuestore", "=", RowBox[{"Append", "[", RowBox[{"valuestore", ",", RowBox[{"RRv", "[", RowBox[{"[", RowBox[{ RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"GG", ",", "1"}], "]"}], "]"}], ",", RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"GG", ",", "2"}], "]"}], "]"}]}], "]"}], "]"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"GG", ",", "2"}], "]"}], "]"}], "-", "kickcellN"}], "<", "0"}], ",", "\[IndentingNewLine]", RowBox[{"valuestore", " ", "=", " ", RowBox[{"Append", "[", RowBox[{"valuestore", ",", RowBox[{"RRh", "[", RowBox[{"[", RowBox[{ RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"GG", ",", "1"}], "]"}], "]"}], ",", RowBox[{ RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"GG", ",", "2"}], "]"}], "]"}], "+", "1"}]}], "]"}], "]"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"GG", ",", "2"}], "]"}], "]"}], "-", "kickcellN"}], ">", "0"}], ",", "\[IndentingNewLine]", RowBox[{"valuestore", "=", RowBox[{"Append", "[", RowBox[{"valuestore", ",", RowBox[{"RRh", "[", RowBox[{"[", RowBox[{ RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"GG", ",", "1"}], "]"}], "]"}], ",", RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"GG", ",", "2"}], "]"}], "]"}]}], "]"}], "]"}]}], "]"}]}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"DD2", "=", RowBox[{"{", "1", "}"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"s", "=", "1"}], ",", RowBox[{"s", "\[LessEqual]", RowBox[{"Length", "[", "GenerationCoordinates", "]"}]}], ",", RowBox[{"s", "++"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"i", "=", RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"s", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"j", "=", RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"s", ",", "2"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"DD2", "=", RowBox[{"Append", "[", RowBox[{"DD2", ",", RowBox[{"Max", "[", RowBox[{"Last", "/@", RowBox[{"Level", "[", RowBox[{ RowBox[{"Cases", "[", RowBox[{ RowBox[{"ParametricPlot", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}], ",", RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], "}"}], "/.", RowBox[{"fitz", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "T"}], "}"}], ",", RowBox[{"PlotStyle", "->", RowBox[{"{", RowBox[{"{", RowBox[{"Purple", ",", RowBox[{"Thickness", "[", "Large", "]"}]}], "}"}], "}"}]}], ",", RowBox[{"Background", "->", "White"}], ",", RowBox[{"PlotRange", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "3.5"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "3"}], ",", "10"}], "}"}]}], "}"}]}]}], "]"}], "\n", ",", "_Line", ",", "Infinity"}], "]"}], ",", RowBox[{"{", RowBox[{"-", "2"}], "}"}]}], "]"}]}], "]"}]}], "]"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"NumberExcited", "[", RowBox[{"[", "ii", "]"}], "]"}], "=", RowBox[{"Count", "[", RowBox[{ RowBox[{"Positive", "[", RowBox[{"Flatten", "[", RowBox[{"Delete", "[", RowBox[{"DD2", ",", "1"}], "]"}], "]"}], "]"}], ",", "True"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"ExciteRatio", "[", RowBox[{"[", "ii", "]"}], "]"}], "=", RowBox[{ RowBox[{"NumberExcited", "[", RowBox[{"[", "ii", "]"}], "]"}], "/", RowBox[{"Length", "[", "GenerationCoordinates", "]"}]}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Gaverage", "[", RowBox[{"[", "ii", "]"}], "]"}], "=", RowBox[{"{", RowBox[{"ii", ",", RowBox[{"Mean", "[", RowBox[{"Flatten", "[", RowBox[{"Delete", "[", RowBox[{"valuestore", ",", "1"}], "]"}], "]"}], "]"}], ",", RowBox[{"ExciteRatio", "[", RowBox[{"[", "ii", "]"}], "]"}]}], "}"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Dealing", " ", "with", " ", "corners"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"corneraverage", "=", RowBox[{"{", "1", "}"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"GenerationCoordinates", "=", RowBox[{"Position", "[", RowBox[{"Generations", ",", RowBox[{"n", "-", "1"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"GG", "=", "1"}], ",", RowBox[{"GG", "\[LessEqual]", RowBox[{"Length", "[", "GenerationCoordinates", "]"}]}], ",", RowBox[{"GG", "++"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"GenerationCoordinates", "[", RowBox[{"[", "GG", "]"}], "]"}], "\[Equal]", RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}]}], ",", "\[IndentingNewLine]", RowBox[{"corneraverage", " ", "=", RowBox[{"Append", "[", RowBox[{"corneraverage", ",", RowBox[{"{", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}], ",", RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"2", ",", "1"}], "]"}], "]"}]}], "}"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"GenerationCoordinates", "[", RowBox[{"[", "GG", "]"}], "]"}], "\[Equal]", " ", RowBox[{"{", RowBox[{"n", ",", "1"}], "}"}]}], ",", "\[IndentingNewLine]", RowBox[{"corneraverage", " ", "=", RowBox[{"Append", "[", RowBox[{"corneraverage", ",", RowBox[{"{", RowBox[{ RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"n", ",", "1"}], "]"}], "]"}], ",", RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"n", ",", "2"}], "]"}], "]"}]}], "}"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"GenerationCoordinates", "[", RowBox[{"[", "GG", "]"}], "]"}], "\[Equal]", " ", RowBox[{"{", RowBox[{"1", ",", "n"}], "}"}]}], ",", "\[IndentingNewLine]", RowBox[{"corneraverage", " ", "=", RowBox[{"Append", "[", RowBox[{"corneraverage", ",", RowBox[{"{", RowBox[{ RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"1", ",", "n"}], "]"}], "]"}], ",", RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"2", ",", "n"}], "]"}], "]"}]}], "}"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"GenerationCoordinates", "[", RowBox[{"[", "GG", "]"}], "]"}], "\[Equal]", RowBox[{"{", RowBox[{"n", ",", "n"}], "}"}]}], ",", "\[IndentingNewLine]", RowBox[{"corneraverage", " ", "=", RowBox[{"Append", "[", RowBox[{"corneraverage", ",", RowBox[{"{", RowBox[{ RowBox[{"RRv", "[", RowBox[{"[", RowBox[{"n", ",", "n"}], "]"}], "]"}], ",", RowBox[{"RRh", "[", RowBox[{"[", RowBox[{"n", ",", "n"}], "]"}], "]"}]}], "}"}]}], "]"}]}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"DD3", "=", RowBox[{"{", "1", "}"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"s", "=", "1"}], ",", RowBox[{"s", "\[LessEqual]", RowBox[{"Length", "[", "GenerationCoordinates", "]"}]}], ",", RowBox[{"s", "++"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"i", "=", RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"s", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"j", "=", RowBox[{"GenerationCoordinates", "[", RowBox[{"[", RowBox[{"s", ",", "2"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"DD3", "=", RowBox[{"Append", "[", RowBox[{"DD3", ",", RowBox[{"Max", "[", RowBox[{"Last", "/@", RowBox[{"Level", "[", RowBox[{ RowBox[{"Cases", "[", RowBox[{ RowBox[{"ParametricPlot", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}], ",", RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], "}"}], "/.", RowBox[{"fitz", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "T"}], "}"}], ",", RowBox[{"PlotStyle", "->", RowBox[{"{", RowBox[{"{", RowBox[{"Purple", ",", RowBox[{"Thickness", "[", "Large", "]"}]}], "}"}], "}"}]}], ",", RowBox[{"Background", "->", "White"}], ",", RowBox[{"PlotRange", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "3.5"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "3"}], ",", "10"}], "}"}]}], "}"}]}]}], "]"}], "\n", ",", "_Line", ",", "Infinity"}], "]"}], ",", RowBox[{"{", RowBox[{"-", "2"}], "}"}]}], "]"}]}], "]"}]}], "]"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"NumberExcited", "[", RowBox[{"[", RowBox[{"n", "-", "1"}], "]"}], "]"}], "=", RowBox[{"Count", "[", RowBox[{ RowBox[{"Positive", "[", RowBox[{"Flatten", "[", RowBox[{"Delete", "[", RowBox[{"DD3", ",", "1"}], "]"}], "]"}], "]"}], ",", "True"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"ExciteRatio", "[", RowBox[{"[", RowBox[{"n", "-", "1"}], "]"}], "]"}], "=", RowBox[{ RowBox[{"NumberExcited", "[", RowBox[{"[", RowBox[{"n", "-", "1"}], "]"}], "]"}], "/", RowBox[{"Length", "[", "GenerationCoordinates", "]"}]}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Gaverage", "[", RowBox[{"[", RowBox[{"n", "-", "1"}], "]"}], "]"}], "=", RowBox[{"{", RowBox[{ RowBox[{"n", "-", "1"}], ",", RowBox[{"Mean", "[", RowBox[{"Flatten", "[", RowBox[{"Delete", "[", RowBox[{"corneraverage", ",", "1"}], "]"}], "]"}], "]"}], ",", RowBox[{"ExciteRatio", "[", RowBox[{"[", RowBox[{"n", "-", "1"}], "]"}], "]"}]}], "}"}]}], ";"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"CC", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Max", "[", RowBox[{"Last", "/@", RowBox[{"Level", "[", RowBox[{ RowBox[{"Cases", "[", RowBox[{ RowBox[{"ParametricPlot", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}], ",", RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], "}"}], "/.", RowBox[{"fitz", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "T"}], "}"}], ",", RowBox[{"PlotStyle", "->", RowBox[{"{", RowBox[{"{", RowBox[{"Purple", ",", RowBox[{"Thickness", "[", "Large", "]"}]}], "}"}], "}"}]}], ",", RowBox[{"Background", "->", "White"}], ",", RowBox[{"PlotRange", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "3.5"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "3"}], ",", "10"}], "}"}]}], "}"}]}]}], "]"}], "\n", ",", "_Line", ",", "Infinity"}], "]"}], ",", RowBox[{"{", RowBox[{"-", "2"}], "}"}]}], "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "m"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"Gaverage", "=", RowBox[{"Prepend", "[", RowBox[{"Gaverage", ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\""}], "}"}]}], "]"}]}], ";"}], "*)"}], "\[IndentingNewLine]", "\n", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"Export", "[", RowBox[{ RowBox[{ "\"\\"", "<>", RowBox[{"ToString", "[", "prob", "]"}], "<>", "\"\<_Pert_\>\"", "<>", RowBox[{"ToString", "[", "kick", "]"}], "<>", "\"\<_Iteration_\>\"", "<>", RowBox[{"ToString", "[", "JJ", "]"}], "<>", "\"\<.xls\>\""}], ",", "Gaverage"}], "]"}], ";"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"Export", "[", RowBox[{ RowBox[{ "\"\\"", "<>", RowBox[{"ToString", "[", "prob", "]"}], "<>", "\"\<_Pert_\>\"", "<>", RowBox[{"ToString", "[", "kick", "]"}], "<>", "\"\<_Iteration_\>\"", "<>", RowBox[{"ToString", "[", "JJ", "]"}], "<>", "\"\<.jpg\>\""}], ",", "FinalConnectionMatrix"}], "]"}], ";"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"clustersize", "[", "JJ", "]"}], " ", "=", " ", RowBox[{"Count", "[", RowBox[{ RowBox[{"Positive", "[", RowBox[{"Flatten", "[", "CC", "]"}], "]"}], ",", "True"}], "]"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Cluster", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"clustersize", "[", "JJ", "]"}], ",", RowBox[{"{", RowBox[{"JJ", ",", "1", ",", "100", ",", "1"}], "}"}]}], "]"}]}], ";"}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Export", "[", RowBox[{ RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "prob", "]"}], "<>", "\"\<_Pert_\>\"", "<>", RowBox[{"ToString", "[", "kick", "]"}], "<>", "\"\<.xls\>\""}], ",", "Cluster"}], "]"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}]}], "]"}], "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", ",", "JJ"}], "]"}], ",", "kick"}], "]"}], ",", "prob"}], "]"}], "\[IndentingNewLine]", "\n", "\[IndentingNewLine]"}], "\[IndentingNewLine]", "Cluster"}], "Input", CellChangeTimes->{{3.532606864785928*^9, 3.532606882168932*^9}, { 3.5326120717791023`*^9, 3.53261208989428*^9}, {3.532612183753501*^9, 3.5326122148930893`*^9}, {3.532612261523888*^9, 3.532612322791523*^9}, { 3.5326137218490543`*^9, 3.53261378719409*^9}, {3.532615615934325*^9, 3.5326156202040043`*^9}, {3.5326157883747797`*^9, 3.532615850763818*^9}, { 3.532682692725692*^9, 3.5326829782490597`*^9}, {3.532683090143605*^9, 3.532683100232452*^9}, {3.532683424818034*^9, 3.5326834263293247`*^9}, { 3.532683486398925*^9, 3.5326834868677073`*^9}, {3.532683652450959*^9, 3.532683672997684*^9}, {3.532683793370749*^9, 3.53268379393113*^9}, { 3.532683851097702*^9, 3.532683883616993*^9}, {3.532684355907588*^9, 3.532684389700838*^9}, {3.532684429926792*^9, 3.532684445466216*^9}, { 3.53268457750484*^9, 3.532684789324682*^9}, {3.53268482962416*^9, 3.532684845351305*^9}, {3.5326849023198833`*^9, 3.532684911398129*^9}, { 3.5326850541130257`*^9, 3.532685201271964*^9}, {3.532685666583823*^9, 3.532685688248933*^9}, {3.532685786469277*^9, 3.532685804724216*^9}, { 3.532685857817605*^9, 3.532685941162455*^9}, {3.53276078349255*^9, 3.532760793004826*^9}, {3.532769172068709*^9, 3.532769193054927*^9}, { 3.5327692287037907`*^9, 3.532769295044729*^9}, {3.532769374135459*^9, 3.532769428074271*^9}, {3.532769534021637*^9, 3.532769551773013*^9}, { 3.5327699111274223`*^9, 3.532769998176772*^9}, 3.532770046551955*^9, { 3.5327700838524837`*^9, 3.532770093704132*^9}, {3.532770174617778*^9, 3.5327702594120626`*^9}, {3.532770295710794*^9, 3.5327703164755383`*^9}, { 3.5327704534495487`*^9, 3.532770456234541*^9}, {3.532844336952189*^9, 3.5328443471468687`*^9}, {3.532845297633594*^9, 3.532845299360591*^9}, { 3.532845728389729*^9, 3.532845729513698*^9}, {3.532847071964898*^9, 3.532847074794471*^9}, {3.532847425965845*^9, 3.532847437878367*^9}, { 3.532847671003903*^9, 3.532847671179577*^9}, {3.532847731677341*^9, 3.5328477318859377`*^9}, {3.5328484082400713`*^9, 3.532848414625639*^9}, { 3.532850571663954*^9, 3.5328506065522213`*^9}, {3.532850686263096*^9, 3.532850687037674*^9}, {3.53483868662658*^9, 3.534838712230386*^9}, { 3.53484173175797*^9, 3.534841736112151*^9}, {3.5348418752426577`*^9, 3.534842061868259*^9}, {3.5348421184094954`*^9, 3.534842347148363*^9}, { 3.534843068806739*^9, 3.534843071373981*^9}, {3.534843138227895*^9, 3.5348431461707563`*^9}, {3.534843327748958*^9, 3.5348433279253883`*^9}, { 3.534843411278064*^9, 3.534843431459527*^9}, {3.534843486323204*^9, 3.534843501149116*^9}, 3.5348448949283867`*^9, {3.534846234932992*^9, 3.534846260797937*^9}, {3.5348464793888483`*^9, 3.5348465004326973`*^9}, { 3.537630474623178*^9, 3.537630666530549*^9}, {3.5376307063269672`*^9, 3.5376307267729607`*^9}, {3.5376307669929934`*^9, 3.537630888395961*^9}, { 3.537630938805624*^9, 3.537630940114752*^9}, {3.53763098026544*^9, 3.537630984302267*^9}, {3.538120337845372*^9, 3.538120339712873*^9}, { 3.5381203754170713`*^9, 3.538120460802527*^9}, 3.538120499975071*^9, { 3.538120533267537*^9, 3.538120553146269*^9}, {3.5381205968974123`*^9, 3.53812063556221*^9}, {3.5381206731761293`*^9, 3.538120679573641*^9}, { 3.538126692362749*^9, 3.5381266978544683`*^9}, {3.538126747718544*^9, 3.538126883751924*^9}, {3.538126999484828*^9, 3.5381270907226048`*^9}, { 3.5381271633060207`*^9, 3.538127330463004*^9}, {3.538197911054138*^9, 3.538197911380657*^9}, {3.538209543643197*^9, 3.538209588782267*^9}, { 3.538212760347987*^9, 3.538212803612235*^9}, {3.53821585297188*^9, 3.538215866399321*^9}, {3.538216800952414*^9, 3.538216801371394*^9}, { 3.538217439153715*^9, 3.538217440518195*^9}, {3.538229859847953*^9, 3.538229880164544*^9}, {3.538287236041144*^9, 3.5382872462283792`*^9}, { 3.538298204358006*^9, 3.538298225593841*^9}, {3.53837544277357*^9, 3.538375454330882*^9}, {3.538388219396018*^9, 3.538388229657449*^9}, { 3.53846765766399*^9, 3.53846766404914*^9}, {3.538474612851554*^9, 3.538474633646576*^9}, {3.5384746823942633`*^9, 3.53847474456892*^9}, 3.538474783605525*^9, 3.538474824943138*^9, 3.538474988601432*^9, { 3.5384750325354633`*^9, 3.5384750466319313`*^9}, {3.538475421678732*^9, 3.538475435773162*^9}, {3.538475899878191*^9, 3.538475900940062*^9}, { 3.53867763147766*^9, 3.538677634913357*^9}, {3.538677684126116*^9, 3.53867770182693*^9}, {3.538679137707127*^9, 3.538679139607435*^9}, 3.5387233610872927`*^9, {3.538738462455194*^9, 3.5387385468818817`*^9}, { 3.538738585192383*^9, 3.538738655337925*^9}, {3.5387392980415707`*^9, 3.538739300507572*^9}, {3.538739349824559*^9, 3.538739349990919*^9}, { 3.5387482317661037`*^9, 3.538748234426935*^9}, {3.538814622819821*^9, 3.5388146406348124`*^9}, {3.538814675470208*^9, 3.5388148764774733`*^9}, { 3.538827989785778*^9, 3.538827990652678*^9}, {3.538851551350605*^9, 3.538851551703082*^9}, {3.5389113386706553`*^9, 3.538911338787636*^9}, { 3.538925890376957*^9, 3.538925986027272*^9}, {3.538998058577771*^9, 3.5389980591915617`*^9}, {3.538998111389963*^9, 3.538998194348056*^9}, { 3.53899825250804*^9, 3.538998313382351*^9}, {3.538999623252901*^9, 3.538999631040188*^9}, {3.5390711642162037`*^9, 3.539071175321067*^9}, { 3.5390758235178957`*^9, 3.539075824953673*^9}, {3.539080959892076*^9, 3.5390809674568996`*^9}, {3.5390810139120483`*^9, 3.5390810149301167`*^9}, {3.539238062886858*^9, 3.5392380994885902`*^9}, { 3.539239310235322*^9, 3.53923931445253*^9}, {3.5393314754931507`*^9, 3.5393315123313723`*^9}, 3.539331554030561*^9, 3.5394252153660383`*^9, 3.539425250398868*^9, {3.539425316204238*^9, 3.539425443155208*^9}, { 3.5394255817779913`*^9, 3.5394256281108418`*^9}, {3.539426495281459*^9, 3.539426610306405*^9}, {3.539426644515367*^9, 3.539426710847992*^9}, { 3.539426740906198*^9, 3.539426773239936*^9}, {3.539427059276597*^9, 3.539427093504696*^9}, {3.539515500341571*^9, 3.5395155375671577`*^9}, { 3.539616464088415*^9, 3.539616487926779*^9}, {3.539670403166953*^9, 3.539670464150799*^9}, {3.539670500953927*^9, 3.539670507346815*^9}, { 3.5481471565353107`*^9, 3.5481471944730997`*^9}, {3.548147230042407*^9, 3.548147244695425*^9}, {3.5481477496985683`*^9, 3.5481478027208357`*^9}, { 3.548148310801464*^9, 3.548148311685224*^9}, {3.54848460795864*^9, 3.5484846254394484`*^9}, {3.549086657497126*^9, 3.5490866610982847`*^9}, { 3.560758941622624*^9, 3.560758958850376*^9}, {3.560758990997991*^9, 3.560759002001153*^9}, {3.560759315544669*^9, 3.560759325411408*^9}, { 3.560759397362455*^9, 3.560759424338458*^9}, {3.560768880121932*^9, 3.560768964632924*^9}, {3.5607697131883307`*^9, 3.560770012973217*^9}, { 3.560770048304431*^9, 3.560770195898653*^9}, {3.5607702330338087`*^9, 3.560770363828699*^9}, {3.5607709393929863`*^9, 3.56077094092467*^9}, { 3.560770992791106*^9, 3.560771022542253*^9}, {3.560771058928689*^9, 3.560771099731422*^9}, {3.560771910648651*^9, 3.560771914115003*^9}, { 3.560771979361847*^9, 3.560771997986713*^9}, {3.560772066901334*^9, 3.5607720687171783`*^9}, {3.560846035340934*^9, 3.5608460548703623`*^9}, { 3.561113414212513*^9, 3.561113500318898*^9}, {3.561113646488562*^9, 3.561113702894988*^9}, {3.561113775951569*^9, 3.561113831406784*^9}, { 3.56111423988494*^9, 3.5611142521879253`*^9}, {3.561114365556638*^9, 3.561114393805148*^9}, {3.561114504362121*^9, 3.561114533628491*^9}, { 3.561114937381171*^9, 3.561114938074915*^9}, {3.561114991037462*^9, 3.561114993667945*^9}, {3.561115131666616*^9, 3.56111513184874*^9}, { 3.561115167073344*^9, 3.561115565608416*^9}, {3.561115598214867*^9, 3.561115645982843*^9}, {3.561115697285351*^9, 3.5611156989087877`*^9}, { 3.561115735938019*^9, 3.561115985976391*^9}, {3.561116092562921*^9, 3.5611161385924377`*^9}, {3.56111617182408*^9, 3.561116200941956*^9}, { 3.561116245250243*^9, 3.5611162608151827`*^9}, {3.5611163275256577`*^9, 3.5611163553193817`*^9}, {3.5611163964385777`*^9, 3.561116440388575*^9}, { 3.561116492745207*^9, 3.561116523921542*^9}, {3.5611165597144814`*^9, 3.561116567649485*^9}, {3.561116663904161*^9, 3.5611167520382566`*^9}, { 3.561116824896825*^9, 3.561116899629264*^9}, 3.561117074883214*^9, { 3.5611171166508417`*^9, 3.561117176840796*^9}, {3.561117483474621*^9, 3.5611174906661367`*^9}, {3.561117710247404*^9, 3.561117957367427*^9}, { 3.561118008265441*^9, 3.561118009668408*^9}, {3.561118130884516*^9, 3.561118161696343*^9}, {3.561118198298542*^9, 3.561118364905397*^9}, 3.561118423501408*^9, {3.56111880129158*^9, 3.561118815927989*^9}, { 3.561187023562702*^9, 3.5611870262624598`*^9}, {3.56119796384277*^9, 3.5611979683877363`*^9}, {3.561198207314464*^9, 3.5611982093981867`*^9}, { 3.561279901709257*^9, 3.5612799328482924`*^9}, {3.561279967687543*^9, 3.5612799691662407`*^9}, {3.561287084230709*^9, 3.561287085070229*^9}, { 3.561371695421484*^9, 3.561371702745679*^9}, {3.561371744758996*^9, 3.56137188106717*^9}, {3.561371987237445*^9, 3.561371997009467*^9}, { 3.561372039269755*^9, 3.561372056583322*^9}, {3.5617258517120743`*^9, 3.561725977004381*^9}, {3.561791871467239*^9, 3.561791895073552*^9}, { 3.561791963197163*^9, 3.5617920026534986`*^9}, 3.561793163465549*^9, 3.5617932023464527`*^9, {3.5619677629789867`*^9, 3.56196791758988*^9}, { 3.561968283674238*^9, 3.5619682859706163`*^9}, {3.5619685634772387`*^9, 3.5619685678838453`*^9}, {3.5620579974878798`*^9, 3.5620579994252663`*^9}, {3.567246224718321*^9, 3.567246297661579*^9}, { 3.5672468880574007`*^9, 3.567246889776676*^9}, {3.5672472961269217`*^9, 3.567247298845512*^9}, {3.5765759760456123`*^9, 3.5765760255762157`*^9}, { 3.5765808378100567`*^9, 3.57658085202477*^9}, {3.6077577061372747`*^9, 3.607757733794137*^9}, {3.607757978766226*^9, 3.607757979745906*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{ "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", RowBox[{"clustersize", "[", "11", "]"}], ",", RowBox[{"clustersize", "[", "12", "]"}], ",", RowBox[{"clustersize", "[", "13", "]"}], ",", RowBox[{"clustersize", "[", "14", "]"}], ",", RowBox[{"clustersize", "[", "15", "]"}], ",", RowBox[{"clustersize", "[", "16", "]"}], ",", RowBox[{"clustersize", "[", "17", "]"}], ",", RowBox[{"clustersize", "[", "18", "]"}], ",", RowBox[{"clustersize", "[", "19", "]"}], ",", RowBox[{"clustersize", "[", "20", "]"}], ",", RowBox[{"clustersize", "[", "21", "]"}], ",", RowBox[{"clustersize", "[", "22", "]"}], ",", RowBox[{"clustersize", "[", "23", "]"}], ",", RowBox[{"clustersize", "[", "24", "]"}], ",", RowBox[{"clustersize", "[", "25", "]"}], ",", RowBox[{"clustersize", "[", "26", "]"}], ",", RowBox[{"clustersize", "[", "27", "]"}], ",", RowBox[{"clustersize", "[", "28", "]"}], ",", RowBox[{"clustersize", "[", "29", "]"}], ",", RowBox[{"clustersize", "[", "30", "]"}], ",", RowBox[{"clustersize", "[", "31", "]"}], ",", RowBox[{"clustersize", "[", "32", "]"}], ",", RowBox[{"clustersize", "[", "33", "]"}], ",", RowBox[{"clustersize", "[", "34", "]"}], ",", RowBox[{"clustersize", "[", "35", "]"}], ",", RowBox[{"clustersize", "[", "36", "]"}], ",", RowBox[{"clustersize", "[", "37", "]"}], ",", RowBox[{"clustersize", "[", "38", "]"}], ",", RowBox[{"clustersize", "[", "39", "]"}], ",", RowBox[{"clustersize", "[", "40", "]"}], ",", RowBox[{"clustersize", "[", "41", "]"}], ",", RowBox[{"clustersize", "[", "42", "]"}], ",", RowBox[{"clustersize", "[", "43", "]"}], ",", RowBox[{"clustersize", "[", "44", "]"}], ",", RowBox[{"clustersize", "[", "45", "]"}], ",", RowBox[{"clustersize", "[", "46", "]"}], ",", RowBox[{"clustersize", "[", "47", "]"}], ",", RowBox[{"clustersize", "[", "48", "]"}], ",", RowBox[{"clustersize", "[", "49", "]"}], ",", RowBox[{"clustersize", "[", "50", "]"}], ",", RowBox[{"clustersize", "[", "51", "]"}], ",", RowBox[{"clustersize", "[", "52", "]"}], ",", RowBox[{"clustersize", "[", "53", "]"}], ",", RowBox[{"clustersize", "[", "54", "]"}], ",", RowBox[{"clustersize", "[", "55", "]"}], ",", RowBox[{"clustersize", "[", "56", "]"}], ",", RowBox[{"clustersize", "[", "57", "]"}], ",", RowBox[{"clustersize", "[", "58", "]"}], ",", RowBox[{"clustersize", "[", "59", "]"}], ",", RowBox[{"clustersize", "[", "60", "]"}], ",", RowBox[{"clustersize", "[", "61", "]"}], ",", RowBox[{"clustersize", "[", "62", "]"}], ",", RowBox[{"clustersize", "[", "63", "]"}], ",", RowBox[{"clustersize", "[", "64", "]"}], ",", RowBox[{"clustersize", "[", "65", "]"}], ",", RowBox[{"clustersize", "[", "66", "]"}], ",", RowBox[{"clustersize", "[", "67", "]"}], ",", RowBox[{"clustersize", "[", "68", "]"}], ",", RowBox[{"clustersize", "[", "69", "]"}], ",", RowBox[{"clustersize", "[", "70", "]"}], ",", RowBox[{"clustersize", "[", "71", "]"}], ",", RowBox[{"clustersize", "[", "72", "]"}], ",", RowBox[{"clustersize", "[", "73", "]"}], ",", RowBox[{"clustersize", "[", "74", "]"}], ",", RowBox[{"clustersize", "[", "75", "]"}], ",", RowBox[{"clustersize", "[", "76", "]"}], ",", RowBox[{"clustersize", "[", "77", "]"}], ",", RowBox[{"clustersize", "[", "78", "]"}], ",", RowBox[{"clustersize", "[", "79", "]"}], ",", RowBox[{"clustersize", "[", "80", "]"}], ",", RowBox[{"clustersize", "[", "81", "]"}], ",", RowBox[{"clustersize", "[", "82", "]"}], ",", RowBox[{"clustersize", "[", "83", "]"}], ",", RowBox[{"clustersize", "[", "84", "]"}], ",", RowBox[{"clustersize", "[", "85", "]"}], ",", RowBox[{"clustersize", "[", "86", "]"}], ",", RowBox[{"clustersize", "[", "87", "]"}], ",", RowBox[{"clustersize", "[", "88", "]"}], ",", RowBox[{"clustersize", "[", "89", "]"}], ",", RowBox[{"clustersize", "[", "90", "]"}], ",", RowBox[{"clustersize", "[", "91", "]"}], ",", RowBox[{"clustersize", "[", "92", "]"}], ",", RowBox[{"clustersize", "[", "93", "]"}], ",", RowBox[{"clustersize", "[", "94", "]"}], ",", RowBox[{"clustersize", "[", "95", "]"}], ",", RowBox[{"clustersize", "[", "96", "]"}], ",", RowBox[{"clustersize", "[", "97", "]"}], ",", RowBox[{"clustersize", "[", "98", "]"}], ",", RowBox[{"clustersize", "[", "99", "]"}], ",", RowBox[{"clustersize", "[", "100", "]"}]}], "}"}]], "Output", CellChangeTimes->{3.607758045081256*^9}] }, Open ]], Cell[BoxData[ RowBox[{"(*", RowBox[{ RowBox[{ RowBox[{ RowBox[{"RRh2", "=", "RRh"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RRv2", "=", "RRv"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "n"}], ",", RowBox[{"i", "\[GreaterEqual]", "2"}], ",", RowBox[{"i", "--"}], ",", "\[IndentingNewLine]", RowBox[{"RRh2", "=", RowBox[{"Transpose", "[", RowBox[{"Insert", "[", RowBox[{ RowBox[{"Transpose", "[", "RRh2", "]"}], ",", RowBox[{ RowBox[{"Transpose", "[", "RRh", "]"}], "[", RowBox[{"[", "i", "]"}], "]"}], ",", "i"}], "]"}], "]"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "n"}], ",", RowBox[{"i", "\[GreaterEqual]", "2"}], ",", RowBox[{"i", "--"}], ",", "\[IndentingNewLine]", RowBox[{"RRv2", "=", RowBox[{"Insert", "[", RowBox[{"RRv2", ",", RowBox[{"RRv", "[", RowBox[{"[", "i", "]"}], "]"}], ",", "i"}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Horizontal", " ", "Connections"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"RRhcoord", " ", "=", " ", RowBox[{"Partition", "[", RowBox[{ RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", RowBox[{"2", "j"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "n"}], "}"}]}], "]"}], "]"}], ",", "2"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"RRhmatrix", "=", RowBox[{"Insert", "[", RowBox[{"RRh2", ",", RowBox[{"-", "1"}], ",", "RRhcoord"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"RRhcoord2", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", "i", "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "+", "1"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ZeroVector", " ", "=", " ", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", "0", "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"3", "n"}]}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"RRhmatrix2", " ", "=", " ", RowBox[{"Insert", "[", RowBox[{"RRhmatrix", ",", "ZeroVector", ",", "RRhcoord2"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"RRhcoord3", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"2", "i"}], "+", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"RRhmatrix3", "=", RowBox[{"Insert", "[", RowBox[{"RRhmatrix2", ",", "ZeroVector", ",", "RRhcoord3"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Vertical", " ", "Connections"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"RRvcoord", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"2", "i"}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"NegCoordValue", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"-", "1"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"RRvmatrix", "=", RowBox[{"Insert", "[", RowBox[{"RRv2", ",", "NegCoordValue", ",", "RRvcoord"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ZeroVector2", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"3", "n"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"RRvcoord2", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", "i", "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "+", "1"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"RRvmatrix2", " ", "=", " ", RowBox[{"Transpose", "[", RowBox[{"Insert", "[", RowBox[{ RowBox[{"Transpose", "[", "RRvmatrix", "]"}], ",", "ZeroVector2", ",", "RRvcoord2"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"RRvcoord3", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"2", "i"}], "+", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"RRvmatrix3", "=", RowBox[{"Transpose", "[", RowBox[{"Insert", "[", RowBox[{ RowBox[{"Transpose", "[", "RRvmatrix2", "]"}], ",", "ZeroVector2", ",", "RRvcoord3"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", "\n", RowBox[{"(*", " ", RowBox[{"Sum", " ", "the", " ", "two", " ", "matrices"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"ConnectionsMatrix", " ", "=", " ", RowBox[{"RRhmatrix3", "+", "RRvmatrix3"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"NegVector", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"-", "1"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"3", "n"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ConnectionsMatrix", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"ConnectionsMatrix", ",", RowBox[{ RowBox[{"{", "1", "}"}], "\[Rule]", "NegVector"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ConnectionsMatrix", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"ConnectionsMatrix", ",", RowBox[{ RowBox[{"{", RowBox[{"3", "n"}], "}"}], "\[Rule]", "NegVector"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "2"}], ",", RowBox[{"i", "\[LessEqual]", RowBox[{"3", "n"}]}], ",", RowBox[{"i", "=", RowBox[{"i", "+", "1"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"ConnectionsMatrix", "=", RowBox[{"ReplacePart", "[", RowBox[{"ConnectionsMatrix", ",", RowBox[{ RowBox[{"{", RowBox[{"i", ",", "1"}], "}"}], "\[Rule]", RowBox[{"-", "1"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ConnectionsMatrix", "=", RowBox[{"ReplacePart", "[", RowBox[{"ConnectionsMatrix", ",", RowBox[{ RowBox[{"{", RowBox[{"i", ",", RowBox[{"3", "n"}]}], "}"}], "\[Rule]", RowBox[{"-", "1"}]}]}], "]"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "3"}], ",", RowBox[{"i", "\[LessEqual]", RowBox[{"3", "n"}]}], ",", RowBox[{"i", "=", RowBox[{"i", "+", "3"}]}], ",", "\[IndentingNewLine]", RowBox[{"ConnectionsMatrix", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"ConnectionsMatrix", ",", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", RowBox[{"3", "j"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "n"}], "}"}]}], "]"}], "\[Rule]", RowBox[{"-", "1"}]}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "4"}], ",", RowBox[{"i", "\[LessEqual]", RowBox[{ RowBox[{"3", "n"}], "+", "1"}]}], ",", RowBox[{"i", "=", RowBox[{"i", "+", "3"}]}], ",", "\[IndentingNewLine]", RowBox[{"ConnectionsMatrix", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"ConnectionsMatrix", ",", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", RowBox[{"3", "j"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "n"}], "}"}]}], "]"}], "\[Rule]", RowBox[{"-", "1"}]}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "3"}], ",", RowBox[{"i", "\[LessEqual]", RowBox[{"3", "n"}]}], ",", RowBox[{"i", "=", RowBox[{"i", "+", "3"}]}], ",", "\[IndentingNewLine]", RowBox[{"ConnectionsMatrix", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"ConnectionsMatrix", ",", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", RowBox[{ RowBox[{"3", "j"}], "+", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "n"}], "}"}]}], "]"}], "\[Rule]", RowBox[{"-", "1"}]}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "4"}], ",", RowBox[{"i", "\[LessEqual]", RowBox[{ RowBox[{"3", "n"}], "+", "1"}]}], ",", RowBox[{"i", "=", RowBox[{"i", "+", "3"}]}], ",", "\[IndentingNewLine]", RowBox[{"ConnectionsMatrix", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"ConnectionsMatrix", ",", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", RowBox[{ RowBox[{"3", "j"}], "+", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "n"}], "}"}]}], "]"}], "\[Rule]", RowBox[{"-", "1"}]}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"ConnectionsMatrix", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"ConnectionsMatrix", ",", RowBox[{ RowBox[{"{", " ", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"3", "n"}], "+", "1"}], ")"}], "/", "2"}], ",", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"3", "n"}], "+", "1"}], ")"}], "/", "2"}]}], "}"}], "\[Rule]", RowBox[{"-", "3"}]}]}], "]"}]}], ";"}], "*)"}]], "Input"], Cell[BoxData[ RowBox[{"(*", RowBox[{"FinalConnectionMatrixImage", "=", " ", RowBox[{"MatrixPlot", "[", RowBox[{"ConnectionsMatrix", ",", RowBox[{"ColorRules", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", "3"}], "\[Rule]", "White"}], ",", RowBox[{ RowBox[{"-", "2"}], "\[Rule]", RowBox[{"Darker", "[", "Black", "]"}]}], ",", RowBox[{ RowBox[{"-", "1"}], "\[Rule]", RowBox[{"Lighter", "[", "Gray", "]"}]}], ",", RowBox[{"0", "\[Rule]", RowBox[{"Lighter", "[", "Gray", "]"}]}]}], "}"}]}], ",", RowBox[{"ColorFunction", "->", RowBox[{"(", RowBox[{ RowBox[{"Blend", "[", RowBox[{ RowBox[{"{", RowBox[{"White", ",", RowBox[{"Darker", "[", "Gray", "]"}]}], "}"}], ",", "#"}], "]"}], "&"}], ")"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "1"}]}], "]"}]}], "*)"}]], "Input", CellChangeTimes->{{3.564829149959362*^9, 3.564829244530341*^9}, { 3.564830005520727*^9, 3.564830064432*^9}, {3.564830094530552*^9, 3.564830095014868*^9}, {3.564830663452902*^9, 3.564830691127857*^9}, 3.566405154072838*^9, 3.5671606399275293`*^9}], Cell[BoxData[ RowBox[{"(*", RowBox[{ RowBox[{"TruncatedMatrix", " ", "=", " ", RowBox[{"ConnectionsMatrix", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", "*", RowBox[{"(", RowBox[{"kickcellN", "-", "6"}], ")"}]}], ";;", RowBox[{"3", "*", RowBox[{"(", RowBox[{"kickcellN", "+", "6"}], ")"}]}]}], ",", RowBox[{ RowBox[{"3", "*", RowBox[{"(", RowBox[{"kickcellM", "-", "6"}], ")"}]}], ";;", RowBox[{"3", "*", RowBox[{"(", RowBox[{"kickcellM", "+", "6"}], ")"}]}]}]}], "]"}], "]"}]}], ";"}], "*)"}]], "Input", CellChangeTimes->{{3.5648312782251*^9, 3.564831281507188*^9}, { 3.564832676680789*^9, 3.5648327353106823`*^9}, {3.5648330972764883`*^9, 3.5648331950875177`*^9}, 3.566405194311061*^9, 3.567161555038845*^9}], Cell[BoxData[ RowBox[{"(*", RowBox[{"TruncatedConnectionMatrixImage", "=", " ", RowBox[{"MatrixPlot", "[", RowBox[{"TruncatedMatrix", ",", RowBox[{"ColorRules", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", "3"}], "\[Rule]", "White"}], ",", RowBox[{ RowBox[{"-", "2"}], "\[Rule]", RowBox[{"Darker", "[", "Black", "]"}]}], ",", RowBox[{ RowBox[{"-", "1"}], "\[Rule]", RowBox[{"Lighter", "[", "Gray", "]"}]}], ",", RowBox[{"0", "\[Rule]", RowBox[{"Lighter", "[", "Gray", "]"}]}]}], "}"}]}], ",", RowBox[{"ColorFunction", "->", RowBox[{"(", RowBox[{ RowBox[{"Blend", "[", RowBox[{ RowBox[{"{", RowBox[{"White", ",", RowBox[{"Darker", "[", "Gray", "]"}]}], "}"}], ",", "#"}], "]"}], "&"}], ")"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "1"}]}], "]"}]}], "*)"}]], "Input", CellChangeTimes->{{3.564833106735026*^9, 3.5648331224284143`*^9}, 3.566405196967668*^9, 3.567161557959979*^9}], Cell[BoxData[ RowBox[{"(*", RowBox[{"Export", "[", RowBox[{ "\"\\"", ",", "TruncatedConnectionMatrixImage"}], "]"}], "*)"}]], "Input", CellChangeTimes->{{3.5666323765770082`*^9, 3.566632393785363*^9}, 3.56714806107725*^9, 3.567160654516141*^9, {3.567162577786614*^9, 3.567162677910001*^9}, {3.567162923980915*^9, 3.567162972616968*^9}, 3.567247279470009*^9}] }, WindowSize->{1280, 693}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, ShowSelection->True, FrontEndVersion->"10.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (September 9, \ 2014)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[579, 22, 191, 5, 46, "Input"], Cell[773, 29, 455, 9, 24, "Message"] }, Open ]], Cell[CellGroupData[{ Cell[1265, 43, 95418, 2020, 4523, "Input"], Cell[96686, 2065, 4703, 95, 216, "Output"] }, Open ]], Cell[101404, 2163, 10886, 298, 964, "Input"], Cell[112293, 2463, 1250, 31, 46, "Input"], Cell[113546, 2496, 883, 24, 28, "Input"], Cell[114432, 2522, 1109, 29, 46, "Input"], Cell[115544, 2553, 516, 10, 46, "Input"] } ] *) (* End of internal cache information *)