(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 11.3' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 11722, 305] NotebookOptionsPosition[ 10893, 279] NotebookOutlinePosition[ 11250, 295] CellTagsIndexPosition[ 11207, 292] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["\<\ Logistic growth given by the differential equation y' = ky (A - y), k, A > 0, \ y (0) = y0 Instructions: Just evaluate notebook to generate the module! \ \>", "Section", Evaluatable->False, CellChangeTimes->{{3.760364483452333*^9, 3.7603645337477293`*^9}, { 3.760365065792344*^9, 3.760365085702284*^9}, {3.7612980732796373`*^9, 3.761298074510783*^9}, 3.761298141817131*^9, 3.761298187590493*^9, { 3.761298278237306*^9, 3.761298325156611*^9}},ExpressionUUID->"d9a51d60-3c8a-43d6-9c17-\ 81dc801836ac"], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"odeLogistic", "=", " ", RowBox[{ RowBox[{"D", "[", RowBox[{ RowBox[{"y", "[", "t", "]"}], ",", "t"}], "]"}], "\[Equal]", RowBox[{"k", "*", RowBox[{"y", "[", "t", "]"}], "*", RowBox[{"(", RowBox[{"A", "-", RowBox[{"y", "[", "t", "]"}]}], ")"}]}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{"yLogistic", "=", " ", RowBox[{ RowBox[{"y", "[", "t", "]"}], "/.", RowBox[{"First", "[", RowBox[{"Quiet", "@", RowBox[{"DSolve", "[", RowBox[{ RowBox[{"{", RowBox[{"odeLogistic", ",", RowBox[{ RowBox[{"y", "[", "0", "]"}], "\[Equal]", "y0"}]}], "}"}], ",", "y", ",", "t"}], "]"}]}], "]"}]}]}]}], "Input", CellChangeTimes->{{3.760364483452333*^9, 3.7603645337477293`*^9}, { 3.760365065792344*^9, 3.760365085702284*^9}, {3.7612980732796373`*^9, 3.761298074510783*^9}, 3.761298141817131*^9}, CellLabel->"In[25]:=",ExpressionUUID->"5b655048-40db-4d4b-b5e5-2eda4167e27b"], Cell[BoxData[ FractionBox[ RowBox[{"A", " ", SuperscriptBox["\[ExponentialE]", RowBox[{"A", " ", "k", " ", "t"}]], " ", "y0"}], RowBox[{"A", "-", "y0", "+", RowBox[{ SuperscriptBox["\[ExponentialE]", RowBox[{"A", " ", "k", " ", "t"}]], " ", "y0"}]}]]], "Output", CellChangeTimes->{3.7612981460881443`*^9, 3.761298182222454*^9, 3.761298290245957*^9, 3.76129833631992*^9}, CellLabel->"Out[26]=",ExpressionUUID->"aac1bf2a-6471-4dd9-b56d-fdfbe5226d13"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"Plot", "[", RowBox[{ RowBox[{"{", RowBox[{"carryingCapacity", ",", RowBox[{"yLogistic", "/.", RowBox[{"{", RowBox[{ RowBox[{"k", "\[Rule]", "growthConstant"}], ",", RowBox[{"A", "\[Rule]", "carryingCapacity"}], ",", RowBox[{"y0", "\[Rule]", "initialPopulation"}]}], "}"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "600"}], "}"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"-", ".3"}], ",", "2"}], "}"}]}], ",", RowBox[{"AxesOrigin", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"t", ",", "y"}], "}"}]}], ",", RowBox[{"Ticks", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"150", ",", "\"\< \>\""}], "}"}], ",", RowBox[{"{", RowBox[{"300", ",", "\"\< \>\""}], "}"}], ",", RowBox[{"{", RowBox[{"450", ",", " ", "\"\< \>\""}], "}"}], ",", RowBox[{"{", RowBox[{"600", ",", " ", "\"\< \>\""}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{".6", ",", " ", "\"\< \>\""}], "}"}], ",", RowBox[{"{", RowBox[{"1.2", ",", " ", "\"\< \>\""}], "}"}], ",", " ", RowBox[{"{", RowBox[{"1.8", ",", " ", "\"\< \>\""}], "}"}]}], "}"}]}], "}"}]}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{"Dashed", ",", "Thick"}], "}"}]}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}], ",", RowBox[{"Epilog", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"Text", "[", RowBox[{ RowBox[{"Row", "[", RowBox[{"{", RowBox[{ RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Italic"}], "]"}], ",", "\"\< = \>\"", ",", RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Italic"}], "]"}], ",", "\"\<\\nstable\>\""}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"30", ",", RowBox[{"carryingCapacity", "+", ".15"}]}], "}"}]}], "]"}], ",", RowBox[{"Text", "[", RowBox[{ RowBox[{"Row", "[", RowBox[{"{", RowBox[{ RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Italic"}], "]"}], ",", "\"\< =0\\n unstable \>\""}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"30", ",", RowBox[{"-", ".15"}]}], "}"}]}], "]"}]}], "}"}]}]}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ "growthConstant", ",", "0.01", ",", "\"\\""}], "}"}], ",", "0.01", ",", "0.2", ",", ".001", ",", RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ "carryingCapacity", ",", "1", ",", "\"\\""}], "}"}], ",", "0.5", ",", "1.5", ",", " ", ".001", ",", RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ "initialPopulation", ",", "0.1", ",", "\"\\""}], "}"}], ",", RowBox[{"{", RowBox[{"0.01", ",", "1.9", ",", ".001", ",", RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "}"}], ",", RowBox[{"SaveDefinitions", "\[Rule]", "True"}]}], "}"}]}], "]"}], "\[IndentingNewLine]"}]], "Input", CellOpen->False, CellChangeTimes->{{3.760364571104711*^9, 3.7603646270582647`*^9}, { 3.760364664341751*^9, 3.7603649386841373`*^9}, 3.760364977284512*^9, { 3.760365008212014*^9, 3.760365024231616*^9}}, CellLabel->"In[27]:=",ExpressionUUID->"a0fd07cc-209e-492b-bd7b-0f9d496ce504"], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`carryingCapacity$$ = 1.0590000000000002`, $CellContext`growthConstant$$ = 0.019000000000000003`, $CellContext`initialPopulation$$ = 0.1, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{{ Hold[$CellContext`growthConstant$$], 0.01, "growth constant k"}, 0.01, 0.2, 0.001}, {{ Hold[$CellContext`carryingCapacity$$], 1, "carrying capacity A"}, 0.5, 1.5, 0.001}, {{ Hold[$CellContext`initialPopulation$$], 0.1, "initial population y0"}, { 0.01, 1.9, 0.001, Appearance -> "Labeled"}}}, Typeset`size$$ = { 360., {123., 128.}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True, $CellContext`growthConstant$28545$$ = 0, $CellContext`carryingCapacity$28546$$ = 0, $CellContext`initialPopulation$28547$$ = False}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`carryingCapacity$$ = 1, $CellContext`growthConstant$$ = 0.01, $CellContext`initialPopulation$$ = 0.1}, "ControllerVariables" :> { Hold[$CellContext`growthConstant$$, \ $CellContext`growthConstant$28545$$, 0], Hold[$CellContext`carryingCapacity$$, \ $CellContext`carryingCapacity$28546$$, 0], Hold[$CellContext`initialPopulation$$, \ $CellContext`initialPopulation$28547$$, False]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> Plot[{$CellContext`carryingCapacity$$, ReplaceAll[$CellContext`yLogistic, {$CellContext`k -> \ $CellContext`growthConstant$$, $CellContext`A -> \ $CellContext`carryingCapacity$$, $CellContext`y0 -> \ $CellContext`initialPopulation$$}]}, {$CellContext`t, 0, 600}, PlotRange -> {-0.3, 2}, AxesOrigin -> {0, 0}, AxesLabel -> {$CellContext`t, $CellContext`y}, Ticks -> {{{150, " "}, {300, " "}, {450, " "}, {600, " "}}, {{ 0.6, " "}, {1.2, " "}, {1.8, " "}}}, PlotStyle -> {Dashed, Thick}, PlotLabel -> "Logistic Growth", Epilog -> { Text[ Row[{ Style["y", Italic], " = ", Style["A", Italic], "\nstable"}], { 30, $CellContext`carryingCapacity$$ + 0.15}], Text[ Row[{ Style["y", Italic], " =0\n unstable "}], {30, -0.15}]}], "Specifications" :> {{{$CellContext`growthConstant$$, 0.01, "growth constant k"}, 0.01, 0.2, 0.001, Appearance -> "Labeled"}, {{$CellContext`carryingCapacity$$, 1, "carrying capacity A"}, 0.5, 1.5, 0.001, Appearance -> "Labeled"}, {{$CellContext`initialPopulation$$, 0.1, "initial population y0"}, { 0.01, 1.9, 0.001, Appearance -> "Labeled"}, SaveDefinitions -> True}}, "Options" :> {}, "DefaultOptions" :> {}], ImageSizeCache->{405., {195., 201.}}, SingleEvaluation->True], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UndoTrackedVariables:>{Typeset`show$$, Typeset`bookmarkMode$$}, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", CellChangeTimes->{ 3.760365026506469*^9, 3.760433169904093*^9, {3.760970002630478*^9, 3.76097001770685*^9}, 3.761298113220999*^9, 3.761298182307547*^9, 3.761298290315421*^9, 3.761298336460843*^9}, CellLabel->"Out[27]=",ExpressionUUID->"2a166c6a-b7ab-412d-ab99-ce0fc4ffbd3a"] }, Open ]] }, Open ]] }, WindowSize->{1380, 916}, WindowMargins->{{Automatic, 189}, {Automatic, 102}}, FrontEndVersion->"11.3 for Mac OS X x86 (32-bit, 64-bit Kernel) (March 5, \ 2018)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 526, 12, 143, "Section",ExpressionUUID->"d9a51d60-3c8a-43d6-9c17-81dc801836ac", Evaluatable->False], Cell[CellGroupData[{ Cell[1131, 38, 1029, 28, 52, "Input",ExpressionUUID->"5b655048-40db-4d4b-b5e5-2eda4167e27b"], Cell[2163, 68, 482, 11, 59, "Output",ExpressionUUID->"aac1bf2a-6471-4dd9-b56d-fdfbe5226d13"] }, Open ]], Cell[CellGroupData[{ Cell[2682, 84, 4258, 112, 19, "Input",ExpressionUUID->"a0fd07cc-209e-492b-bd7b-0f9d496ce504", CellOpen->False], Cell[6943, 198, 3922, 77, 449, "Output",ExpressionUUID->"2a166c6a-b7ab-412d-ab99-ce0fc4ffbd3a"] }, Open ]] }, Open ]] } ] *)