(*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 0, 0] NotebookDataLength[ 113619, 2618] NotebookOptionsPosition[ 112528, 2578] NotebookOutlinePosition[ 112906, 2595] CellTagsIndexPosition[ 112863, 2592] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[{ RowBox[{ RowBox[{"ClearAll", "[", "\"\\"", "]"}], ";"}], "\n", RowBox[{ RowBox[{ RowBox[{"Remove", "[", "\"\\"", "]"}], ";"}], " "}]}], "Input", CellChangeTimes->{ 3.536581560083709*^9, 3.549704886147716*^9, {3.549777317829568*^9, 3.5497773198367853`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"Monitor", "[", RowBox[{ RowBox[{"Monitor", "[", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ "Cycling", " ", "through", " ", "connection", " ", "probability", " ", "and", " ", "iteriations"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"prob", "=", "0"}], ",", RowBox[{"prob", "\[LessEqual]", "1"}], ",", RowBox[{"prob", "=", RowBox[{"prob", "+", "0.1"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"JJ", "=", "1"}], ",", RowBox[{"JJ", "\[LessEqual]", "100"}], ",", RowBox[{"JJ", "++"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", " ", RowBox[{"(*", " ", "parameters", " ", "*)"}], "\[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[{"n", " ", "=", " ", "25"}], ";", "\n", RowBox[{"m", " ", "=", " ", "25"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"T", " ", "=", " ", "200"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"dt", " ", "=", " ", "0.05"}], ";", "\[IndentingNewLine]", RowBox[{"tmin", " ", "=", " ", "0"}], ";", "\[IndentingNewLine]", RowBox[{"tmax", " ", "=", " ", "T"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"\[Gamma]pace", " ", "=", " ", "0.09"}], ";", "\[IndentingNewLine]", RowBox[{"v0pace", " ", "=", " ", "0.7"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"K", " ", "=", " ", "1"}], ";", " ", RowBox[{"(*", " ", RowBox[{"Coupling", " ", "strength"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{"Intersection", " ", "of", " ", "non"}], "-", RowBox[{"pacemaker", " ", "nullclines"}]}], " ", "*)"}], "\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[{"FindMaxValue", "[", RowBox[{ RowBox[{ RowBox[{"A", "*", "vi", "*", RowBox[{"(", RowBox[{"vi", "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", "vi"}], ")"}]}], "-", "w0"}], ",", " ", RowBox[{"{", RowBox[{"vi", ",", RowBox[{"vj", "/.", RowBox[{"initialline", "[", RowBox[{"[", "3", "]"}], "]"}]}]}], "}"}]}], "]"}]}], ";", "\n", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Defining", " ", "the", " ", "pacemaker", " ", "cell"}], " ", "*)"}], "\[IndentingNewLine]", "\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.4"}]}], ";", "\n", RowBox[{"maxscale", "=", "3.2"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"RC", " ", "=", " ", RowBox[{"RandomChoice", "[", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"1", "-", "prob"}], ",", "prob"}], "}"}], " ", "\[Rule]", " ", RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}]}], ",", RowBox[{"{", RowBox[{ RowBox[{"2", "n"}], ",", "n"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Closed", " ", "Boundary", " ", "Conditions"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Solving", " ", "the", " ", "FHN", " ", "equations"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", 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]"}], ")"}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "2"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "1"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{"2", ",", "1"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", 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]"}], ")"}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{"1", ",", RowBox[{"i", "-", "1"}]}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", RowBox[{"i", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "i"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{"2", ",", "i"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"2", ",", "i"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "i"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{"1", ",", "i"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", 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]"}], ")"}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{"1", ",", RowBox[{"m", "-", "1"}]}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", RowBox[{"m", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"1", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{"2", ",", "m"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", 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]"}], ")"}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "2"}], ",", "1"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "-", "1"}], ",", "1"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "1"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "1"}], ",", "1"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "2"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "1"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{"2", "i"}], ",", "1"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", 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]"}], ")"}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "2"}], ",", "m"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "-", "1"}], ",", "m"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "1"}], ",", RowBox[{"m", "-", "1"}]}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", RowBox[{"m", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{"2", "i"}], ",", "m"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", 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]"}], ")"}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "n"}], "-", "1"}], ",", "1"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "2"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "1"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "n"}], "-", "2"}], ",", "1"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", 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]"}], ")"}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "n"}], "-", "1"}], ",", RowBox[{"i", "-", "1"}]}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", RowBox[{"i", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "i"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "n"}], "-", "2"}], ",", "i"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"n", "-", "1"}], ",", "i"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "i"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "n"}], "-", "1"}], ",", "i"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", 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]"}], ")"}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "n"}], "-", "1"}], ",", RowBox[{"m", "-", "1"}]}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", RowBox[{"m", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "n"}], "-", "2"}], ",", "m"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"n", "-", "1"}], ",", "m"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"n", ",", "m"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}]}]}], "}"}], ",", "\[IndentingNewLine]", "\n", 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]"}], ")"}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "2"}], ",", "j"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "-", "1"}], ",", "j"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "1"}], ",", RowBox[{"j", "-", "1"}]}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", RowBox[{"j", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{"2", "i"}], ",", "j"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "+", "1"}], ",", "j"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "1"}], ",", "j"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", 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[{"kickcellM", "-", "1"}]}], "}"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", "\[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]"}], ")"}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "2"}], ",", "j"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "-", "1"}], ",", "j"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "1"}], ",", RowBox[{"j", "-", "1"}]}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", RowBox[{"j", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{"2", "i"}], ",", "j"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "+", "1"}], ",", "j"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "j"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "1"}], ",", "j"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", 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", ",", RowBox[{"kickcellM", "+", "1"}], ",", RowBox[{"m", "-", "1"}]}], "}"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "'"}], "[", "t", "]"}], "==", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"A", "*", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], "-", RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", "w0"}], ")"}], "/", "\[Epsilon]"}], ")"}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "2"}], ",", "kickcellM"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "-", "1"}], ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "1"}], ",", RowBox[{"kickcellM", "-", "1"}]}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", RowBox[{"kickcellM", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{"2", "i"}], ",", "kickcellM"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "+", "1"}], ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "1"}], ",", "kickcellM"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", RowBox[{"kickcellM", "+", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}]}]}], ",", RowBox[{"{", RowBox[{"i", ",", "2", ",", RowBox[{"kickcellN", "-", "1"}]}], "}"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "'"}], "[", "t", "]"}], "==", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"A", "*", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], "-", RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", "w0"}], ")"}], "/", "\[Epsilon]"}], ")"}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "2"}], ",", "kickcellM"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "-", "1"}], ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "1"}], ",", RowBox[{"kickcellM", "-", "1"}]}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", RowBox[{"kickcellM", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{"2", "i"}], ",", "kickcellM"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"i", "+", "1"}], ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", "i"}], "-", "1"}], ",", "kickcellM"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", RowBox[{"kickcellM", "+", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}]}]}], ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"kickcellN", "+", "1"}], ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "'"}], "[", "t", "]"}], " ", "==", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"A", "*", RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "[", "t", "]"}], "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", "\[Alpha]"}], ")"}], "*", RowBox[{"(", RowBox[{"1", "-", RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], "-", RowBox[{ RowBox[{"w", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", "w0"}], ")"}], "/", "\[Epsilon]"}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", " ", "kickcellN"}], " ", "-", "1"}], ",", " ", RowBox[{"kickcellM", "-", "1"}]}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", RowBox[{"kickcellM", "-", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], " ", "+", " ", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", " ", "kickcellN"}], "-", "2"}], ",", " ", "kickcellM"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"kickcellN", "-", "1"}], ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], "+", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"2", " ", "kickcellN"}], "-", "1"}], ",", "kickcellM"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", RowBox[{"kickcellM", "+", "1"}]}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}], " ", "+", " ", RowBox[{ RowBox[{"RC", "[", RowBox[{"[", RowBox[{ RowBox[{"2", "kickcellN"}], ",", "kickcellM"}], "]"}], "]"}], "*", RowBox[{"(", RowBox[{"K", "*", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{ RowBox[{"kickcellN", "+", "1"}], ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], ")"}]}], ")"}]}]}]}], "}"}], ",", "\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", ",", RowBox[{"kickcellM", "-", "1"}]}], "}"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", 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", ",", RowBox[{"kickcellM", "+", "1"}], ",", "m"}], "}"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "'"}], "[", "t", "]"}], "==", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", RowBox[{"\[Gamma]", "*", RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], "-", "v0"}]}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"kickcellN", "-", "1"}]}], "}"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "'"}], "[", "t", "]"}], "==", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", RowBox[{"\[Gamma]", "*", RowBox[{ RowBox[{"w", "[", RowBox[{"i", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], "-", "v0"}]}], ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"kickcellN", "+", "1"}], ",", "n"}], "}"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"w", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "'"}], "[", "t", "]"}], " ", "\[Equal]", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "[", "t", "]"}], "-", RowBox[{"\[Gamma]pace", "*", RowBox[{ RowBox[{"w", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "[", "t", "]"}]}], "-", "v0pace"}]}], "}"}], ",", "\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", "]"}], "\[Equal]", " ", 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", "\[Rule]", "Infinity"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Calculating", " ", "pacemaker", " ", "frequency"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"middlecell", " ", "=", " ", RowBox[{"Evaluate", "[", RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "[", "t", "]"}], "/.", RowBox[{"fitz", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"middlecelltab", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"Evaluate", "[", "middlecell", "]"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "T"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"cutoff", " ", "=", " ", RowBox[{ RowBox[{"First", "[", RowBox[{"NMaximize", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"v", "[", RowBox[{"kickcellN", ",", "kickcellM"}], "]"}], "[", "t", "]"}], "/.", RowBox[{"fitz", "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", RowBox[{"0", "<", "t", "<", "T"}]}], "}"}], ",", "t"}], "]"}], "]"}], "-", "0.2"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Count", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Abs", "[", RowBox[{ RowBox[{"middlecelltab", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"middlecelltab", "[", RowBox[{"[", RowBox[{"i", "-", "1"}], "]"}], "]"}]}], "]"}], "<", RowBox[{"10", "^", RowBox[{"-", "2"}]}]}], ",", RowBox[{"{", RowBox[{"i", ",", "190", ",", RowBox[{"T", "+", "1"}]}], "}"}]}], "]"}], ",", "True"}], "]"}], "==", "0"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"timeseries", " ", "=", RowBox[{"Drop", "[", " ", RowBox[{ RowBox[{"Union", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"t", "/.", RowBox[{"FindRoot", "[", RowBox[{ RowBox[{"middlecell", "\[Equal]", "cutoff"}], ",", RowBox[{"{", RowBox[{"t", ",", "tInit", ",", "tmin", ",", "tmax"}], "}"}]}], "]"}]}], ",", RowBox[{"{", RowBox[{"tInit", ",", RowBox[{"tmin", "+", "dt"}], ",", RowBox[{"tmax", "-", "dt"}], ",", "dt"}], "}"}]}], "]"}], ",", RowBox[{"SameTest", "\[Rule]", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"Abs", "[", RowBox[{"#1", "-", "#2"}], "]"}], "<", RowBox[{"10", "^", RowBox[{"-", "3"}]}]}], "&"}], ")"}]}]}], "]"}], ",", RowBox[{"-", "1"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"timeseries2", " ", "=", " ", RowBox[{"Drop", "[", RowBox[{"timeseries", ",", " ", RowBox[{"{", RowBox[{"2", ",", RowBox[{"Length", "[", "timeseries", "]"}], ",", "2"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"timeperiod", "[", "JJ", "]"}], " ", "=", " ", RowBox[{ RowBox[{"timeseries2", "[", RowBox[{"[", RowBox[{"Length", "[", "timeseries2", "]"}], "]"}], "]"}], "-", RowBox[{"timeseries2", "[", RowBox[{"[", RowBox[{ RowBox[{"Length", "[", "timeseries2", "]"}], "-", "1"}], "]"}], "]"}]}]}], ";"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"timeperiod", "[", "JJ", "]"}], " ", "=", " ", "Null"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"periodtable2", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"timeperiod", "[", "JJ", "]"}], ",", RowBox[{"{", RowBox[{"JJ", ",", "1", ",", "100", ",", "1"}], "}"}]}], "]"}]}], ";", "\n", "\[IndentingNewLine]", RowBox[{"Export", "[", RowBox[{ RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "K", "]"}], "<>", "\"\<_Prob_\>\"", "<>", RowBox[{"ToString", "[", "prob", "]"}], "<>", "\"\<.xls\>\""}], ",", "periodtable2"}], "]"}]}]}], "]"}], ",", "JJ"}], "]"}], ",", "prob"}], "]"}], "\[IndentingNewLine]", "\[IndentingNewLine]"}]], "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.542016928567255*^9, 3.5420169808542423`*^9}, {3.5420170232680397`*^9, 3.542017033753131*^9}, { 3.542017439762351*^9, 3.542017443166464*^9}, {3.542017494575527*^9, 3.542017499335765*^9}, {3.542017584366378*^9, 3.542017590936756*^9}, { 3.5420177077420177`*^9, 3.542017711658813*^9}, {3.5420178108976097`*^9, 3.5420178171575003`*^9}, {3.542017885913797*^9, 3.542017888315339*^9}, { 3.5430535566420317`*^9, 3.543053672247675*^9}, {3.543081480819821*^9, 3.54308148208712*^9}, {3.543114994019388*^9, 3.543114994429138*^9}, { 3.543161868821003*^9, 3.543161870063583*^9}, {3.5432104986121492`*^9, 3.543210504842849*^9}, {3.543488615320879*^9, 3.543488624644906*^9}, { 3.543507057292161*^9, 3.543507057444282*^9}, {3.543637631965118*^9, 3.543637632900888*^9}, {3.543833841487005*^9, 3.543833850530611*^9}, { 3.544508520059523*^9, 3.544508711604801*^9}, {3.5446370827211533`*^9, 3.544637083092345*^9}, {3.544723202045258*^9, 3.5447232023276873`*^9}, { 3.5448412716945343`*^9, 3.544841272792016*^9}, {3.544879638855476*^9, 3.544879650096877*^9}, {3.544881043422696*^9, 3.544881047499053*^9}, { 3.545031240047674*^9, 3.54503125095853*^9}, {3.545031291762952*^9, 3.545031322642085*^9}, {3.5450472680096083`*^9, 3.545047374505567*^9}, { 3.545047668172763*^9, 3.545047790953741*^9}, {3.5450481522247543`*^9, 3.5450481556779737`*^9}, {3.545048241178499*^9, 3.545048370444646*^9}, { 3.545048605841061*^9, 3.5450486167986403`*^9}, {3.545048740914565*^9, 3.5450487423448067`*^9}, {3.545050516391433*^9, 3.5450505196176147`*^9}, { 3.545052026320458*^9, 3.545052079988549*^9}, {3.545052139121907*^9, 3.545052153212063*^9}, {3.5450522097497263`*^9, 3.54505223956376*^9}, { 3.545052374239431*^9, 3.545052377567051*^9}, {3.545052506940734*^9, 3.545052507091262*^9}, {3.545052554596664*^9, 3.545052841167931*^9}, 3.545052876644014*^9, {3.545052913598878*^9, 3.545052938090016*^9}, { 3.545122165574794*^9, 3.5451221663133917`*^9}, {3.5451221991793528`*^9, 3.545122225324033*^9}, {3.545122581714266*^9, 3.54512258198761*^9}, { 3.545122663742078*^9, 3.5451227876258707`*^9}, {3.545122876012947*^9, 3.5451229378922987`*^9}, {3.5451229726725388`*^9, 3.545122974073681*^9}, 3.545123010630979*^9, {3.545123085174919*^9, 3.54512311195529*^9}, { 3.545123152892541*^9, 3.545123174790856*^9}, {3.5451232101218033`*^9, 3.5451232770296917`*^9}, 3.545123332624929*^9, {3.545123741645026*^9, 3.545123751496132*^9}, {3.545123800106042*^9, 3.545123800843266*^9}, { 3.545123865240234*^9, 3.5451238655923767`*^9}, {3.5454626665974007`*^9, 3.545462667949727*^9}, {3.5454628010899353`*^9, 3.545462802342003*^9}, { 3.545462889776354*^9, 3.545462895588512*^9}, {3.5454629997868967`*^9, 3.545463000751992*^9}, {3.545463640924694*^9, 3.5454636535261793`*^9}, { 3.545463819627701*^9, 3.545463828299856*^9}, {3.545473484626236*^9, 3.545473491749729*^9}, {3.54547372052402*^9, 3.5454737218372*^9}, { 3.545474086557822*^9, 3.545474086743305*^9}, {3.5454741196919193`*^9, 3.545474290703418*^9}, {3.545474365085167*^9, 3.545474366449871*^9}, { 3.545490251556322*^9, 3.5454902524859343`*^9}, {3.545492700072008*^9, 3.545492700434403*^9}, {3.5454929941841087`*^9, 3.545493026306234*^9}, { 3.545495201964044*^9, 3.545495205727249*^9}, {3.546146877868734*^9, 3.5461468796248283`*^9}, {3.5461472424504747`*^9, 3.546147259293845*^9}, { 3.546147458680749*^9, 3.546147484082258*^9}, {3.546147608021915*^9, 3.546147610543744*^9}, {3.5461476672950907`*^9, 3.5461476693384333`*^9}, { 3.546147841668515*^9, 3.546147843956588*^9}, {3.546147874219287*^9, 3.546148039597095*^9}, {3.546148087720866*^9, 3.5461480911940947`*^9}, { 3.546148124866562*^9, 3.546148126504509*^9}, {3.5461482398107224`*^9, 3.546148242387385*^9}, {3.546148540114626*^9, 3.546148543276417*^9}, { 3.546668760928164*^9, 3.546668764424118*^9}, {3.546669512052483*^9, 3.546669541022675*^9}, {3.5466712558433533`*^9, 3.54667125875383*^9}, { 3.5466714025391273`*^9, 3.5466714065624657`*^9}, {3.546671513059057*^9, 3.546671515095067*^9}, {3.547304089225624*^9, 3.5473040895510397`*^9}, { 3.547310203552023*^9, 3.547310204748871*^9}, {3.547311293326499*^9, 3.547311293458221*^9}, {3.547312890105049*^9, 3.5473130488562527`*^9}, { 3.547313485069509*^9, 3.547313485665039*^9}, {3.547313613432856*^9, 3.547313621324587*^9}, {3.5473137797137833`*^9, 3.5473138093871202`*^9}, { 3.547314081846126*^9, 3.547314115056786*^9}, {3.54731421154393*^9, 3.547314217269116*^9}, {3.547314303941732*^9, 3.547314305510169*^9}, { 3.54731442728648*^9, 3.547314430139208*^9}, {3.5473145255006113`*^9, 3.5473145350999727`*^9}, 3.547314629170411*^9, 3.547363404544951*^9, { 3.547363501496183*^9, 3.5473635088038607`*^9}, {3.54736438182868*^9, 3.547364381979444*^9}, 3.547364922483244*^9, {3.547380446076119*^9, 3.547380447102962*^9}, {3.547381450215629*^9, 3.547381451292016*^9}, { 3.547447345591778*^9, 3.547447346464527*^9}, {3.547447426677321*^9, 3.5474474269915743`*^9}, {3.5483157051450777`*^9, 3.5483157450610647`*^9}, {3.548316631124442*^9, 3.548316691225037*^9}, { 3.548317020241542*^9, 3.548317049868689*^9}, {3.548317126755691*^9, 3.548317127529193*^9}, {3.548319744759282*^9, 3.548319745576025*^9}, { 3.548319887298848*^9, 3.548319918371714*^9}, {3.548320265580591*^9, 3.548320275923359*^9}, {3.548320682264624*^9, 3.5483206827898827`*^9}, { 3.5483240144711943`*^9, 3.5483240148278913`*^9}, {3.5483244144974403`*^9, 3.548324414678474*^9}, {3.548325332025222*^9, 3.548325332605482*^9}, { 3.548326264120399*^9, 3.548326265229031*^9}, {3.54832653596953*^9, 3.548326536482244*^9}, {3.54832680754838*^9, 3.5483268076928043`*^9}, { 3.548327463013484*^9, 3.5483274638190727`*^9}, {3.548327963900489*^9, 3.548327964059668*^9}, {3.548328265450787*^9, 3.548328265903112*^9}, { 3.548328547968974*^9, 3.5483285483589287`*^9}, {3.548934729052847*^9, 3.548934813474833*^9}, {3.548934885471649*^9, 3.5489348870727453`*^9}, { 3.548935238266487*^9, 3.548935240578473*^9}, {3.549005480844571*^9, 3.5490055192069483`*^9}, {3.54900568271317*^9, 3.549005693416362*^9}, { 3.549015694919142*^9, 3.549015957282652*^9}, {3.5490842739041643`*^9, 3.549084487380288*^9}, {3.549086479762768*^9, 3.5490864846451063`*^9}, { 3.549086538073299*^9, 3.549086552120661*^9}, {3.549086601477612*^9, 3.549086601947423*^9}, {3.549086675693739*^9, 3.549086683679178*^9}, { 3.549086723027467*^9, 3.549086738312587*^9}, {3.549086773935854*^9, 3.54908677699522*^9}, {3.549086873343348*^9, 3.549086875916338*^9}, { 3.549086907289509*^9, 3.549086987392048*^9}, 3.549087045969491*^9, { 3.5490870993154297`*^9, 3.5490871324964247`*^9}, {3.5490875961583967`*^9, 3.549087626360208*^9}, {3.5490876943676367`*^9, 3.5490877306939697`*^9}, { 3.549094868544755*^9, 3.549094869042508*^9}, {3.549098505759453*^9, 3.54909850652285*^9}, {3.54910811966604*^9, 3.5491081198075533`*^9}, { 3.549127048163628*^9, 3.549127049239231*^9}, {3.549131078842556*^9, 3.5491310789881287`*^9}, {3.549192363507556*^9, 3.549192364884562*^9}, { 3.5491924408475447`*^9, 3.5491924414673433`*^9}, {3.54919247602073*^9, 3.549192476618147*^9}, {3.54919927308635*^9, 3.5491993028672037`*^9}, { 3.549203010782364*^9, 3.549203011065723*^9}, {3.549337673966283*^9, 3.549337690420307*^9}, {3.5494248022980347`*^9, 3.5494248029015503`*^9}, { 3.549484401090905*^9, 3.549484401236581*^9}, {3.549528963435158*^9, 3.5495289662070427`*^9}, {3.5495658337782373`*^9, 3.549565834117873*^9}, { 3.549600751103323*^9, 3.5496007515990677`*^9}, {3.549650155609775*^9, 3.549650155911797*^9}, {3.549704625247312*^9, 3.5497046541353483`*^9}, { 3.5497047817953873`*^9, 3.5497048374319267`*^9}, {3.5497048702511873`*^9, 3.549704906890953*^9}, {3.5497059027997713`*^9, 3.549705940929625*^9}, { 3.549709743973343*^9, 3.549709744622286*^9}, {3.549776408980742*^9, 3.549776417018085*^9}, {3.5497764564151297`*^9, 3.549776474279839*^9}, { 3.549776533960651*^9, 3.549776534540256*^9}, {3.549776750270699*^9, 3.549776750408584*^9}, {3.5497770208907824`*^9, 3.549777025634359*^9}, { 3.549777092701315*^9, 3.549777110922018*^9}, {3.549777148942144*^9, 3.549777163032571*^9}, {3.549777208426346*^9, 3.5497772109319143`*^9}, { 3.5497789134252234`*^9, 3.549778914675816*^9}, {3.549779022339443*^9, 3.5497790517805233`*^9}, {3.5497792602254744`*^9, 3.549779313719618*^9}, { 3.54977967339149*^9, 3.549779685903554*^9}, {3.5497797188623734`*^9, 3.5497799053475437`*^9}, {3.549954232727322*^9, 3.5499542334523783`*^9}, { 3.5499542844608727`*^9, 3.549954285736802*^9}, {3.549954337899026*^9, 3.549954339234992*^9}, {3.549954375970398*^9, 3.549954377000415*^9}, { 3.549954474808865*^9, 3.549954498497761*^9}, {3.549954554985243*^9, 3.549954660047442*^9}, {3.5499553296295652`*^9, 3.549955330019621*^9}, { 3.550210787753209*^9, 3.550210818599176*^9}, {3.550210860008881*^9, 3.550210879821658*^9}, {3.550210911601803*^9, 3.550211018487391*^9}, { 3.55021190910468*^9, 3.5502119255988617`*^9}, {3.55021259951932*^9, 3.550212618116131*^9}, {3.550212656233769*^9, 3.55021266494943*^9}, { 3.5502180231279583`*^9, 3.550218023471623*^9}, {3.55022184311093*^9, 3.5502218457264137`*^9}, {3.5503800562906218`*^9, 3.5503800626117487`*^9}, {3.550380205661541*^9, 3.5503802078941593`*^9}, { 3.5503802719865007`*^9, 3.550380276223721*^9}, {3.550396215932459*^9, 3.5503963050106983`*^9}, {3.550396380487996*^9, 3.5503964127442207`*^9}, { 3.550396644940215*^9, 3.550396646219523*^9}, {3.550397353887744*^9, 3.5503973547906437`*^9}, 3.550398637905437*^9, {3.550467599111764*^9, 3.5504675995607357`*^9}, {3.550480787034421*^9, 3.550480789813986*^9}, { 3.5504951371594753`*^9, 3.550495137644044*^9}, {3.550495707363203*^9, 3.550495728347939*^9}, {3.550501067003173*^9, 3.550501109585329*^9}, { 3.55050170791227*^9, 3.5505017197967243`*^9}, {3.550502088246933*^9, 3.550502090410617*^9}, {3.5505022890676394`*^9, 3.55050236257528*^9}, { 3.5505171788240757`*^9, 3.550517199142767*^9}, {3.550814961149806*^9, 3.550814983058262*^9}, {3.550815136591158*^9, 3.550815157899081*^9}, { 3.550823307748494*^9, 3.550823319931562*^9}, {3.55082627458635*^9, 3.550826358770453*^9}, {3.550826448304575*^9, 3.5508264622052097`*^9}, { 3.550839759665447*^9, 3.55083976307174*^9}, {3.5508407310085173`*^9, 3.5508407348936167`*^9}, {3.550852184419526*^9, 3.55085218733593*^9}, 3.550852672360114*^9, {3.551421924297884*^9, 3.551421936909439*^9}, 3.551425664227054*^9, {3.551426260727524*^9, 3.551426260879908*^9}, { 3.551438668960882*^9, 3.551438674523821*^9}, {3.554707799380856*^9, 3.554707808253438*^9}, {3.5600814662516603`*^9, 3.56008146892594*^9}, { 3.560492155115732*^9, 3.5604921713419523`*^9}, {3.5672423999458303`*^9, 3.5672424070969276`*^9}, {3.567242440987956*^9, 3.5672424483246098`*^9}, { 3.5750026273016033`*^9, 3.575002635371153*^9}, {3.5750026658227863`*^9, 3.5750026919392776`*^9}, {3.631815974164386*^9, 3.6318159881108093`*^9}, { 3.6318160329012337`*^9, 3.631816095875346*^9}}], Cell[BoxData[ RowBox[{"(*", " ", RowBox[{"Calculating", " ", "a", " ", "connectivity", " ", "matrix"}], " ", "*)"}]], "Input", CellChangeTimes->{ 3.549884767394226*^9, 3.549884810707396*^9, {3.631815996336904*^9, 3.631816001054761*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"Conn", " ", "=", " ", RowBox[{"K", "*", "RC"}]}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"HConn", " ", "=", RowBox[{"Transpose", "[", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"Conn", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{ RowBox[{"2", "n"}], "-", "1"}], ",", "2"}], "}"}]}], "]"}], "]"}], ",", RowBox[{"-", "1"}]}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"VConn", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"Conn", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "2", ",", RowBox[{ RowBox[{"2", "n"}], "-", "1"}], ",", "2"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"HConn2", " ", "=", " ", "HConn"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"VConn2", " ", "=", " ", "VConn"}], ";"}]}], "Input", CellChangeTimes->{{3.5545474069996758`*^9, 3.554547407957098*^9}, 3.5672400173532343`*^9}], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", RowBox[{"n", "-", "1"}]}], ",", RowBox[{"i", "\[GreaterEqual]", "1"}], ",", RowBox[{"i", "--"}], ",", "\[IndentingNewLine]", RowBox[{"HConn2", "=", RowBox[{"Transpose", "[", RowBox[{"Insert", "[", RowBox[{ RowBox[{"Transpose", "[", "HConn2", "]"}], ",", RowBox[{ RowBox[{"Transpose", "[", "HConn", "]"}], "[", RowBox[{"[", "i", "]"}], "]"}], ",", "i"}], "]"}], "]"}]}]}], "]"}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", RowBox[{"n", "-", "1"}]}], ",", RowBox[{"i", "\[GreaterEqual]", "1"}], ",", RowBox[{"i", "--"}], ",", "\[IndentingNewLine]", RowBox[{"VConn2", "=", RowBox[{"Insert", "[", RowBox[{"VConn2", ",", RowBox[{"VConn", "[", RowBox[{"[", "i", "]"}], "]"}], ",", "i"}], "]"}]}]}], "]"}], ";"}]}], "Input", CellChangeTimes->{{3.5672334170495853`*^9, 3.567233479268353*^9}, { 3.5672335610738697`*^9, 3.567233562423916*^9}, {3.567233715826046*^9, 3.567233717715337*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{"Horizontal", " ", "Connections"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"HConnCoord", " ", "=", " ", RowBox[{"Partition", "[", RowBox[{ RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", RowBox[{ RowBox[{"2", "j"}], "-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "n"}], "}"}]}], "]"}], "]"}], ",", "2"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"HConnMatrix", " ", "=", " ", RowBox[{"Insert", "[", RowBox[{"HConn2", ",", RowBox[{"-", "1"}], ",", "HConnCoord"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"HConnCoord2", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", "i", "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "+", "1"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ZeroVector", " ", "=", " ", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", "0", "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{ RowBox[{"3", "n"}], "-", "2"}]}], "}"}]}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"HConnMatrix2", " ", "=", " ", RowBox[{"Insert", "[", RowBox[{"HConnMatrix", ",", "ZeroVector", ",", "HConnCoord2"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"HConnCoord3", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"2", "i"}], "+", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"HConnMatrix3", " ", "=", " ", RowBox[{"Insert", "[", RowBox[{"HConnMatrix2", ",", "ZeroVector", ",", "HConnCoord3"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"HConnCoord4", " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", "1", "}"}], ",", RowBox[{"{", RowBox[{"3", "n"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ZeroVector2", " ", "=", " ", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", "0", "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"3", "n"}]}], "}"}]}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"HConnMatrix4", " ", "=", " ", RowBox[{"Transpose", "[", RowBox[{"Insert", "[", RowBox[{ RowBox[{"Transpose", "[", "HConnMatrix3", "]"}], ",", "ZeroVector2", ",", RowBox[{"{", RowBox[{ RowBox[{"{", "1", "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"3", "n"}], "-", "1"}], "}"}]}], "}"}]}], "]"}], "]"}]}], ";"}]}]}]], "Input", CellChangeTimes->{{3.5672337722090187`*^9, 3.567233807829074*^9}, { 3.5672338748903313`*^9, 3.567233881840331*^9}, {3.567234330981146*^9, 3.567234432037343*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{"Vertical", " ", "Connections"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"VConnCoord", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"2", "i"}], "-", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"NegCoordValue", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"-", "1"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"VConnMatrix", " ", "=", " ", RowBox[{"Insert", "[", RowBox[{"VConn2", ",", " ", "NegCoordValue", ",", " ", "VConnCoord"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"VConnCoord2", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", "i", "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "+", "1"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"VConnMatrix2", " ", "=", " ", RowBox[{"Transpose", "[", RowBox[{"Insert", "[", RowBox[{ RowBox[{"Transpose", "[", "VConnMatrix", "]"}], ",", "ZeroVector", ",", "VConnCoord2"}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"VConnCoord3", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"2", "i"}], "+", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"VConnMatrix3", " ", "=", RowBox[{"Transpose", "[", RowBox[{"Insert", "[", RowBox[{ RowBox[{"Transpose", "[", "VConnMatrix2", "]"}], ",", "ZeroVector", ",", "VConnCoord3"}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"VConnMatrix4", " ", "=", " ", RowBox[{"Insert", "[", RowBox[{"VConnMatrix3", ",", "ZeroVector2", ",", RowBox[{"{", RowBox[{ RowBox[{"{", "1", "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"3", "n"}], "-", "1"}], "}"}]}], "}"}]}], "]"}]}], ";"}]}]}]], "Input", CellChangeTimes->{{3.567237421754117*^9, 3.567237512877701*^9}, { 3.56723771701795*^9, 3.567237722010704*^9}, 3.5672379066918793`*^9}], Cell[BoxData[ RowBox[{ RowBox[{"ConnectionsMatrix", " ", "=", RowBox[{"HConnMatrix4", "+", "VConnMatrix4"}]}], ";"}]], "Input", CellChangeTimes->{{3.567237917321085*^9, 3.567237944831171*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"NegVector", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"-", "1"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"3", "n"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ConnectionsMatrix", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"ConnectionsMatrix", ",", RowBox[{ RowBox[{"{", "1", "}"}], "\[Rule]", "NegVector"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"ConnectionsMatrix", " ", "=", " ", RowBox[{"ReplacePart", "[", RowBox[{"ConnectionsMatrix", ",", RowBox[{ RowBox[{"{", RowBox[{"3", "n"}], "}"}], "\[Rule]", "NegVector"}]}], "]"}]}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ 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[{ RowBox[{ 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[{ RowBox[{ 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[{ RowBox[{ 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[{ RowBox[{ 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[{ 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[{"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[CellGroupData[{ Cell[BoxData[ 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[ GraphicsBox[ RasterBox[SparseArray[ Automatic, {37, 37}, 0.6666666666666666, { 1, {{0, 30, 56, 89, 122, 151, 180, 209, 240, 273, 306, 335, 366, 397, 425, 457, 489, 510, 542, 574, 599, 631, 663, 690, 724, 758, 787, 821, 855, 879, 910, 941, 971, 1006, 1041, 1074, 1104, 1134}, CompressedData[" 1:eJyNk0kagjAMhcuoMqPihDLKhTwCB9D77+xA27T2o65Y/MlL8vro589rdhFC bx8hB38d1w82210UJ2lWlPvD8XS+XG/3R9N2wzg5rucHIeZJjlGFSY1RP4xP QaI4zXLY2XaET38WsMmEU/UGwqW5KEmrWMoCxdSEitKZNaX6Wgnfq2ICQNxS wAeY5MVmoLWWvRZMpeFcagozHKxFrq50O9e5F1Jdg83asTYzjFzxohfbyFjx QxtpxBoXsooPeGvtUIXL1NorePYWDJIN4qX8E3qIbBVQHmO2PTdMvJLIrvIe FszCp171o61zg/5aiXGGGjTtds17E/0CictV+A== "]}, CompressedData[" 1:eJzlVtENQjEIxMRFnMQdTHQAE391Wkfw3xFMnvpj0lg4jkdLf0goLb3rlbI7 3w6XjYhctyLHZTz2vfa02Hu3P0vcb/zXymdo/a3xL96apzXfywfr3lj3hOat yoO3vtB3wcobzT9qvc43K06WDqN0z9ZxNj9qo+r3aDyw+ofsutfypI3L9m9X wz1qne49h5VH73qTdb/Z8bf0otUX+z2gfGX/T7V5quFn1cX3eIbVXy1uVtza 66vi99YTu3/onffmcRS/1WbDweaDrT+vfdF1Vp6i6uzauqjOB1rfrfr1yovy YY1DbZSOZ8Md1Wd472s9B8qfd1w2P7rOKy6Lv8r70PY9KM/W/dh50fONivcF uM4MGQ== "]}], {{0, 0}, {37, 37}}, {0, 1}], AspectRatio->1, Frame->True, FrameLabel->{None, None}, FrameTicks->{{{{36.5, FormBox["1", TraditionalForm]}, {27.5, FormBox["10", TraditionalForm]}, {17.5, FormBox["20", TraditionalForm]}, {7.5, FormBox["30", TraditionalForm]}, {0.5, FormBox["37", TraditionalForm]}}, {{36.5, FormBox["1", TraditionalForm]}, {27.5, FormBox["10", TraditionalForm]}, {17.5, FormBox["20", TraditionalForm]}, {7.5, FormBox["30", TraditionalForm]}, {0.5, FormBox["37", TraditionalForm]}}}, {{{0.5, FormBox["1", TraditionalForm]}, {9.5, FormBox["10", TraditionalForm]}, {19.5, FormBox["20", TraditionalForm]}, {29.5, FormBox["30", TraditionalForm]}, {36.5, FormBox["37", TraditionalForm]}}, {{0.5, FormBox["1", TraditionalForm]}, {9.5, FormBox["10", TraditionalForm]}, {19.5, FormBox["20", TraditionalForm]}, {29.5, FormBox["30", TraditionalForm]}, {36.5, FormBox["37", TraditionalForm]}}}}]], "Output", CellChangeTimes->{{3.5672380394137163`*^9, 3.567238059731515*^9}, 3.5672380947596073`*^9, 3.567239387066572*^9, 3.5672400343338614`*^9, { 3.567242515972766*^9, 3.5672425299544067`*^9}}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Export", "[", RowBox[{ "\"\\"", ",", "TruncatedConnectionMatrixImage"}], "]"}]], "Input", CellChangeTimes->{{3.56724007918904*^9, 3.567240086316823*^9}, 3.5672422417563143`*^9, {3.5672426124857903`*^9, 3.5672426243875837`*^9}, { 3.567242654418108*^9, 3.567242655272365*^9}}], Cell[BoxData["\<\"/Users/Rachel/Documents/MOAC/PhD/Modelling/FHN Model/Global \ Network Diagrams/Pacemaker_DecayingFrequency_Prob_0.6.jpg\"\>"], "Output", CellChangeTimes->{3.567242657627877*^9}] }, Open ]], Cell[BoxData[""], "Input", CellChangeTimes->{3.560146075066201*^9, 3.560146118238227*^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[400, 13, 310, 8, 46, "Input"], Cell[713, 23, 92264, 1993, 2528, "Input"], Cell[92980, 2018, 250, 6, 28, "Input"], Cell[93233, 2026, 1310, 39, 131, "Input"], Cell[94546, 2067, 1208, 33, 97, "Input"], Cell[95757, 2102, 3469, 102, 216, "Input"], Cell[99229, 2206, 2614, 75, 182, "Input"], Cell[101846, 2283, 200, 4, 28, "Input"], Cell[102049, 2289, 5402, 159, 369, "Input"], Cell[107454, 2450, 840, 23, 28, "Input"], Cell[CellGroupData[{ Cell[108319, 2477, 1059, 28, 46, "Input"], Cell[109381, 2507, 2365, 48, 379, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[111783, 2560, 437, 8, 46, "Input"], Cell[112223, 2570, 196, 2, 28, "Output"] }, Open ]], Cell[112434, 2575, 90, 1, 28, "Input"] } ] *)