(* 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[ 35428, 1004] NotebookOptionsPosition[ 34216, 956] NotebookOutlinePosition[ 35017, 988] CellTagsIndexPosition[ 34876, 981] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["SWB codes", "Title", CellChangeTimes->{{3.5869638530521164`*^9, 3.586963895402539*^9}, 3.5869639327406745`*^9, 3.586981290609129*^9, {3.588104014143655*^9, 3.5881040190889378`*^9}, {3.6542732584165*^9, 3.6542732601596565`*^9}}], Cell["D. Gurarie", "Subtitle", CellChangeTimes->{{3.5881040011209097`*^9, 3.588104007821293*^9}}], Cell[CellGroupData[{ Cell["SWB with mating", "Subsection", CellChangeTimes->{{3.5817779450288205`*^9, 3.581777953381298*^9}, { 3.5841050798192825`*^9, 3.5841050935140657`*^9}, {3.5851446275340776`*^9, 3.585144630169228*^9}, 3.588018355546507*^9}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{"Uninfected", " ", "Source"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"UV", "[", "n_", "]"}], ":=", RowBox[{"UnitVector", "[", RowBox[{ RowBox[{"n", "+", "1"}], ",", "1"}], "]"}]}], ";"}], "\n", RowBox[{"(*", RowBox[{"Host", " ", "system"}], "*)"}], "\n", RowBox[{ RowBox[{ RowBox[{"HTM", "[", RowBox[{ RowBox[{"{", RowBox[{"\[Lambda]_", ",", "\[Mu]_", ",", "\[Gamma]_"}], "}"}], ",", "n_", ",", "h_"}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"\[Lambda]", " ", RowBox[{"h", "[", RowBox[{"k", "-", "1"}], "]"}]}], "-", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"\[Lambda]", " ", RowBox[{"Sign", "[", RowBox[{"n", "-", "k"}], "]"}]}], "+", RowBox[{"k", " ", "\[Gamma]"}], "+", "\[Mu]"}], ")"}], RowBox[{"h", "[", "k", "]"}]}], "+", RowBox[{ RowBox[{"(", RowBox[{"k", "+", "1"}], ")"}], "\[Gamma]", " ", RowBox[{"h", "[", RowBox[{"k", "+", "1"}], "]"}]}]}], ",", RowBox[{"{", RowBox[{"k", ",", "0", ",", "n"}], "}"}]}], "]"}], "/.", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"h", "[", RowBox[{"-", "1"}], "]"}], "\[Rule]", "0"}], ",", RowBox[{ RowBox[{"h", "[", RowBox[{"n", "+", "1"}], "]"}], "\[Rule]", "0"}]}], "}"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Mated", " ", "Count"}], "*)"}], "\n", RowBox[{ RowBox[{ RowBox[{"MC", "[", "n_", "]"}], "=", RowBox[{ FractionBox["n", "2"], RowBox[{"(", RowBox[{"1", "-", RowBox[{ SuperscriptBox["2", RowBox[{ RowBox[{"-", "2"}], RowBox[{"Floor", "[", RowBox[{"n", "/", "2"}], "]"}]}]], RowBox[{"Binomial", "[", RowBox[{ RowBox[{"2", RowBox[{"Floor", "[", RowBox[{"n", "/", "2"}], "]"}]}], ",", RowBox[{"Floor", "[", RowBox[{"n", "/", "2"}], "]"}]}], "]"}]}]}], ")"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"SetAttributes", "[", RowBox[{"MC", ",", "Listable"}], "]"}], ";"}], "\n", RowBox[{"(*", RowBox[{ "Equilibrium", " ", "SWB", " ", "with", " ", "source", " ", "so"}], "*)"}], "\n", RowBox[{ RowBox[{"QSW", "[", RowBox[{"l_", ",", "m_", ",", "n_", ",", "so_"}], "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{"az", ",", "hv", ",", "bz", ",", "mz"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"az", "=", RowBox[{ RowBox[{"HTM", "[", RowBox[{ RowBox[{"{", RowBox[{"l", ",", "m", ",", "1"}], "}"}], ",", "n", ",", "h"}], "]"}], "+", "so"}]}], ";", RowBox[{"hv", "=", RowBox[{"h", "/@", RowBox[{"Range", "[", RowBox[{"0", ",", "n"}], "]"}]}]}], ";", RowBox[{ RowBox[{"{", RowBox[{"bz", ",", "mz"}], "}"}], "=", RowBox[{"CoefficientArrays", "[", RowBox[{"az", ",", "hv"}], "]"}]}], ";", RowBox[{"LinearSolve", "[", RowBox[{"mz", ",", RowBox[{"-", "bz"}]}], "]"}]}]}], "]"}]}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Child", " ", "equilibrium"}], "*)"}], "\n", RowBox[{ RowBox[{ RowBox[{"SWc", "[", RowBox[{"l_", ",", "\[Mu]_", ",", "n_"}], "]"}], ":=", RowBox[{"QSW", "[", RowBox[{"l", ",", "\[Mu]", ",", "n", ",", RowBox[{"\[Mu]", " ", RowBox[{"UV", "[", "n", "]"}]}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"SetAttributes", "[", RowBox[{"SWc", ",", "Listable"}], "]"}], "\n", RowBox[{"(*", "Fecundity", "*)"}], "\n", RowBox[{ RowBox[{ RowBox[{"Fec", "[", RowBox[{"(*", "strata", "*)"}], RowBox[{"k_", ",", RowBox[{"{", RowBox[{"(*", SubscriptBox["\[Rho]", "0"], "*)"}], RowBox[{"r_", ",", "k0_"}], "}"}]}], "]"}], "=", RowBox[{"r", " ", SuperscriptBox["E", RowBox[{ RowBox[{"-", "k"}], " ", "/", "k0"}]]}]}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"SWB", " ", "worm", " ", "prev"}], "*)"}], "\n", RowBox[{ RowBox[{"SWP", "[", RowBox[{"l_", ",", "\[Mu]_", ",", "n_"}], "]"}], ":=", RowBox[{"1", "-", RowBox[{"First", "@", RowBox[{"QSW", "[", RowBox[{"l", ",", "\[Mu]", ",", "n", ",", RowBox[{"\[Mu]", " ", RowBox[{"UV", "[", "n", "]"}]}]}], "]"}]}]}]}], "\n", RowBox[{"(*", RowBox[{"Infected", " ", "Egg", " ", RowBox[{"prev", ":", " ", "children"}]}], "*)"}], "\n", RowBox[{ RowBox[{"EPC", "[", RowBox[{ RowBox[{"{", RowBox[{"L_", ",", "\[Mu]_", ",", "n_"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Rho]_", ",", "w0_", ",", "r_"}], "}"}], ",", "dw_"}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"rg", "=", RowBox[{"Range", "[", RowBox[{"0", ",", "n"}], "]"}]}], ",", "sw", ",", "mc", ",", "fc"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"mated", " ", "count"}], "*)"}], RowBox[{ RowBox[{"mc", "=", RowBox[{"MC", "[", RowBox[{"dw", " ", "rg"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", "Fec", "*)"}], RowBox[{"fc", "=", RowBox[{"Fec", "[", RowBox[{"rg", ",", RowBox[{"{", RowBox[{"\[Rho]", ",", FractionBox["w0", "dw"]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", "SW", "*)"}], RowBox[{"sw", "=", RowBox[{"SWc", "[", RowBox[{"L", ",", "\[Mu]", ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"1", "-", RowBox[{ SuperscriptBox[ RowBox[{"(", FractionBox["r", RowBox[{"r", "+", "fc"}]], ")"}], RowBox[{"r", " ", "mc"}]], ".", "sw"}]}]}]}], "]"}]}], "\n", RowBox[{"(*", RowBox[{ RowBox[{ "Infected", " ", "Egg", " ", "prev", " ", "with", " ", "source"}], " ", "=", "sB"}], "*)"}], "\n", RowBox[{ RowBox[{"EPS", "[", RowBox[{ RowBox[{"{", RowBox[{"L_", ",", "\[Mu]_", ",", "n_", ",", "sB_"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Rho]_", ",", "w0_", ",", "r_"}], "}"}], ",", "dw_"}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"rg", "=", RowBox[{"Range", "[", RowBox[{"0", ",", "n"}], "]"}]}], ",", "sw", ",", "mc", ",", "fc"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"mated", " ", "count"}], "*)"}], RowBox[{ RowBox[{"mc", "=", RowBox[{"MC", "[", RowBox[{"dw", " ", "rg"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", "Fec", "*)"}], RowBox[{"fc", "=", RowBox[{"Fec", "[", RowBox[{"rg", ",", RowBox[{"{", RowBox[{"\[Rho]", ",", FractionBox["w0", "dw"]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", "SW", "*)"}], RowBox[{"sw", "=", RowBox[{"QSW", "[", RowBox[{"L", ",", "\[Mu]", ",", "n", ",", "sB"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"1", "-", RowBox[{ SuperscriptBox[ RowBox[{"(", FractionBox["r", RowBox[{"r", "+", "fc"}]], ")"}], RowBox[{"r", " ", "mc"}]], ".", "sw"}]}]}]}], "]"}]}], "\n", RowBox[{"(*", RowBox[{"Mean", " ", "egg", " ", RowBox[{"release", ":", " ", "children"}]}], "*)"}], "\n", RowBox[{ RowBox[{"MEC", "[", RowBox[{ RowBox[{"{", RowBox[{"L_", ",", "\[Mu]_", ",", "n_"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Rho]_", ",", "w0_", ",", "r_"}], "}"}], ",", "dw_"}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"rg", "=", RowBox[{"Range", "[", RowBox[{"0", ",", "n"}], "]"}]}], ",", "sw", ",", "mc", ",", "fc"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"mated", " ", "count"}], "*)"}], RowBox[{ RowBox[{"mc", "=", RowBox[{"MC", "[", RowBox[{"dw", " ", "rg"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", "Fec", "*)"}], RowBox[{"fc", "=", RowBox[{"Fec", "[", RowBox[{"rg", ",", RowBox[{"{", RowBox[{"\[Rho]", ",", FractionBox["w0", "dw"]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", "SW", "*)"}], RowBox[{"sw", "=", RowBox[{"SWc", "[", RowBox[{"L", ",", "\[Mu]", ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"(", RowBox[{"mc", " ", "fc"}], ")"}], ".", "sw"}]}]}], "]"}]}], "\n", RowBox[{"(*", RowBox[{ RowBox[{ "Mean", " ", "egg", " ", "release", " ", "with", " ", "source", " ", "SWB"}], " ", "=", "sB"}], "*)"}], "\n", RowBox[{ RowBox[{"MES", "[", RowBox[{ RowBox[{"{", RowBox[{"L_", ",", "\[Mu]_", ",", "n_", ",", "sB_"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Rho]_", ",", "w0_", ",", "r_"}], "}"}], ",", "dw_"}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"rg", "=", RowBox[{"Range", "[", RowBox[{"0", ",", "n"}], "]"}]}], ",", "sw", ",", "mc", ",", "fc"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"mated", " ", "count"}], "*)"}], RowBox[{ RowBox[{"mc", "=", RowBox[{"MC", "[", RowBox[{"dw", " ", "rg"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", "Fec", "*)"}], RowBox[{"fc", "=", RowBox[{"Fec", "[", RowBox[{"rg", ",", RowBox[{"{", RowBox[{"\[Rho]", ",", FractionBox["w0", "dw"]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", "SW", "*)"}], RowBox[{"sw", "=", RowBox[{"QSW", "[", RowBox[{"L", ",", "\[Mu]", ",", "n", ",", "sB"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"(", RowBox[{"mc", " ", "fc"}], ")"}], ".", "sw"}]}]}], "]"}]}], "\[IndentingNewLine]"}]}]], "Input", CellChangeTimes->{ 3.6596472802179556`*^9, {3.6596473263286843`*^9, 3.6596473567739687`*^9}, 3.659647477085419*^9, {3.6596483520795617`*^9, 3.6596483554798317`*^9}, { 3.6603140953776875`*^9, 3.660314113728914*^9}, 3.660324102012641*^9, { 3.6604064548937073`*^9, 3.6604064671508737`*^9}}, CellTags->"SWB"] }, Closed]], Cell[CellGroupData[{ Cell["MDA", "Subsection", CellChangeTimes->{{3.5817779450288205`*^9, 3.581777953381298*^9}, { 3.5841050798192825`*^9, 3.5841050935140657`*^9}, {3.5851446275340776`*^9, 3.585144630169228*^9}, 3.588018355546507*^9, {3.5881041221118298`*^9, 3.5881041268891034`*^9}, {3.6542733357663593`*^9, 3.65427333623067*^9}, 3.660406714318541*^9}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ RowBox[{ RowBox[{"Treatment", " ", "map", " ", "for", " ", "h"}], "-", RowBox[{"strata", ":", " ", RowBox[{"h", "[", "i", "]"}]}]}], "\[Rule]", " ", RowBox[{"h", "[", RowBox[{"\[Epsilon]", "*", "i"}], "]"}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"TrM", "[", RowBox[{"h_", ",", "n_", ",", "e_"}], "]"}], ":=", RowBox[{"PadRight", "[", RowBox[{ RowBox[{"Total", "/@", RowBox[{"Map", "[", RowBox[{"h", ",", RowBox[{"GatherBy", "[", RowBox[{ RowBox[{"Range", "[", RowBox[{"0", ",", "n"}], "]"}], ",", RowBox[{ RowBox[{"Floor", "[", RowBox[{"e", " ", "#"}], "]"}], "&"}]}], "]"}], ",", RowBox[{"{", "2", "}"}]}], "]"}]}], ",", RowBox[{"n", "+", "1"}]}], "]"}]}], ";"}], "\n", RowBox[{"(*", RowBox[{ RowBox[{"MDA", " ", "Event", " ", "control", " ", "of", " ", "SWB"}], "-", RowBox[{"system", " ", RowBox[{"hv", "[", "t", "]"}], " ", "with", " ", RowBox[{"parameters", ":", " ", RowBox[{"{", RowBox[{ RowBox[{"fc", "=", RowBox[{"fraction", " ", "cover"}]}], ",", " ", RowBox[{"ep", "=", "efficacy"}], ",", " ", RowBox[{"tz", "=", " ", RowBox[{"interval", RowBox[{"(", "years", ")"}]}]}]}], "}"}]}]}]}], "*)"}], "\n", RowBox[{ RowBox[{ RowBox[{"WEB", "[", RowBox[{"hv_", ",", RowBox[{"{", RowBox[{"fc_", ",", "ep_", ",", "tz_"}], "}"}]}], "]"}], ":=", RowBox[{ StyleBox["With", FontColor->GrayLevel[0]], "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"hz", "=", RowBox[{"Through", "@", RowBox[{"(", RowBox[{"hv", "@", "t"}], ")"}]}]}], ",", RowBox[{"h", "=", RowBox[{"Head", "@", RowBox[{"hv", "[", RowBox[{"[", "1", "]"}], "]"}]}]}], ",", RowBox[{"ht", "=", RowBox[{ RowBox[{"TrM", "[", RowBox[{"h", ",", RowBox[{ RowBox[{"Length", "@", "hv"}], "-", "1"}], ",", "ep"}], "]"}], "/.", RowBox[{ RowBox[{"h", "[", "i_", "]"}], "\[Rule]", RowBox[{ RowBox[{"h", "[", "i", "]"}], "[", "t", "]"}]}]}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"WhenEvent", "[", RowBox[{ RowBox[{ RowBox[{"Mod", "[", RowBox[{"t", ",", "tz"}], "]"}], "\[Equal]", "0"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"f", "@", "t"}], "\[Rule]", "fc"}], ",", RowBox[{"hz", "\[Rule]", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", RowBox[{"f", "@", "t"}]}], ")"}], "hz"}], "+", RowBox[{ RowBox[{"f", "@", "t"}], " ", "ht"}]}]}]}], "}"}]}], "]"}]}], "]"}]}], ";"}], "\n", RowBox[{"(*", " ", RowBox[{"Event", " ", "occurence", " ", RowBox[{"control", ":", " ", RowBox[{ RowBox[{"remove", " ", "after", " ", "m"}], "+", RowBox[{"1", " ", "occurence"}]}]}]}], "*)"}], "\n", RowBox[{ RowBox[{ RowBox[{"WEBm", "[", RowBox[{"hv_", ",", RowBox[{"{", RowBox[{"fc_", ",", "ep_", ",", "tz_", ",", "m_"}], "}"}]}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{ StyleBox["With", FontColor->GrayLevel[0]], "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"hz", "=", RowBox[{"Through", "@", RowBox[{"(", RowBox[{"hv", "@", "t"}], ")"}]}]}], ",", RowBox[{"h", "=", RowBox[{"Head", "@", RowBox[{"hv", "[", RowBox[{"[", "1", "]"}], "]"}]}]}], ",", RowBox[{"ht", "=", RowBox[{ RowBox[{"TrM", "[", RowBox[{"h", ",", RowBox[{ RowBox[{"Length", "@", "hv"}], "-", "1"}], ",", "ep"}], "]"}], "/.", RowBox[{ RowBox[{"h", "[", "i_", "]"}], "\[Rule]", RowBox[{ RowBox[{"h", "[", "i", "]"}], "[", "t", "]"}]}]}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"WhenEvent", "[", RowBox[{ RowBox[{ RowBox[{"Mod", "[", RowBox[{"t", ",", "tz"}], "]"}], "\[Equal]", "0"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"f", "@", "t"}], "\[Rule]", "fc"}], ",", RowBox[{"hz", "\[Rule]", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", RowBox[{"f", "@", "t"}]}], ")"}], "hz"}], "+", RowBox[{ RowBox[{"f", "@", "t"}], " ", "ht"}]}]}], ",", RowBox[{ RowBox[{"c", "[", "t", "]"}], "\[Rule]", RowBox[{ RowBox[{"c", "[", "t", "]"}], "+", "1"}]}], ",", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"c", "[", "t", "]"}], ">", "m"}], ",", "\"\\""}], "]"}]}], "}"}]}], "]"}]}], "]"}]}], ";"}], "\n", RowBox[{"(*", RowBox[{ RowBox[{ "Conditional", " ", "Event", " ", "control", " ", "by", " ", "y"}], "-", "value"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"WEBc", "[", RowBox[{"hv_", ",", RowBox[{"{", RowBox[{"fc_", ",", "ep_", ",", "tz_", ",", "yc_"}], "}"}]}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{ StyleBox["With", FontColor->GrayLevel[0]], "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"hz", "=", RowBox[{"Through", "@", RowBox[{"(", RowBox[{"hv", "@", "t"}], ")"}]}]}], ",", RowBox[{"h", "=", RowBox[{"Head", "@", RowBox[{"hv", "[", RowBox[{"[", "1", "]"}], "]"}]}]}], ",", RowBox[{"ht", "=", RowBox[{ RowBox[{"TrM", "[", RowBox[{"h", ",", RowBox[{ RowBox[{"Length", "@", "hv"}], "-", "1"}], ",", "ep"}], "]"}], "/.", RowBox[{ RowBox[{"h", "[", "i_", "]"}], "\[Rule]", RowBox[{ RowBox[{"h", "[", "i", "]"}], "[", "t", "]"}]}]}]}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"WhenEvent", "[", RowBox[{ RowBox[{ RowBox[{"Mod", "[", RowBox[{"t", ",", "tz"}], "]"}], "\[Equal]", "0"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"f", "@", "t"}], "\[Rule]", "fc"}], ",", RowBox[{"h", "\[Rule]", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", RowBox[{"f", "@", "t"}]}], ")"}], "h"}], "+", RowBox[{ RowBox[{"f", "@", "t"}], " ", "ht"}]}]}], ",", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"y", "[", "t", "]"}], "<", "yc"}], ",", "\"\\""}], "]"}]}], "}"}]}], "]"}]}], "]"}]}], ";"}]}]}]], "Input", CellChangeTimes->{{3.584041539658312*^9, 3.584041571723146*^9}, { 3.5840416157726655`*^9, 3.584041671594858*^9}, {3.584042280019658*^9, 3.5840423689317436`*^9}, {3.5840424724076624`*^9, 3.584042478803028*^9}, { 3.584049951736455*^9, 3.584049952741513*^9}, {3.5881040557330337`*^9, 3.588104083048596*^9}, 3.5881041506714635`*^9, 3.588104427169278*^9, { 3.6157565652472906`*^9, 3.615756577736388*^9}, {3.615756611483901*^9, 3.6157566173197937`*^9}, 3.636744486228631*^9, 3.6418654897315817`*^9}, TextJustification->1., CellTags->"SWB control"] }, Closed]], Cell[CellGroupData[{ Cell["Coupled SWB-snail; 2-risk group SWB", "Subsection", CellChangeTimes->{{3.5817779450288205`*^9, 3.581777953381298*^9}, { 3.5841050798192825`*^9, 3.5841050935140657`*^9}, {3.5851446275340776`*^9, 3.585144630169228*^9}, 3.588018355546507*^9, {3.616364927206273*^9, 3.61636493097377*^9}, {3.6596454501874723`*^9, 3.6596454517235026`*^9}, { 3.6604064880558004`*^9, 3.660406528647848*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{"Snail", " ", RowBox[{"FOI", "/", "\"\\""}], "x", "\"\\""}], "*)"}], "\n", RowBox[{ RowBox[{ RowBox[{ RowBox[{"FOS", "[", RowBox[{"(*", RowBox[{"input", " ", "strata"}], "*)"}], RowBox[{ RowBox[{"{", RowBox[{"h_", ",", "n_", ",", "dw_"}], "}"}], ",", RowBox[{"(*", RowBox[{"Fecundity", " ", "pars"}], "*)"}], "fpa_"}], "]"}], ":=", " ", "\[IndentingNewLine]", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", "Fec", "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", "Fecundity", "*)"}], RowBox[{ RowBox[{ RowBox[{"Fec", "[", RowBox[{"k_", ",", RowBox[{"(*", "parameters", "*)"}], RowBox[{"{", RowBox[{"r_", ",", "a_", ",", "k0_"}], "}"}]}], "]"}], "=", " ", FractionBox["r", RowBox[{"1", "+", SuperscriptBox[ RowBox[{"(", RowBox[{"k", "/", "k0"}], ")"}], "a"]}]]}], ";", "\[IndentingNewLine]", RowBox[{"Sum", "[", " ", RowBox[{ RowBox[{ RowBox[{"Fec", "[", RowBox[{"k", ",", "fpa"}], "]"}], RowBox[{"MC", "[", RowBox[{"dw", " ", "k"}], "]"}], RowBox[{"h", "[", "k", "]"}]}], ",", RowBox[{"{", RowBox[{"k", ",", "n"}], "}"}]}], "]"}]}]}], "]"}]}], ";"}], "\n", RowBox[{"(*", RowBox[{ RowBox[{ RowBox[{"Single", " ", "SWB", " ", "with", " ", RowBox[{"mating", "/", RowBox[{"fecundity", ":", " ", "a"}]}]}], "=", " ", RowBox[{ RowBox[{"A", "*", "snail"}], "-", RowBox[{"density", "*", "contact"}]}]}], ";", " ", RowBox[{"b", "=", " ", RowBox[{"B", "*", RowBox[{"(", RowBox[{"H", "-", "pop"}], ")"}], "*", "contact"}]}]}], "*)"}], "\n", RowBox[{ RowBox[{ RowBox[{"SWB", "[", RowBox[{"(*", "strata", "*)"}], RowBox[{ RowBox[{"{", RowBox[{"h_", ",", "n_", ",", "dw_"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Demographics", "/", "biology"}], "*)"}], RowBox[{"{", RowBox[{"\[Mu]_", ",", "\[Gamma]_", ",", "\[Nu]_"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", "Fecundity", "*)"}], "fpa_", ",", "\[IndentingNewLine]", RowBox[{"(*", "Transmision", "*)"}], RowBox[{"{", RowBox[{"a_", ",", "b_"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", "Source", "*)"}], "so_"}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"HTM", "[", RowBox[{ RowBox[{"{", RowBox[{ FractionBox[ RowBox[{"a", " ", "y"}], "dw"], ",", "\[Mu]", ",", "\[Gamma]"}], "}"}], ",", "n", ",", "h"}], "]"}], "+", RowBox[{"\[Mu]", " ", "so"}]}], ")"}], ",", RowBox[{ RowBox[{"b", " ", RowBox[{"FOS", "[", RowBox[{ RowBox[{"{", RowBox[{"h", ",", "n", ",", "dw"}], "}"}], ",", "fpa"}], "]"}], RowBox[{"(", RowBox[{"1", "-", "y"}], ")"}]}], "-", " ", RowBox[{"\[Nu]", " ", "y"}]}]}], "}"}]}], ";"}], "\n", RowBox[{"(*", RowBox[{"2", "-", RowBox[{"risk", " ", "group", " ", "SWB"}]}], "*)"}], "\n", RowBox[{ RowBox[{ RowBox[{"SW2", "[", RowBox[{"(*", "strata", "*)"}], RowBox[{ RowBox[{"{", RowBox[{"h_", ",", "n_", ",", "dw_"}], "}"}], ",", RowBox[{"(*", "Demographics", "*)"}], RowBox[{"{", RowBox[{"\[Mu]_", ",", "\[Gamma]_", ",", "\[Nu]_"}], "}"}], ",", RowBox[{"(*", "fecund", "*)"}], "fpa_", ",", "\[IndentingNewLine]", RowBox[{"(*", "transmision", "*)"}], RowBox[{"{", RowBox[{"a1_", ",", "b1_", ",", "a2_", ",", "b2_", ",", "f1_"}], "}"}], ",", RowBox[{"(*", "Source", "*)"}], "so_"}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"HTM", "[", RowBox[{ RowBox[{"{", RowBox[{ FractionBox[ RowBox[{"a1", " ", "y"}], "dw"], ",", "\[Mu]", ",", "\[Gamma]"}], "}"}], ",", "n", ",", SubscriptBox["h", "1"]}], "]"}], "+", RowBox[{"\[Mu]", " ", "so"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"HTM", "[", RowBox[{ RowBox[{"{", RowBox[{ FractionBox[ RowBox[{"a2", " ", "y"}], "dw"], ",", "\[Mu]", ",", "\[Gamma]"}], "}"}], ",", "n", ",", SubscriptBox["h", "2"]}], "]"}], "+", RowBox[{"\[Mu]", " ", "so"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"b1", " ", "f1", " ", RowBox[{"FOS", "[", RowBox[{ RowBox[{"{", RowBox[{ SubscriptBox["h", "1"], ",", "n", ",", "dw"}], "}"}], ",", "fpa"}], "]"}]}], "+", RowBox[{"b2", " ", RowBox[{"(", RowBox[{"1", "-", "f1"}], ")"}], RowBox[{"FOS", "[", RowBox[{ RowBox[{"{", RowBox[{ SubscriptBox["h", "2"], ",", "n", ",", "dw"}], "}"}], ",", "fpa"}], "]"}]}]}], ")"}], RowBox[{"(", RowBox[{"1", "-", "y"}], ")"}]}], "-", " ", RowBox[{"\[Nu]", " ", "y"}]}]}], "}"}]}], ";"}], "\n", RowBox[{"(*", RowBox[{"Child", "-", RowBox[{"adult", " ", "2"}], "-", RowBox[{"risk", " ", "SWB"}]}], "*)"}], "\n", RowBox[{ RowBox[{ RowBox[{"SWC", "[", RowBox[{"(*", "strata", "*)"}], RowBox[{ RowBox[{"{", RowBox[{"hc_", ",", "ha_", ",", "n_", ",", "dw_"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"worm", "/", " ", "snail"}], "*)"}], RowBox[{"{", RowBox[{"\[Gamma]_", ",", "\[Nu]_"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", "fecundity", "*)"}], "fcp_", ",", "fap_", ",", "\[IndentingNewLine]", RowBox[{"(*", "Demographics", "*)"}], RowBox[{"{", RowBox[{"(*", RowBox[{"birth", "/", "mort"}], "*)"}], RowBox[{"\[Mu]_", ",", RowBox[{"(*", "maturation", "*)"}], "ma_"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"child", " ", "transmision"}], "*)"}], RowBox[{"{", RowBox[{"a1_", ",", "b1_", ",", "a2_", ",", "b2_", ",", "f1_"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"adult", " ", "transmision"}], "*)"}], RowBox[{"{", RowBox[{"A1_", ",", "B1_", ",", "A2_", ",", "B2_", ",", "F1_"}], "}"}]}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{"hc1", ",", "hc2", ",", "ha1", ",", "ha2", ",", RowBox[{"(*", "sources", "*)"}], "Sc", ",", "Sa", ",", RowBox[{"rr", "=", RowBox[{"Range", "[", RowBox[{"0", ",", "n"}], "]"}]}], ",", RowBox[{"(*", "variables", "*)"}], "vc1", ",", "vc2"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"hc1", "=", RowBox[{"HTM", "[", RowBox[{ RowBox[{"{", RowBox[{ FractionBox[ RowBox[{"a1", " ", "y"}], "dw"], ",", "ma", ",", "\[Gamma]"}], "}"}], ",", "n", ",", SubscriptBox["hc", "1"]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"hc2", "=", RowBox[{"HTM", "[", RowBox[{ RowBox[{"{", RowBox[{ FractionBox[ RowBox[{"a2", " ", "y"}], "dw"], ",", "ma", ",", "\[Gamma]"}], "}"}], ",", "n", ",", SubscriptBox["hc", "2"]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ha1", "=", RowBox[{"HTM", "[", RowBox[{ RowBox[{"{", RowBox[{ FractionBox[ RowBox[{"A1", " ", "y"}], "dw"], ",", "\[Mu]", ",", "\[Gamma]"}], "}"}], ",", "n", ",", SubscriptBox["ha", "1"]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ha2", "=", RowBox[{"HTM", "[", RowBox[{ RowBox[{"{", RowBox[{ FractionBox[ RowBox[{"A2", " ", "y"}], "dw"], ",", "\[Mu]", ",", "\[Gamma]"}], "}"}], ",", "n", ",", SubscriptBox["ha", "2"]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", "variables", "*)"}], RowBox[{"vc1", "=", RowBox[{ SubscriptBox["hc", "1"], "/@", "rr"}]}], ";", RowBox[{"vc2", "=", RowBox[{ SubscriptBox["hc", "2"], "/@", "rr"}]}], ";", "\[IndentingNewLine]", RowBox[{"Sc", "=", RowBox[{"ma", " ", RowBox[{"UV", "[", "n", "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"Sa", "=", RowBox[{"\[Mu]", RowBox[{"(", RowBox[{ RowBox[{"f1", " ", "vc1"}], "+", RowBox[{ RowBox[{"(", RowBox[{"1", "-", "f1"}], ")"}], "vc2"}]}], ")"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"hc1", "+", "Sc"}], ",", RowBox[{"hc2", "+", "Sc"}], ",", "\[IndentingNewLine]", RowBox[{"ha1", "+", "Sa"}], ",", RowBox[{"ha2", "+", "Sa"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"b1", " ", "f1", " ", RowBox[{"FOS", "[", RowBox[{ RowBox[{"{", RowBox[{ SubscriptBox["hc", "1"], ",", "n", ",", "dw"}], "}"}], ",", "fcp"}], "]"}]}], "+", RowBox[{"b2", " ", RowBox[{"(", RowBox[{"1", "-", "f1"}], ")"}], RowBox[{"FOS", "[", RowBox[{ RowBox[{"{", RowBox[{ SubscriptBox["hc", "2"], ",", "n", ",", "dw"}], "}"}], ",", "fcp"}], "]"}]}], "+", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"relative", " ", RowBox[{"adult", "/", "child"}]}], "*)"}], RowBox[{ FractionBox["ma", "\[Mu]"], RowBox[{"(", RowBox[{ RowBox[{"B1", " ", "F1", " ", RowBox[{"FOS", "[", RowBox[{ RowBox[{"{", RowBox[{ SubscriptBox["ha", "1"], ",", "n", ",", "dw"}], "}"}], ",", "fap"}], "]"}]}], "+", RowBox[{"B2", " ", RowBox[{"(", RowBox[{"1", "-", "F1"}], ")"}], RowBox[{"FOS", "[", RowBox[{ RowBox[{"{", RowBox[{ SubscriptBox["ha", "2"], ",", "n", ",", "dw"}], "}"}], ",", "fap"}], "]"}]}]}], ")"}]}]}], ")"}], RowBox[{"(", RowBox[{"1", "-", "y"}], ")"}]}], "-", " ", RowBox[{"\[Nu]", " ", "y"}]}]}], "}"}]}]}], "]"}]}], ";"}]}]}]], "Input", CellChangeTimes->{ 3.61158065109748*^9, 3.616361731879084*^9, {3.6163624601085196`*^9, 3.61636250856399*^9}, {3.6163625675620823`*^9, 3.616362585729116*^9}, 3.6163626173690786`*^9, {3.6163649439253473`*^9, 3.6163649505527425`*^9}, { 3.616426493094784*^9, 3.6164264968632817`*^9}, 3.6167128479842978`*^9, 3.6167128813133807`*^9, 3.6167143473762608`*^9, 3.616773100652418*^9, 3.6167731426502447`*^9, 3.617989767789319*^9, 3.617994608219841*^9, { 3.617995067677322*^9, 3.6179950713707943`*^9}, {3.618433125121267*^9, 3.6184331260889125`*^9}, {3.6184375487604675`*^9, 3.618437560093031*^9}, { 3.6184393722827854`*^9, 3.6184393816120176`*^9}, {3.6604063713819847`*^9, 3.6604064008517013`*^9}, 3.660406535860652*^9, 3.660406596890296*^9, 3.6604066634276342`*^9}, CellTags->"Coupled SWB - simple snail"] }, Closed]] }, Open ]] }, WindowToolbars->"EditBar", WindowSize->{1163, 946}, WindowMargins->{{26, Automatic}, {-42, Automatic}}, ShowSelection->True, ShowCellTags->True, FrontEndVersion->"10.2 for Microsoft Windows (64-bit) (July 7, 2015)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{ "SWB"->{ Cell[1183, 37, 11403, 330, 1122, "Input", CellTags->"SWB"]}, "SWB control"->{ Cell[12974, 379, 8200, 231, 386, "Input", CellTags->"SWB control"]}, "Coupled SWB - simple snail"->{ Cell[21618, 622, 12570, 330, 964, "Input", CellTags->"Coupled SWB - simple snail"]} } *) (*CellTagsIndex CellTagsIndex->{ {"SWB", 34572, 969}, {"SWB control", 34656, 972}, {"Coupled SWB - simple snail", 34763, 975} } *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[579, 22, 242, 3, 101, "Title"], Cell[824, 27, 98, 1, 56, "Subtitle"], Cell[CellGroupData[{ Cell[947, 32, 233, 3, 49, "Subsection"], Cell[1183, 37, 11403, 330, 1122, "Input", CellTags->"SWB"] }, Closed]], Cell[CellGroupData[{ Cell[12623, 372, 348, 5, 41, "Subsection"], Cell[12974, 379, 8200, 231, 386, "Input", CellTags->"SWB control"] }, Closed]], Cell[CellGroupData[{ Cell[21211, 615, 404, 5, 41, "Subsection"], Cell[21618, 622, 12570, 330, 964, "Input", CellTags->"Coupled SWB - simple snail"] }, Closed]] }, Open ]] } ] *) (* End of internal cache information *)