(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 7.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 6135, 203] NotebookOptionsPosition[ 5504, 178] NotebookOutlinePosition[ 5893, 195] CellTagsIndexPosition[ 5850, 192] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Program 06-04: Probability generating function", "Section", FontColor->RGBColor[1, 0, 0]], Cell["\<\ The probability generating function G for the simple birth and death process \ for equal birth and death rates \[Lambda] is given by eqn (6.24). The first \ input defines G but time has been made dimensionless by putting \[Tau]=\ \[Lambda]t:\ \>", "Text", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ RowBox[{ RowBox[{"G", "[", RowBox[{"s_", ",", "\[Tau]_", ",", "n0_"}], "]"}], "=", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{"1", "+", RowBox[{ RowBox[{"(", RowBox[{"\[Tau]", "-", "1"}], ")"}], RowBox[{"(", RowBox[{"1", "-", "s"}], ")"}]}]}], ")"}], "/", RowBox[{"(", RowBox[{"1", "+", RowBox[{"\[Tau]", RowBox[{"(", RowBox[{"1", "-", "s"}], ")"}]}]}], ")"}]}], ")"}], "^", "n0"}]}]], "Input"], Cell[TextData[{ "The next function ", StyleBox["probdist[]", FontSlant->"Plain", FontVariations->{"CompatibilityType"->0}], StyleBox["defines the proability distribution as a function of \[Tau] , \ truncated at n=30. The initial population is ", FontVariations->{"CompatibilityType"->0}], Cell[BoxData[ FormBox[ SubscriptBox["n", "0"], TraditionalForm]]], "=15." }], "Text", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"probdist", "[", "\[Tau]_", "]"}], "=", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", RowBox[{"SeriesCoefficient", "[", RowBox[{ RowBox[{"Series", "[", RowBox[{ RowBox[{"G", "[", RowBox[{"s", ",", "\[Tau]", ",", "15"}], "]"}], ",", RowBox[{"{", RowBox[{"s", ",", "0", ",", "30"}], "}"}]}], "]"}], ",", "\[IndentingNewLine]", "i"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "0", ",", "30"}], "}"}]}], "]"}], "//", "N"}]}], ";"}]], "Input"], Cell["\<\ The following shows a graph of the distributions for \[Tau]=1,2,3,4,5.\ \>", "Text", CellChangeTimes->{{3.4408443583258*^9, 3.4408443619294*^9}}, FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ RowBox[{ RowBox[{"graphprobdist", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"probdist", "[", "\[Tau]", "]"}], ",", RowBox[{"AxesOrigin", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]}], ",", RowBox[{"PlotRange", "\[Rule]", "All"}], ",", RowBox[{"Joined", "\[Rule]", "True"}]}], "]"}], ",", RowBox[{"{", RowBox[{"\[Tau]", ",", "1", ",", "5"}], "}"}]}], "]"}]}], ";"}]], "Input", CellChangeTimes->{{3.4408442347738*^9, 3.4408442438218*^9}}], Cell[BoxData[ RowBox[{"Show", "[", RowBox[{"graphprobdist", ",", RowBox[{"Graphics", "[", RowBox[{"{", RowBox[{ RowBox[{"Text", "[", RowBox[{"\"\<\[Tau]=1\>\"", ",", RowBox[{"{", RowBox[{"17", ",", "0.065"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}]}], "]"}], ",", RowBox[{"Text", "[", RowBox[{"\"\<\[Tau]=2\>\"", ",", RowBox[{"{", RowBox[{"14.2", ",", "0.054"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}]}], "]"}], ",", RowBox[{"Text", "[", RowBox[{"\"\<\[Tau]=3\>\"", ",", RowBox[{"{", RowBox[{"12.5", ",", "0.047"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}]}], "]"}], ",", RowBox[{"Text", "[", RowBox[{"\"\<\[Tau]=4\>\"", ",", RowBox[{"{", RowBox[{"11.2", ",", "0.041"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}]}], "]"}], ",", RowBox[{"Text", "[", RowBox[{"\"\<\[Tau]=5\>\"", ",", RowBox[{"{", RowBox[{"9", ",", "0.033"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}]}], "]"}]}], "}"}], "]"}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{"BaseStyle", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"FontSlant", "\[Rule]", "Italic"}], ",", RowBox[{"FontSize", "\[Rule]", "12"}]}], "}"}]}]}], "]"}]], "Input", CellChangeTimes->{{3.4408442522302*^9, 3.4408442579866*^9}, { 3.442578805028*^9, 3.442578838112*^9}}], Cell["\<\ Higher values for \[Tau] seem to confirm that extinction is certain for this \ model in which the birth and death parameters are equal.\ \>", "Text", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]] }, Open ]] }, WindowSize->{862, 369}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, PrintingCopies->1, PrintingPageRange->{1, 1}, FrontEndVersion->"7.0 for Microsoft Windows (32-bit) (November 10, 2008)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[567, 22, 96, 1, 71, "Section"], Cell[666, 25, 318, 7, 47, "Text"], Cell[987, 34, 536, 19, 31, "Input"], Cell[1526, 55, 443, 14, 29, "Text"], Cell[1972, 71, 671, 20, 52, "Input"], Cell[2646, 93, 209, 5, 29, "Text"], Cell[2858, 100, 588, 16, 31, "Input"], Cell[3449, 118, 1824, 50, 112, "Input"], Cell[5276, 170, 212, 5, 29, "Text"] }, Open ]] } ] *) (* End of internal cache information *)