(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 25689, 832] NotebookOptionsPosition[ 21937, 708] NotebookOutlinePosition[ 23320, 750] CellTagsIndexPosition[ 23277, 747] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Lesson 3 - demonstration code", "Title", CellChangeTimes->{{3.4323368555625*^9, 3.4323368600625*^9}, { 3.432915856640625*^9, 3.43291586221875*^9}, {3.432918644203125*^9, 3.432918649390625*^9}, 3.4335435794375*^9}], Cell[CellGroupData[{ Cell["\<\ Example of a genetic model: determining the optimum maternal sex ratio in \ diploids\ \>", "Section", CellChangeTimes->{{3.433541469421875*^9, 3.4335414853125*^9}, { 3.433553684921875*^9, 3.433553719390625*^9}}], Cell["\<\ aa = wild type mothers, produce sex ratio (female investment) F Aa = rare mutant, mothers produce sex ratio (female investment) F+d, whereby \ we assume d to be small (i.e. allele has only a small effect) n = number of offspring produced\ \>", "Text", CellChangeTimes->{{3.433539928328125*^9, 3.43353994634375*^9}, 3.43354152984375*^9, {3.43354169134375*^9, 3.433541699859375*^9}, { 3.433544043234375*^9, 3.43354404990625*^9}, {3.43355372959375*^9, 3.433553750734375*^9}}], Cell["\<\ When A gene is rare we need to consider 2 types of matings: wild type matings (FxM) : aa x aa M type matings (FxM) : Aa x aa P type matings (FxM) : aa x Aa If the frequency of the A gene in females and males is pf and pm, then when \ rare its frequency in wild type, M type and P type colonies are approx. \ 1-2pf-2pm, 2pf and 2pm :\ \>", "Text", CellChangeTimes->{{3.433539952171875*^9, 3.43353998109375*^9}, { 3.433540018046875*^9, 3.433540049625*^9}, {3.433541749453125*^9, 3.433541753359375*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"Wfreq", "=", RowBox[{"1", "-", RowBox[{"2", "*", "pf"}], "-", RowBox[{"2", "*", "pm"}]}]}], ";"}], " "}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Mfreq", "=", RowBox[{"2", "*", "pf"}]}], ";"}], " "}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Pfreq", "=", RowBox[{"2", "*", "pm"}]}], ";"}], " ", "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"AamalesM", "=", RowBox[{ RowBox[{"(", RowBox[{"n", "/", "2"}], ")"}], RowBox[{"(", RowBox[{"1", "-", RowBox[{"(", RowBox[{"F", "+", "d"}], ")"}]}], ")"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"AamalesP", "=", RowBox[{ RowBox[{"(", RowBox[{"n", "/", "2"}], ")"}], RowBox[{"(", RowBox[{"1", "-", "F"}], ")"}]}]}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"AafemalesM", "=", RowBox[{ RowBox[{"(", RowBox[{"n", "/", "2"}], ")"}], RowBox[{"(", RowBox[{"F", "+", "d"}], ")"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"AafemalesP", "=", RowBox[{ RowBox[{"(", RowBox[{"n", "/", "2"}], ")"}], RowBox[{"(", "F", ")"}]}]}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"totmalesW", "=", RowBox[{"n", "*", RowBox[{"(", RowBox[{"1", "-", "F"}], ")"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"totfemalesW", "=", RowBox[{"n", "*", "F"}]}], ";"}]}], "Input", CellChangeTimes->{{3.433540136296875*^9, 3.43354019240625*^9}, { 3.43354022359375*^9, 3.433540234953125*^9}, {3.433540303703125*^9, 3.433540345703125*^9}, {3.43354038990625*^9, 3.433540411265625*^9}, { 3.43354174278125*^9, 3.43354176640625*^9}, {3.43354192375*^9, 3.433541948703125*^9}, {3.43354203925*^9, 3.433542057046875*^9}, { 3.43354228709375*^9, 3.433542289625*^9}, {3.433542435546875*^9, 3.433542478609375*^9}, {3.433544053625*^9, 3.4335440641875*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"Expand", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "pf"}], ")"}], "^", "2"}], " ", "*", " ", RowBox[{ RowBox[{"(", RowBox[{"1", "-", "pm"}], ")"}], "^", "2"}]}], "]"}], " ", RowBox[{"(*", " ", RowBox[{"keep", " ", "only", " ", "the", " ", "linear", " ", "terms"}], " ", "*)"}]}]], "Input", CellChangeTimes->{{3.43354025690625*^9, 3.43354026553125*^9}, { 3.43354032209375*^9, 3.433540329078125*^9}}], Cell[BoxData[ RowBox[{"1", "-", RowBox[{"2", " ", "pf"}], "+", SuperscriptBox["pf", "2"], "-", RowBox[{"2", " ", "pm"}], "+", RowBox[{"4", " ", "pf", " ", "pm"}], "-", RowBox[{"2", " ", SuperscriptBox["pf", "2"], " ", "pm"}], "+", SuperscriptBox["pm", "2"], "-", RowBox[{"2", " ", "pf", " ", SuperscriptBox["pm", "2"]}], "+", RowBox[{ SuperscriptBox["pf", "2"], " ", SuperscriptBox["pm", "2"]}]}]], "Output", CellChangeTimes->{{3.433540252234375*^9, 3.433540266140625*^9}}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"Expand", "[", RowBox[{"2", "*", RowBox[{"(", RowBox[{"1", "-", "pf"}], ")"}], "*", "pf", "*", RowBox[{ RowBox[{"(", RowBox[{"1", "-", "pm"}], ")"}], "^", "2"}]}], "]"}], " ", RowBox[{"(*", " ", RowBox[{"keep", " ", "only", " ", "the", " ", "linear", " ", "terms"}], " ", "*)"}]}]], "Input", CellChangeTimes->{{3.433540355671875*^9, 3.43354036053125*^9}, { 3.433541722390625*^9, 3.43354172290625*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"2", " ", "pf"}], "-", RowBox[{"2", " ", SuperscriptBox["pf", "2"]}], "-", RowBox[{"4", " ", "pf", " ", "pm"}], "+", RowBox[{"4", " ", SuperscriptBox["pf", "2"], " ", "pm"}], "+", RowBox[{"2", " ", "pf", " ", SuperscriptBox["pm", "2"]}], "-", RowBox[{"2", " ", SuperscriptBox["pf", "2"], " ", SuperscriptBox["pm", "2"]}]}]], "Output", CellChangeTimes->{3.43354036096875*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"Expand", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "pf"}], ")"}], "^", "2"}], "*", "2", "*", RowBox[{"(", RowBox[{"1", "-", "pm"}], ")"}], "*", "pm"}], "]"}], " ", RowBox[{"(*", " ", RowBox[{"keep", " ", "only", " ", "the", " ", "linear", " ", "terms"}], " ", "*)"}]}]], "Input", CellChangeTimes->{{3.433540355671875*^9, 3.433540380828125*^9}, { 3.433541724171875*^9, 3.4335417245625*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"2", " ", "pm"}], "-", RowBox[{"4", " ", "pf", " ", "pm"}], "+", RowBox[{"2", " ", SuperscriptBox["pf", "2"], " ", "pm"}], "-", RowBox[{"2", " ", SuperscriptBox["pm", "2"]}], "+", RowBox[{"4", " ", "pf", " ", SuperscriptBox["pm", "2"]}], "-", RowBox[{"2", " ", SuperscriptBox["pf", "2"], " ", SuperscriptBox["pm", "2"]}]}]], "Output", CellChangeTimes->{{3.43354036096875*^9, 3.43354038221875*^9}}] }, Open ]], Cell["\<\ Now let's calculate the frequency of the A gene in the gametes of next \ generation males and females. For males: number of Aa males produced x 0.5\ \>", "Text", CellChangeTimes->{ 3.4335420875625*^9, {3.433542134859375*^9, 3.433542163140625*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"pmng", "=", RowBox[{"FullSimplify", "[", RowBox[{ RowBox[{"(", RowBox[{"1", "/", "2"}], ")"}], "*", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Mfreq", "*", "AamalesM"}], "+", RowBox[{"Pfreq", "*", "AamalesP"}]}], ")"}], "/", "totmalesW"}]}], "]"}]}]], "Input", CellChangeTimes->{{3.43354219203125*^9, 3.433542207140625*^9}}], Cell[BoxData[ RowBox[{ FractionBox["1", "2"], " ", RowBox[{"(", RowBox[{ FractionBox[ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"-", "1"}], "+", "d", "+", "F"}], ")"}], " ", "pf"}], RowBox[{ RowBox[{"-", "1"}], "+", "F"}]], "+", "pm"}], ")"}]}]], "Output", CellChangeTimes->{{3.433542208484375*^9, 3.43354221571875*^9}, 3.4335422948125*^9, 3.433542491515625*^9, 3.433544070703125*^9}] }, Open ]], Cell["For females: number of Aa females produced x 0.5 ", "Text", CellChangeTimes->{{3.4335421658125*^9, 3.433542167*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"pfng", "=", RowBox[{"FullSimplify", "[", RowBox[{ RowBox[{"(", RowBox[{"1", "/", "2"}], ")"}], "*", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Pfreq", "*", "AafemalesP"}], "+", RowBox[{"Mfreq", "*", "AafemalesM"}]}], ")"}], "/", "totfemalesW"}]}], "]"}]}]], "Input"], Cell[BoxData[ FractionBox[ RowBox[{ RowBox[{"d", " ", "pf"}], "+", RowBox[{"F", " ", RowBox[{"(", RowBox[{"pf", "+", "pm"}], ")"}]}]}], RowBox[{"2", " ", "F"}]]], "Output", CellChangeTimes->{3.4335422184375*^9, 3.433542298390625*^9, 3.433542493109375*^9, 3.433544073328125*^9}] }, Open ]], Cell[BoxData[{ RowBox[{ RowBox[{ "In", " ", "matrix", " ", "form", " ", "this", " ", "can", " ", "be", " ", "written", " ", RowBox[{"as", " ", ":", "\[IndentingNewLine]", "A"}]}], "=", RowBox[{"gene", " ", "transition", " ", "matrix"}]}], "\n", RowBox[{"(", GridBox[{ { RowBox[{ RowBox[{"fem", ".", " ", "parent"}], " ", "to", " ", RowBox[{"fem", ".", " ", "offspring"}], " "}], RowBox[{ RowBox[{"fem", ".", " ", "parent"}], " ", "to", " ", "male", " ", "offspring"}]}, { RowBox[{ "male", " ", "parent", " ", "to", " ", "female", " ", "offspring", " "}], RowBox[{ "male", " ", "parent", " ", "to", " ", "male", " ", "offspring"}]} }], ")"}]}], "Text"], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"A", "=", RowBox[{"(", GridBox[{ { RowBox[{"D", "[", RowBox[{"pfng", ",", "pf"}], "]"}], RowBox[{"D", "[", RowBox[{"pmng", ",", "pf"}], "]"}]}, { RowBox[{"D", "[", RowBox[{"pfng", ",", "pm"}], "]"}], RowBox[{"D", "[", RowBox[{"pmng", ",", "pm"}], "]"}]} }], ")"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", RowBox[{"FullSimplify", "[", "A", "]"}], "]"}]}], "Input", CellChangeTimes->{{3.433544092875*^9, 3.43354413684375*^9}}], Cell[BoxData[ TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ { FractionBox[ RowBox[{"d", "+", "F"}], RowBox[{"2", " ", "F"}]], FractionBox[ RowBox[{ RowBox[{"-", "1"}], "+", "d", "+", "F"}], RowBox[{"2", " ", RowBox[{"(", RowBox[{ RowBox[{"-", "1"}], "+", "F"}], ")"}]}]]}, { FractionBox["1", "2"], FractionBox["1", "2"]} }, GridBoxAlignment->{ "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]], "Output", CellChangeTimes->{3.433542222859375*^9, 3.433542302375*^9, 3.43354249503125*^9, 3.43354407734375*^9, 3.433544138234375*^9}] }, Open ]], Cell["Now calculate the eigenvalues :", "Text"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"evalues", "=", RowBox[{"Eigenvalues", "[", "A", "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"{", RowBox[{ FractionBox[ RowBox[{ RowBox[{ RowBox[{"-", "2"}], " ", "d"}], "-", RowBox[{"4", " ", "F"}], "+", RowBox[{"2", " ", "d", " ", "F"}], "+", RowBox[{"4", " ", SuperscriptBox["F", "2"]}], "-", SqrtBox[ RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"2", " ", "d"}], "+", RowBox[{"4", " ", "F"}], "-", RowBox[{"2", " ", "d", " ", "F"}], "-", RowBox[{"4", " ", SuperscriptBox["F", "2"]}]}], ")"}], "2"], "+", RowBox[{"4", " ", "d", " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"-", "4"}], " ", "F"}], "+", RowBox[{"4", " ", SuperscriptBox["F", "2"]}]}], ")"}]}]}]]}], RowBox[{"2", " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"-", "4"}], " ", "F"}], "+", RowBox[{"4", " ", SuperscriptBox["F", "2"]}]}], ")"}]}]], ",", FractionBox[ RowBox[{ RowBox[{ RowBox[{"-", "2"}], " ", "d"}], "-", RowBox[{"4", " ", "F"}], "+", RowBox[{"2", " ", "d", " ", "F"}], "+", RowBox[{"4", " ", SuperscriptBox["F", "2"]}], "+", SqrtBox[ RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"2", " ", "d"}], "+", RowBox[{"4", " ", "F"}], "-", RowBox[{"2", " ", "d", " ", "F"}], "-", RowBox[{"4", " ", SuperscriptBox["F", "2"]}]}], ")"}], "2"], "+", RowBox[{"4", " ", "d", " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"-", "4"}], " ", "F"}], "+", RowBox[{"4", " ", SuperscriptBox["F", "2"]}]}], ")"}]}]}]]}], RowBox[{"2", " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"-", "4"}], " ", "F"}], "+", RowBox[{"4", " ", SuperscriptBox["F", "2"]}]}], ")"}]}]]}], "}"}]], "Output", CellChangeTimes->{3.43354222996875*^9, 3.4335423045625*^9, 3.433542499515625*^9}] }, Open ]], Cell["The dominant eigenvalue is the largest of these :", "Text"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"domeigenv", "=", RowBox[{"evalues", "[", RowBox[{"[", "2", "]"}], "]"}]}]], "Input"], Cell[BoxData[ FractionBox[ RowBox[{ RowBox[{ RowBox[{"-", "2"}], " ", "d"}], "-", RowBox[{"4", " ", "F"}], "+", RowBox[{"2", " ", "d", " ", "F"}], "+", RowBox[{"4", " ", SuperscriptBox["F", "2"]}], "+", SqrtBox[ RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"2", " ", "d"}], "+", RowBox[{"4", " ", "F"}], "-", RowBox[{"2", " ", "d", " ", "F"}], "-", RowBox[{"4", " ", SuperscriptBox["F", "2"]}]}], ")"}], "2"], "+", RowBox[{"4", " ", "d", " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"-", "4"}], " ", "F"}], "+", RowBox[{"4", " ", SuperscriptBox["F", "2"]}]}], ")"}]}]}]]}], RowBox[{"2", " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"-", "4"}], " ", "F"}], "+", RowBox[{"4", " ", SuperscriptBox["F", "2"]}]}], ")"}]}]]], "Output", CellChangeTimes->{3.433542234625*^9, 3.433542306203125*^9, 3.433542501296875*^9}] }, Open ]], Cell["\<\ An equilibrium occurs when the dominant eigenvalue = 1, and we can evaluate \ this equilibrium for d approaching zero :\ \>", "Text", CellChangeTimes->{{3.433542594140625*^9, 3.43354262671875*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"Solve", "[", RowBox[{ RowBox[{"domeigenv", "\[Equal]", "1"}], ",", "F"}], "]"}], "/.", RowBox[{"{", RowBox[{"d", "\[Rule]", "0"}], "}"}]}]], "Input"], Cell[BoxData[ RowBox[{"{", RowBox[{"{", RowBox[{"F", "\[Rule]", FractionBox["1", "2"]}], "}"}], "}"}]], "Output", CellChangeTimes->{3.433542237703125*^9, 3.4335423081875*^9, 3.43354250303125*^9}] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Analysing class structured populations", "Section", CellChangeTimes->{{3.433541469421875*^9, 3.4335414853125*^9}, { 3.433553684921875*^9, 3.433553719390625*^9}, {3.43355375871875*^9, 3.433553766671875*^9}}], Cell["\<\ The population dynamics of female grey squirrels of different ages were shown \ to be characterised by the following Leslie matrix: (the 0.32, 0.57, 0.57, 0.57, 0.57, 0.57, 0.57 are the age specific net \ fecundities of 1, 2, 3, 4, 5, 6 and 7 year old squirrels, ie how many \ offspring they produce that survive up to age 1 and the 0.46, 0.77, 0.65, 0.67, 0.64 and 0.88 are the age specific survival \ probabilities, i.e. the probability that a squirrel from a given age class \ survives to the next year) \ \>", "Text", Evaluatable->False, CellChangeTimes->{{3.433553951890625*^9, 3.4335540570625*^9}, { 3.4335541756875*^9, 3.433554280984375*^9}}, AspectRatioFixed->True], Cell[BoxData[ RowBox[{ RowBox[{"L", "=", RowBox[{"(", "\[NoBreak]", GridBox[{ {"0.32", "0.57", "0.57", "0.57", "0.57", "0.57", "0.57"}, {"0.46", "0", "0", "0", "0", "0", "0"}, {"0", "0.77", "0", "0", "0", "0", "0"}, {"0", "0", "0.65", "0", "0", "0", "0"}, {"0", "0", "0", "0.67", "0", "0", "0"}, {"0", "0", "0", "0", "0.64", "0", "0"}, {"0", "0", "0", "0", "0", "0.88", "0"} }], "\[NoBreak]", ")"}]}], ";"}]], "Input", CellChangeTimes->{{3.43351765003125*^9, 3.433517650390625*^9}, { 3.43351770790625*^9, 3.433517816890625*^9}}], Cell["Now calculate the eigenvalues of the Leslie matrix :", "Text", CellChangeTimes->{{3.43355430984375*^9, 3.433554313140625*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"evalues", "=", RowBox[{"Eigenvalues", "[", "L", "]"}]}]], "Input", CellChangeTimes->{3.43355382996875*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{"1.0385029797078027`", ",", RowBox[{"0.3400325975490337`", "\[InvisibleSpace]", "+", RowBox[{"0.5062007586977181`", " ", "\[ImaginaryI]"}]}], ",", RowBox[{"0.3400325975490337`", "\[InvisibleSpace]", "-", RowBox[{"0.5062007586977181`", " ", "\[ImaginaryI]"}]}], ",", RowBox[{ RowBox[{"-", "0.16123061807419825`"}], "+", RowBox[{"0.5795702623471973`", " ", "\[ImaginaryI]"}]}], ",", RowBox[{ RowBox[{"-", "0.16123061807419825`"}], "-", RowBox[{"0.5795702623471973`", " ", "\[ImaginaryI]"}]}], ",", RowBox[{ RowBox[{"-", "0.5380534693287369`"}], "+", RowBox[{"0.2546023129998416`", " ", "\[ImaginaryI]"}]}], ",", RowBox[{ RowBox[{"-", "0.5380534693287369`"}], "-", RowBox[{"0.2546023129998416`", " ", "\[ImaginaryI]"}]}]}], "}"}]], "Output", CellChangeTimes->{ 3.43354222996875*^9, 3.4335423045625*^9, 3.433542499515625*^9, { 3.433554288171875*^9, 3.433554292390625*^9}}] }, Open ]], Cell["These are the absolute values of the Eigenvalues :", "Text", CellChangeTimes->{{3.43355429815625*^9, 3.433554315640625*^9}}], Cell[CellGroupData[{ Cell["Abs[evalues]", "Input", CellChangeTimes->{3.4335538784375*^9}, AspectRatioFixed->True], Cell[BoxData[ RowBox[{"{", RowBox[{ "1.0385029797078027`", ",", "0.6098043747810347`", ",", "0.6098043747810347`", ",", "0.6015787572727175`", ",", "0.6015787572727175`", ",", "0.5952511013358641`", ",", "0.5952511013358641`"}], "}"}]], "Output", CellChangeTimes->{3.43351795578125*^9, 3.433554317359375*^9}] }, Open ]], Cell["\<\ The dominant eigenvalue is the Eigenvalue with the largest absolute value, \ which is the first one, and that one determines overall population growth \ once the stable age distribution is reached :\ \>", "Text", CellChangeTimes->{{3.43355429815625*^9, 3.433554344390625*^9}, { 3.433554429875*^9, 3.43355445096875*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"domeigenv", "=", RowBox[{"evalues", "[", RowBox[{"[", "1", "]"}], "]"}]}]], "Input", CellChangeTimes->{3.43355384096875*^9}], Cell[BoxData["1.0385029797078027`"], "Output", CellChangeTimes->{3.433542234625*^9, 3.433542306203125*^9, 3.433542501296875*^9, 3.43355434721875*^9}] }, Open ]], Cell["\<\ i.e. when the stable age distribution is reached the population will increase \ by 3.85% per year.\ \>", "Text", CellChangeTimes->{{3.43355429815625*^9, 3.433554344390625*^9}, { 3.433554390484375*^9, 3.433554422265625*^9}}], Cell["\<\ The stable age distribution can be found from the eigenvector corresponding \ to the dominant eigenvalue:\ \>", "Text", Evaluatable->False, CellChangeTimes->{{3.433554459296875*^9, 3.433554466625*^9}}, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"Eigenvectors", "[", "L", "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"-", "0.8526848477381511`"}], ",", RowBox[{"-", "0.3776927342759386`"}], ",", RowBox[{"-", "0.28004099273196087`"}], ",", RowBox[{"-", "0.1752779229646412`"}], ",", RowBox[{"-", "0.11308220648471506`"}], ",", RowBox[{"-", "0.06968936398293304`"}], ",", RowBox[{"-", "0.05905292666780428`"}]}], "}"}]], "Output", CellChangeTimes->{3.4335545460625*^9}] }, Open ]], Cell[CellGroupData[{ Cell["\<\ stableagedistr=100*Eigenvectors[L][[1]]/Apply[Plus,Eigenvectors[L][[1]]]\ \>", "Input", CellChangeTimes->{{3.433554473703125*^9, 3.433554514421875*^9}}, AspectRatioFixed->True], Cell[BoxData[ RowBox[{"{", RowBox[{ "44.2373831474771`", ",", "19.59474035747591`", ",", "14.528557327299769`", ",", "9.093437811225085`", ",", "5.866717238726697`", ",", "3.615491824435131`", ",", "3.0636722933603076`"}], "}"}]], "Output", CellChangeTimes->{3.433518005234375*^9, 3.4335545246875*^9}] }, Open ]], Cell["\<\ i.e. the population will eventually contain 44%, 19%, 14%, 9%, 6%, 4% and 3% \ of 1, 2, 3, 4, 5, 6 and 7 year old female squirrels.\ \>", "Text", Evaluatable->False, CellChangeTimes->{{3.433554459296875*^9, 3.433554466625*^9}, { 3.4335545645625*^9, 3.43355460321875*^9}}, AspectRatioFixed->True] }, Open ]] }, Open ]] }, WindowToolbars->"EditBar", WindowSize->{1185, 740}, WindowMargins->{{Automatic, 208}, {91, Automatic}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False}, FrontEndVersion->"6.0 for Microsoft Windows (32-bit) (February 7, 2008)", StyleDefinitions->Notebook[{ Cell[ StyleData[ StyleDefinitions -> FrontEnd`FileName[{"Creative", ""}, "PastelColor.nb", CharacterEncoding -> "WindowsANSI"]]], Cell[ StyleData["Input"], Background -> GrayLevel[1]], Cell[ StyleData["Output"]], Cell[ StyleData["Text"], CellDingbat -> None, Background -> GrayLevel[1]], Cell[ StyleData["Item"], FontWeight -> "Bold", FontColor -> GrayLevel[0]], Cell[ StyleData["InlineFormula"], FontFamily -> "Arial", FontSize -> 12, FontWeight -> "Bold", FontSlant -> "Plain", FontVariations -> {"StrikeThrough" -> False, "Underline" -> False}], Cell[ StyleData["Code"], Background -> GrayLevel[1]]}, Visible -> False, FrontEndVersion -> "6.0 for Microsoft Windows (32-bit) (February 7, 2008)", StyleDefinitions -> "PrivateStylesheetFormatting.nb"] ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[590, 23, 227, 3, 73, "Title"], Cell[CellGroupData[{ Cell[842, 30, 224, 5, 75, "Section"], Cell[1069, 37, 495, 9, 81, "Text"], Cell[1567, 48, 561, 13, 153, "Text"], Cell[2131, 63, 2214, 68, 262, "Input"], Cell[CellGroupData[{ Cell[4370, 135, 498, 14, 41, "Input"], Cell[4871, 151, 514, 14, 40, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[5422, 170, 481, 13, 41, "Input"], Cell[5906, 185, 444, 13, 40, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[6387, 203, 481, 13, 41, "Input"], Cell[6871, 218, 467, 13, 40, "Output"] }, Open ]], Cell[7353, 234, 261, 6, 63, "Text"], Cell[CellGroupData[{ Cell[7639, 244, 399, 12, 41, "Input"], Cell[8041, 258, 439, 13, 55, "Output"] }, Open ]], Cell[8495, 274, 123, 1, 45, "Text"], Cell[CellGroupData[{ Cell[8643, 279, 340, 11, 41, "Input"], Cell[8986, 292, 305, 9, 56, "Output"] }, Open ]], Cell[9306, 304, 750, 21, 97, "Text"], Cell[CellGroupData[{ Cell[10081, 329, 571, 17, 74, "Input"], Cell[10655, 348, 1042, 31, 86, "Output"] }, Open ]], Cell[11712, 382, 47, 0, 45, "Text"], Cell[CellGroupData[{ Cell[11784, 386, 93, 2, 41, "Input"], Cell[11880, 390, 2089, 68, 86, "Output"] }, Open ]], Cell[13984, 461, 65, 0, 45, "Text"], Cell[CellGroupData[{ Cell[14074, 465, 115, 3, 41, "Input"], Cell[14192, 470, 1015, 34, 86, "Output"] }, Open ]], Cell[15222, 507, 208, 4, 45, "Text"], Cell[CellGroupData[{ Cell[15455, 515, 199, 6, 41, "Input"], Cell[15657, 523, 212, 6, 55, "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[15918, 535, 218, 3, 75, "Section"], Cell[16139, 540, 688, 13, 81, "Text", Evaluatable->False], Cell[16830, 555, 585, 13, 128, "Input"], Cell[17418, 570, 133, 1, 45, "Text"], Cell[CellGroupData[{ Cell[17576, 575, 134, 3, 41, "Input"], Cell[17713, 580, 986, 22, 40, "Output"] }, Open ]], Cell[18714, 605, 131, 1, 45, "Text"], Cell[CellGroupData[{ Cell[18870, 610, 94, 2, 41, "Input"], Cell[18967, 614, 327, 7, 40, "Output"] }, Open ]], Cell[19309, 624, 332, 6, 45, "Text"], Cell[CellGroupData[{ Cell[19666, 634, 156, 4, 41, "Input"], Cell[19825, 640, 153, 2, 40, "Output"] }, Open ]], Cell[19993, 645, 236, 5, 45, "Text"], Cell[20232, 652, 238, 6, 45, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[20495, 662, 116, 3, 41, "Input"], Cell[20614, 667, 426, 10, 40, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[21077, 682, 188, 4, 41, "Input"], Cell[21268, 688, 316, 6, 40, "Output"] }, Open ]], Cell[21599, 697, 310, 7, 45, "Text", Evaluatable->False] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)