#Maple code for Lecture 1 of Dynamical Models in Biology (Rutgers university) , Math 336, taught by Dr. Z. #ITALY, 12th CENTURY FIBONACCI #A FEMALE RABBIT IS FERTILE IF SHE IS EITHER 1-year old or 2-year-old # #R(n): The number of female rabbits born at year n # #INITIAL CODITIONS. R(0)=1, R(1)=1 # #R(n)=R(n-1)+R(n-2) SECOND-ORDER RECURRENCE (aka DIFFERENCE) EQUATION #R(0)=1, R(1)=1; R(2)=2; R(3)=3; R(4)=5; R(5)=8; R(6)=13; R(7)=21; R(8)=34; R:=proc(n) option remember: if n=0 or n=1 then 1: #INITIAL CONDITIONS else R(n-1)+R(n-2): #REcurrence fi: end: #A MORE REALISTIC MODEL # #ASSUMPTIONS: (i) ONLY 1-year old and two-year old females can have children # #The prob. that a 1-year-old female has children is p1 # #The prob. that a 2-year-old female has children is p2 # #Rg(0)=c0; Rg(1)=c1; INITIAL CONDITIONS; #Rg(n,p1,p2,c0,c1): THE EXPECTED NUMEBR OF FEMALES born at time n # Rg:=proc(n,p1,p2,c0,c1) option remember: if n=0 then c0: elif n=1 then c1: else expand(p1*Rg(n-1,p1,p2,c0,c1)+p2*Rg(n-2,p1,p2,c0,c1)): #Recurrence fi: end: