Open with one click!
In [ ]:
# Name: Alejandro Gutierrez # I worked on this code with: Alette Eide, Molly, Sandra Foxx # Please do all of your work for this week's lab in this worksheet. If # you wish to create other worksheets for scratch work, you can, but # this is the one that will be graded. You do not need to do anything # to turn in your lab. It will be collected by your TA at the beginning # of (or right before) next week’s lab. # Be sure to clearly label which question you are answering as you go and to # use enough comments that you and the grader can understand your code.
In [ ]:
#1 #The life cycle of mangroves begins when mangroves become potential zygotes in the form of female gametophytes. Propagules, is the stage where the seed must find a favorable place and develope. The cycle is complete when the seeds reproduce gamates of their own or by forming independent clones. Stage 0 is when young trees, trees, and older trees make propgules. Stage one is when a number of propagulus become cotyledonary seedlings. Stage 2 is when a number of Cotyledonary seedlings become seelings. Stage 3 is when some seedlings become saplings. Stage 3 is when some become young trees. Stage 5 is when some young trees become old trees.
In [23]:
#2 MangroveMatrix= zero_matrix(RDF,7,7) MangroveMatrix[0,5]= 500 MangroveMatrix[0,6]= 1000 MangroveMatrix[1,0]= 0.2 MangroveMatrix[1,1]= 0.666 MangroveMatrix[2,1] = 0.083 MangroveMatrix[2,2] = 0.825 MangroveMatrix[3,2] = 0.010 MangroveMatrix[3,3] = 0.909 MangroveMatrix[4,3] = 0.073 MangroveMatrix[4,4] = 0.963 MangroveMatrix[5,4] = 0.008 MangroveMatrix[5,5] = 0.980 MangroveMatrix[6,5] = 0.012 MangroveMatrix[6,6] = 0.999 show(MangroveMatrix)
(0.00.00.00.00.0500.01000.00.20.6660.00.00.00.00.00.00.0830.8250.00.00.00.00.00.00.010.9090.00.00.00.00.00.00.0730.9630.00.00.00.00.00.00.0080.980.00.00.00.00.00.00.0120.999)\left(\begin{array}{rrrrrrr} 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 500.0 & 1000.0 \\ 0.2 & 0.666 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\ 0.0 & 0.083 & 0.825 & 0.0 & 0.0 & 0.0 & 0.0 \\ 0.0 & 0.0 & 0.01 & 0.909 & 0.0 & 0.0 & 0.0 \\ 0.0 & 0.0 & 0.0 & 0.073 & 0.963 & 0.0 & 0.0 \\ 0.0 & 0.0 & 0.0 & 0.0 & 0.008 & 0.98 & 0.0 \\ 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.012 & 0.999 \end{array}\right)
In [10]:
#3a ics=vector([1,2,3,4,5,6,7]) prop_list=[1] young_list=[5] old_list=[7] for i in srange(0,10,1): ics= MangroveMatrix*ics prop_list.append(ics[0]) young_list.append(ics[4]) old_list.append(ics[6])
In [11]:
#3b list_plot(prop_list, color="lime",legend_label="Propagules Population",legend_color="black",plotjoined=True,title="Propagules")
In [13]:
#3c list_plot(young_list, color="dodgerblue",legend_label="Young Population",legend_color="black",plotjoined=True,title="Young Trees")
In [14]:
#3d list_plot(old_list, color="dodgerblue",legend_label="Old Population",legend_color="black",plotjoined=True,title="Old Trees")
In [18]:
#4 show(max(MangroveMatrix.eigenvectors_right())) #The mangrove population will grow because the dominant eigenvalue is greater than 1.
(1.048140178442451,[(0.8729866710666837,0.4568934230495471,0.16994767315242945,0.012214133620844852,0.010472514512338323,0.0012295259274889008,0.00030024944144526564)],1)\left(1.048140178442451, \left[\left(-0.8729866710666837,\,-0.4568934230495471,\,-0.16994767315242945,\,-0.012214133620844852,\,-0.010472514512338323,\,-0.0012295259274889008,\,-0.00030024944144526564\right)\right], 1\right)
In [16]:
#5 DomEig=vector([-0.8729866710666837,-0.4568934230495471,-0.16994767315242945,-0.012214133620844852,-0.010472514512338323,-0.0012295259274889008,-0.00030024944144526564]) kek=DomEig*(1000/-0.0003002494414452655) show(kek)
(2.90753803525668×106,1.52171281601813×106,566021.613010762,40679.9545139918,34879.3804975235,4095.01487020431,1000.00000000000)\left(2.90753803525668 \times 10^{6},\,1.52171281601813 \times 10^{6},\,566021.613010762,\,40679.9545139918,\,34879.3804975235,\,4095.01487020431,\,1000.00000000000\right)
In [44]:
#6 #In order to promote mangrove generation after a type of disturbance, the parameter we should focus changing the survival rate and the recruitment rate of yoing trees in order to display the eigenvalue change.The only way to make the parameters comparable regardless if the parameter values are not the same, is to go with a type b disturbance such as some extinction of all trees in order to increase the fercunity and bring forth reproduction. TypeA= matrix(RDF,[[0,0,0,0,0,500,1000],[0.200,0.666,0,0,0,0,0],[0,0.083,0.825,0,0,0,0],[0,0,0.010,0.909,0,0,0],[0,0,0,0.073,0.963,0,0],[0,0,0,0,0.008,0.980,0],[0,0,0,0,0,0.012,0.999]]) domeig= 1.048140178442451 NewA= TypeA NewA[0,5] = TypeA[0,5]*1.005 changeval = max(NewA.eigenvalues())- domeig listchangeval = [] listdomval = [] listy=[(0,5),(0,6),(1,0),(1,1),(2,1),(2,2),(3,2),(3,3),(4,3),(4,4),(5,4),(5,5),(6,5),(6,6)] for i in listy: NewA = matrix(RDF,[[0,0,0,0,0,500,1000],[0.200,0.666,0,0,0,0,0],[0,0.083,0.825,0,0,0,0],[0,0,0.010,0.909,0,0,0],[0,0,0,0.073,0.963,0,0],[0,0,0,0,0.008,0.980,0],[0,0,0,0,0,0.012,0.999]]) NewA[i] = NewA[i] * 1.005 v = max(NewA.eigenvalues()) listdomval.append(v) listchangeval.append(v - domeig) show(table(list(zip(listy,listdomval,listchangeval))))
(0,5)\left(0, 5\right) 1.04820962341477571.0482096234147757 6.944497232463931×10056.944497232463931 \times 10^{-05}
(0,6)\left(0, 6\right) 1.04817408475182331.0481740847518233 3.390630937216699×10053.390630937216699 \times 10^{-05}
(1,0)\left(1, 0\right) 1.0482434318392861.048243431839286 0.00010325339683481260.0001032533968348126
(1,1)\left(1, 1\right) 1.04832138016127051.0483213801612705 0.00018120171881941260.0001812017188194126
(2,1)\left(2, 1\right) 1.04824343183928841.0482434318392884 0.00010325339683725510.0001032533968372551
(2,2)\left(2, 2\right) 1.04852653412580831.0485265341258083 0.000386355683357209050.00038635568335720905
(3,2)\left(3, 2\right) 1.04824343183928681.0482434318392868 0.000103253396835700780.00010325339683570078
(3,3)\left(3, 3\right) 1.04882698756548481.0488269875654848 0.00068680912303364930.0006868091230336493
(4,3)\left(4, 3\right) 1.04824343183928751.0482434318392875 0.000103253396836366920.00010325339683636692
(4,4)\left(4, 4\right) 1.04933699741110581.0493369974111058 0.00119681896865464490.0011968189686546449
(5,4)\left(5, 4\right) 1.04824343183928681.0482434318392868 0.000103253396835700780.00010325339683570078
(5,5)\left(5, 5\right) 1.04966459509852021.0496645950985202 0.00152441665606906080.0015244166560690608
(6,5)\left(6, 5\right) 1.0481740847518231.048174084751823 3.390630937194494×10053.390630937194494 \times 10^{-05}
(6,6)\left(6, 6\right) 1.0488785834878921.048878583487892 0.00073840504544087080.0007384050454408708
In [53]:
#7 #Question: What would be the proportion of old trees to compared to the rest of the stages for type b? Typeb= matrix(RDF,[[0,0,0,0,100,500,1000],[0.400,0.666,0,0,0,0,0],[0,0.230,0.825,0,0,0,0],[0,0,0.045,0.909,0,0,0],[0,0,0,0.045,0.963,0,0],[0,0,0,0,0.008,0.980,0],[0,0,0,0,0,0.012,0.999]]) show("Max Eigenvectors:",max(Typeb.eigenvectors_right())) ratio= DomEig/(-0.00030024944144526564) show("Ratio of older trees:", ratio)
MaxxEigenvectors:(1.2226157176665158,[(0.7685740349651337,0.5523193187480965,0.3194879821592132,0.04584259776307626,0.007946040085247514,0.00026201237616994523,1.406049872902132×1005)],1)\verb|Max|\phantom{\verb!x!}\verb|Eigenvectors:| \left(1.2226157176665158, \left[\left(-0.7685740349651337,\,-0.5523193187480965,\,-0.3194879821592132,\,-0.04584259776307626,\,-0.007946040085247514,\,-0.00026201237616994523,\,-1.406049872902132 \times 10^{-05}\right)\right], 1\right)
Ratioxofxolderxtrees:(2907.53803525668,1521.71281601813,566.021613010762,40.6799545139918,34.8793804975235,4.09501487020431,1.00000000000000)\verb|Ratio|\phantom{\verb!x!}\verb|of|\phantom{\verb!x!}\verb|older|\phantom{\verb!x!}\verb|trees:| \left(2907.53803525668,\,1521.71281601813,\,566.021613010762,\,40.6799545139918,\,34.8793804975235,\,4.09501487020431,\,1.00000000000000\right)
In [ ]:
#8 #The result of the lab does not describe the system's long-term behavior due to not being able to have negative individuals because you cannot have a negative value of a organism. The original matrix does not account for any perturbations in the long-term stages.