(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 9.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 157, 7] NotebookDataLength[ 191888, 3280] NotebookOptionsPosition[ 191557, 3265] NotebookOutlinePosition[ 191945, 3281] CellTagsIndexPosition[ 191902, 3278] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[ RowBox[{ RowBox[{"ClearAll", "[", RowBox[{ "anatomysens", ",", "anatomysenstensor", ",", " ", "act", ",", "activity", ",", "burst", ",", "burstthreshold", ",", "burstthresholdtensor", ",", "refractory", ",", "pressurevector"}], "]"}], ";"}]], "Input", CellChangeTimes->{{3.5963024786820445`*^9, 3.5963025112023454`*^9}, { 3.596302544933695*^9, 3.5963025816540303`*^9}, {3.596303797853531*^9, 3.596303832506759*^9}, 3.596303935700817*^9, {3.5963089697598543`*^9, 3.596308981506854*^9}, {3.5963091971395135`*^9, 3.596309217386918*^9}, { 3.5963102446192675`*^9, 3.596310245419316*^9}, {3.5963103029247665`*^9, 3.5963103085811057`*^9}, {3.596397571323636*^9, 3.5963975842948575`*^9}, { 3.59639761792284*^9, 3.596397618482806*^9}, {3.5965477717979107`*^9, 3.596547772629958*^9}, {3.596575169282674*^9, 3.5965751776086855`*^9}, { 3.596658148005354*^9, 3.596658154060362*^9}, {3.5966602535933175`*^9, 3.5966602555033207`*^9}, {3.596764948147891*^9, 3.596764958658906*^9}, { 3.5969676533159876`*^9, 3.596967672044014*^9}, {3.5969688764487095`*^9, 3.596968879058713*^9}, {3.596994986943578*^9, 3.5969949960395904`*^9}, { 3.597075804081502*^9, 3.597075809137791*^9}, {3.597077468539165*^9, 3.597077469397214*^9}, {3.5971094337431316`*^9, 3.597109435603134*^9}, { 3.597144617546026*^9, 3.5971446192970285`*^9}, {3.597144666499095*^9, 3.597144668514098*^9}, {3.597432604640339*^9, 3.597432608971345*^9}, { 3.597668393805938*^9, 3.597668398596945*^9}, {3.5976865963784695`*^9, 3.5976865976234946`*^9}, {3.5976867275641165`*^9, 3.5976867656318865`*^9}, {3.597714853893421*^9, 3.5977148643844357`*^9}, { 3.597753858506421*^9, 3.5977538606714644`*^9}, {3.59800907860182*^9, 3.5980090819376802`*^9}, {3.5982630386862707`*^9, 3.5982630449322796`*^9}, {3.598282173627391*^9, 3.5982821805836697`*^9}, { 3.598351987559246*^9, 3.598351989875249*^9}, {3.598368137912031*^9, 3.5983681401640215`*^9}, {3.5983730026212053`*^9, 3.598373004541244*^9}, { 3.5983732663982363`*^9, 3.5983732689891844`*^9}, {3.5985288473321457`*^9, 3.5985288534031544`*^9}, {3.5985417639676323`*^9, 3.598541835376733*^9}, { 3.5989656537935796`*^9, 3.59896569078284*^9}, {3.5989719519120827`*^9, 3.5989719550919557`*^9}, {3.598976379770151*^9, 3.598976382185958*^9}, { 3.5989829353954268`*^9, 3.5989829381612606`*^9}, {3.599049301409792*^9, 3.5990493071307993`*^9}, {3.59904977615746*^9, 3.59904979730549*^9}, { 3.5993111242146206`*^9, 3.599311124819887*^9}, {3.599471623976247*^9, 3.5994716245712476`*^9}, {3.5994720250498147`*^9, 3.5994720304908223`*^9}, {3.599565430208782*^9, 3.5995654338176947`*^9}, { 3.5995696993116193`*^9, 3.5995697006865644`*^9}, {3.599583447356721*^9, 3.599583449486551*^9}, {3.599730235179965*^9, 3.5997303517971296`*^9}, { 3.599730520391368*^9, 3.5997305255073752`*^9}, {3.5997321752848635`*^9, 3.5997321778158674`*^9}, {3.599732255006976*^9, 3.5997322634129877`*^9}, { 3.599732478751292*^9, 3.5997324843522997`*^9}, {3.5997330889461546`*^9, 3.599733090886157*^9}, {3.59973450708834*^9, 3.5997345110433455`*^9}, 3.599734634619519*^9}], Cell[BoxData[{ RowBox[{ RowBox[{"SetAttributes", "[", RowBox[{ RowBox[{"{", RowBox[{ "anatomysens", ",", "anatomysenstensor", ",", "act", ",", "activity", ",", "burst", " ", ",", "burstthreshold", ",", "burstthresholdtensor", ",", "refractory", ",", "pressurevector"}], "}"}], ",", "Listable"}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Print", "[", "\"\<\!\(\* StyleBox[\"Use\", FontSize->16, FontWeight->\"Plain\"]\)\!\(\* StyleBox[\" \", FontSize->16, FontWeight->\"Plain\"]\)\!\(\* StyleBox[\"default\", FontSize->16, FontWeight->\"Plain\"]\)\!\(\* StyleBox[\" \", FontSize->16, FontWeight->\"Plain\"]\)\!\(\* StyleBox[\"values\", FontSize->16, FontWeight->\"Plain\"]\)\!\(\* StyleBox[\" \", FontSize->16, FontWeight->\"Plain\"]\)\!\(\* StyleBox[\"or\", FontSize->16, FontWeight->\"Plain\"]\)\!\(\* StyleBox[\" \", FontSize->16, FontWeight->\"Plain\"]\)\!\(\* StyleBox[\"customize\", FontSize->16, FontWeight->\"Plain\"]\)\!\(\* StyleBox[\" \", FontSize->16, FontWeight->\"Plain\"]\)\!\(\* StyleBox[\"your\", FontSize->16, FontWeight->\"Plain\"]\)\!\(\* StyleBox[\" \", FontSize->16, FontWeight->\"Plain\"]\)\!\(\* StyleBox[\"own\", FontSize->16, FontWeight->\"Plain\"]\)\!\(\* StyleBox[\"?\", FontSize->16, FontWeight->\"Plain\"]\)\>\"", "]"}], ";"}], RowBox[{"(*", RowBox[{"Begin", " ", "input", " ", "area"}], "*)"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Default", "[", "f", "]"}], "=", "default"}], ";"}], " ", RowBox[{"(*", RowBox[{ "The", " ", "beginning", " ", "calls", " ", "the", " ", "default", " ", "values", " ", "for", " ", "parameters"}], "*)"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"f", "[", "d_.", "]"}], "=", "d"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"d", "=", RowBox[{"f", "[", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Control", "[", RowBox[{"{", RowBox[{"d", ",", RowBox[{"{", RowBox[{"default", ",", "customize"}], "}"}]}], "}"}], "]"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Default", " ", "input", " ", "parameter", " ", "area"}], "*)"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"d", "\[Equal]", "default"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"rows", "=", "4"}], ";", RowBox[{"columns", "=", "4"}], ";", RowBox[{"(*", RowBox[{ RowBox[{ "rows", " ", "and", " ", "columns", " ", "define", " ", "the", " ", "number", " ", "of", " ", "regions", " ", "and", " ", "is", " ", RowBox[{"the", " ", "'"}], RowBox[{"size", "'"}], " ", "of", " ", "the", " ", "uterus"}], ",", " ", RowBox[{"range", " ", "3", " ", "to", " ", "6"}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"timesteps", "=", "300"}], ";", " ", RowBox[{"(*", RowBox[{ RowBox[{ "#", " ", "iterations", " ", "of", " ", "the", " ", "simulation"}], ",", " ", RowBox[{ "50", " ", "to", " ", "300.", " ", "Each", " ", "step", " ", "is", " ", "approximately", " ", "5", " ", "seconds"}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"initialpressure", "=", ".5"}], ";", " ", RowBox[{"(*", RowBox[{ RowBox[{"Used", " ", "to", " ", "initialize", " ", RowBox[{"arrays", ".", " ", "Choose"}], " ", "any", " ", "value", " ", "between", " ", "0", " ", "and", " ", "10."}], " ", ">", RowBox[{ "5", " ", "to", " ", "start", " ", "with", " ", "a", " ", "contraction"}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"minpressure", "=", ".5"}], ";", " ", RowBox[{"(*", RowBox[{ RowBox[{ "This", " ", "is", " ", "the", " ", "tone", " ", "of", " ", "the", " ", "relaxed", " ", "uterus"}], ";", " ", RowBox[{"value", " ", "0.2", " ", "to", " ", "0.7"}], ";", " ", RowBox[{"Maxpressure", " ", RowBox[{"is", " ", "~", "10"}]}], ";", " ", RowBox[{ "Maxactivity", " ", "of", " ", "any", " ", "region", " ", "is", " ", "10"}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"timeburst", "=", "10"}], ";", " ", RowBox[{"(*", RowBox[{ RowBox[{ "this", " ", "is", " ", "the", " ", "maximum", " ", "time", " ", "span", " ", "for", " ", "an", " ", "Action", " ", "Potential", " ", "burst"}], ",", RowBox[{"range", " ", "5", " ", "to", " ", "15"}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"timerefractory", "=", "20"}], ";", " ", RowBox[{"(*", RowBox[{ RowBox[{ "the", " ", "time", " ", "a", " ", "region", " ", "is", " ", "refractory", " ", "following", " ", "a", " ", "burst", " ", "lasting", " ", "the", " ", "full", " ", "timeburst"}], ",", " ", RowBox[{"=", RowBox[{"5", " ", "to", " ", "30"}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"burstmultiplier", "=", "3"}], ";", " ", RowBox[{"(*", " ", RowBox[{ "The", " ", "multiplier", " ", "on", " ", "contractile", " ", "activity", " ", "used", " ", "when", " ", "an", " ", "action", " ", "potential", " ", "is", " ", "expressed"}], "*)"}], "\[IndentingNewLine]", RowBox[{"refractorymultiplier", "=", ".2"}], ";", RowBox[{"(*", RowBox[{ RowBox[{ "the", " ", "multiplier", " ", "that", " ", "reduces", " ", "activity", " ", "when", " ", "a", " ", "region", " ", "is", " ", "refractory"}], ",", " ", RowBox[{"range", " ", "0", " ", "to", " ", ".5"}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{ RowBox[{"Pseudo", "-", RowBox[{"Random", " ", "number", " ", "generation", " ", RowBox[{"parameters", ".", " ", "Weibull"}], " ", "distributions", " ", "are", " ", "used", " ", "to", " ", "calculate", " ", "the", " ", "anatomy", " ", "and", " ", "electric", " ", RowBox[{"sensitivities", ".", " ", "var1"}], " ", "and", " ", "4", " ", "are", " ", "shape", " ", "parameters"}]}], ";", " ", RowBox[{ "var2", " ", "and", " ", "5", " ", "are", " ", "scale", " ", "parameters"}]}], ",", " ", RowBox[{ RowBox[{ "lower", " ", "value", " ", "yields", " ", "sharper", " ", "peak"}], ";", " ", RowBox[{ "var3", " ", "and", " ", "6", " ", "set", " ", "lowest", " ", "values", " ", "of", " ", "distributions"}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"random1", "=", "1000"}], ";", RowBox[{"random2", "=", "2000"}], ";", " ", RowBox[{"(*", RowBox[{ "Default", " ", "seed", " ", "values", " ", "for", " ", "anatomy", " ", "and", " ", "threshold", " ", "distributions"}], "*)"}], "\[IndentingNewLine]", RowBox[{"weibullvar1", "=", "1.8"}], ";", RowBox[{"weibullvar2", "=", "1"}], ";", RowBox[{"weibullvar3", "=", ".3"}], ";", " ", RowBox[{"(*", RowBox[{"Anatomy", ";", " ", RowBox[{"var1", ":", " ", RowBox[{"1.2", " ", "to", " ", "3"}]}], ";", " ", RowBox[{"var2", ":", " ", RowBox[{"0.4", " ", "to", " ", "1.2"}]}], ";", " ", RowBox[{"var3", ":", " ", RowBox[{"0.1", " ", "to", " ", ".6"}]}]}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"weibullvar4", "=", "4"}], ";", RowBox[{"weibullvar5", "=", ".6"}], ";", RowBox[{"weibullvar6", "=", ".4"}]}]}], "]"}], ";"}], " ", RowBox[{"(*", RowBox[{"Threshold", ";", " ", RowBox[{"var4", ":", " ", RowBox[{"2", " ", "to", " ", "8"}]}], ";", " ", RowBox[{"var5", ":", " ", RowBox[{"0.1", " ", "to", " ", "1"}]}], ";", " ", RowBox[{"var6", ":", " ", RowBox[{"0.1", " ", "to", " ", "1"}]}]}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"custom", " ", "input", " ", "parameter", " ", "area"}], "*)"}]}], "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"Slider", "[", RowBox[{ RowBox[{"Dynamic", "[", "rows", "]"}], ",", RowBox[{"{", RowBox[{"1", ",", "8", ",", "1"}], "}"}]}], "]"}], ",", RowBox[{"Dynamic", "[", "rows", "]"}], ",", "\"\\""}], "}"}], "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"Slider", "[", RowBox[{ RowBox[{"Dynamic", "[", "columns", "]"}], ",", RowBox[{"{", RowBox[{"1", ",", "8", ",", "1"}], "}"}]}], "]"}], ",", RowBox[{"Dynamic", "[", "columns", "]"}], ",", "\"\\""}], "}"}], "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"Slider", "[", RowBox[{ RowBox[{"Dynamic", "[", "timesteps", "]"}], ",", RowBox[{"{", RowBox[{"50", ",", "300", ",", "1"}], "}"}]}], "]"}], ",", RowBox[{"Dynamic", "[", "timesteps", "]"}], ",", "\"\