(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 10.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 40790, 1070] NotebookOptionsPosition[ 40532, 1056] NotebookOutlinePosition[ 40888, 1072] CellTagsIndexPosition[ 40845, 1069] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{ "To", " ", "be", " ", "appended", " ", "to", " ", "a", " ", "Mathematica", " ", "code", " ", "after", " ", "the", " ", "FHN", " ", "equations", " ", "have", " ", "been", " ", "solved", " ", "and", " ", "before", " ", "the", " ", "output", " ", "of", " ", "number", " ", "of", " ", "excited", " ", "cells"}], " ", "*)"}], "\[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[{ 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[{ RowBox[{"Gaverage", "=", RowBox[{"Table", "[", RowBox[{"i", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"NumberExcited", "=", RowBox[{"Table", "[", RowBox[{"i", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"ExciteRatio", "=", RowBox[{"Table", "[", RowBox[{"i", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Surrounding", " ", "kicked", " ", "cell"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"GenerationCoordinates", "=", RowBox[{"Position", "[", RowBox[{"Generations", ",", "1"}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"DD1", "=", RowBox[{"{", "1", "}"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ 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[{ RowBox[{"NumberExcited", "[", RowBox[{"[", "1", "]"}], "]"}], "=", RowBox[{"Count", "[", RowBox[{ RowBox[{"Positive", "[", RowBox[{"Flatten", "[", RowBox[{"Delete", "[", RowBox[{"DD1", ",", "1"}], "]"}], "]"}], "]"}], ",", "True"}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"ExciteRatio", "[", RowBox[{"[", "1", "]"}], "]"}], "=", RowBox[{ RowBox[{"NumberExcited", "[", RowBox[{"[", "1", "]"}], "]"}], "/", RowBox[{"Length", "[", "GenerationCoordinates", "]"}]}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ 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[{ 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[{ RowBox[{"corneraverage", "=", RowBox[{"{", "1", "}"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"GenerationCoordinates", "=", RowBox[{"Position", "[", RowBox[{"Generations", ",", RowBox[{"n", "-", "1"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ 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[{ RowBox[{"DD3", "=", RowBox[{"{", "1", "}"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ 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[{ RowBox[{"NumberExcited", "[", RowBox[{"[", RowBox[{"n", "-", "1"}], "]"}], "]"}], "=", RowBox[{"Count", "[", RowBox[{ RowBox[{"Positive", "[", RowBox[{"Flatten", "[", RowBox[{"Delete", "[", RowBox[{"DD3", ",", "1"}], "]"}], "]"}], "]"}], ",", "True"}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"ExciteRatio", "[", RowBox[{"[", RowBox[{"n", "-", "1"}], "]"}], "]"}], "=", RowBox[{ RowBox[{"NumberExcited", "[", RowBox[{"[", RowBox[{"n", "-", "1"}], "]"}], "]"}], "/", RowBox[{"Length", "[", "GenerationCoordinates", "]"}]}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ 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[{ 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[{"Gaverage", "=", RowBox[{"Prepend", "[", RowBox[{"Gaverage", ",", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\""}], "}"}]}], "]"}]}], ";"}], "\n", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Duplicate", " ", "Connections"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"RRh2", "=", "RRh"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RRv2", "=", "RRv"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ 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[{ 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[{ 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[{ RowBox[{"RRhmatrix", "=", RowBox[{"Insert", "[", RowBox[{"RRh2", ",", RowBox[{"-", "1"}], ",", "RRhcoord"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RRhcoord2", " ", "=", " ", 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[{"3", "n"}]}], "}"}]}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RRhmatrix2", " ", "=", " ", RowBox[{"Insert", "[", RowBox[{"RRhmatrix", ",", "ZeroVector", ",", "RRhcoord2"}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"RRhcoord3", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"2", "i"}], "+", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RRhmatrix3", "=", RowBox[{"Insert", "[", RowBox[{"RRhmatrix2", ",", "ZeroVector", ",", "RRhcoord3"}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Vertical", " ", "Connections"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"RRvcoord", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"2", "i"}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"NegCoordValue", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"-", "1"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RRvmatrix", "=", RowBox[{"Insert", "[", RowBox[{"RRv2", ",", "NegCoordValue", ",", "RRvcoord"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ZeroVector2", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"3", "n"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RRvcoord2", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", "i", "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "+", "1"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RRvmatrix2", " ", "=", " ", RowBox[{"Transpose", "[", RowBox[{"Insert", "[", RowBox[{ RowBox[{"Transpose", "[", "RRvmatrix", "]"}], ",", "ZeroVector2", ",", "RRvcoord2"}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RRvcoord3", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"2", "i"}], "+", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RRvmatrix3", "=", RowBox[{"Transpose", "[", RowBox[{"Insert", "[", RowBox[{ RowBox[{"Transpose", "[", "RRvmatrix2", "]"}], ",", "ZeroVector2", ",", "RRvcoord3"}], "]"}], "]"}]}], ";"}], "\n", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Sum", " ", "the", " ", "two", " ", "matrices"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"ConnectionsMatrix", " ", "=", " ", RowBox[{"RRhmatrix3", "+", "RRvmatrix3"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", 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[{"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[{ 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[{"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[{"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[{"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"}]}]}], "]"}]}], ";"}], "\[IndentingNewLine]", "\n", RowBox[{"(*", " ", RowBox[{"Matrix", " ", "Plot"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"FinalConnectionMatrix", " ", "=", " ", RowBox[{"MatrixPlot", "[", RowBox[{"ConnectionsMatrix", ",", RowBox[{"ColorRules", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", "3"}], "\[Rule]", "Green"}], ",", RowBox[{ RowBox[{"-", "2"}], "\[Rule]", "Black"}], ",", RowBox[{ RowBox[{"-", "1"}], "\[Rule]", "Gray"}], ",", RowBox[{"0", "\[Rule]", "Gray"}]}], "}"}]}], ",", RowBox[{"ColorFunction", "->", RowBox[{"(", RowBox[{ RowBox[{"Blend", "[", RowBox[{ RowBox[{"{", RowBox[{"White", ",", "Red"}], "}"}], ",", "#"}], "]"}], "&"}], ")"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "1"}]}], "]"}]}], ";"}], "\n", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Export", "[", RowBox[{ RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "prob", "]"}], "<>", "\"\<_Pert_\>\"", "<>", RowBox[{"ToString", "[", "kick", "]"}], "<>", "\"\<_Iteration_\>\"", "<>", RowBox[{"ToString", "[", "JJ", "]"}], "<>", "\"\<.xls\>\""}], ",", "Gaverage"}], "]"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Export", "[", RowBox[{ RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "prob", "]"}], "<>", "\"\<_Pert_\>\"", "<>", RowBox[{"ToString", "[", "kick", "]"}], "<>", "\"\<_Iteration_\>\"", "<>", RowBox[{"ToString", "[", "JJ", "]"}], "<>", "\"\<.jpg\>\""}], ",", "FinalConnectionMatrix"}], "]"}], ";"}]}]}]], "Input", CellChangeTimes->{{3.631816568219015*^9, 3.631816598107417*^9}}] }, WindowSize->{808, 599}, WindowMargins->{{4, Automatic}, {Automatic, 4}}, 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[558, 20, 39970, 1034, 3684, "Input"] } ] *) (* End of internal cache information *)