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


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)

$\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.

$\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)

$\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))))

 $\left(0, 5\right)$ $1.0482096234147757$ $6.944497232463931 \times 10^{-05}$ $\left(0, 6\right)$ $1.0481740847518233$ $3.390630937216699 \times 10^{-05}$ $\left(1, 0\right)$ $1.048243431839286$ $0.0001032533968348126$ $\left(1, 1\right)$ $1.0483213801612705$ $0.0001812017188194126$ $\left(2, 1\right)$ $1.0482434318392884$ $0.0001032533968372551$ $\left(2, 2\right)$ $1.0485265341258083$ $0.00038635568335720905$ $\left(3, 2\right)$ $1.0482434318392868$ $0.00010325339683570078$ $\left(3, 3\right)$ $1.0488269875654848$ $0.0006868091230336493$ $\left(4, 3\right)$ $1.0482434318392875$ $0.00010325339683636692$ $\left(4, 4\right)$ $1.0493369974111058$ $0.0011968189686546449$ $\left(5, 4\right)$ $1.0482434318392868$ $0.00010325339683570078$ $\left(5, 5\right)$ $1.0496645950985202$ $0.0015244166560690608$ $\left(6, 5\right)$ $1.048174084751823$ $3.390630937194494 \times 10^{-05}$ $\left(6, 6\right)$ $1.048878583487892$ $0.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)


$\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)$
$\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.