(Solved) : Im Coding Python Could Get Help Come 2 Loops Also Subplots Ta Said Right Track Made Mistak Q43953202 . . .
im coding with python. If i could get some help on how to comeup with the 2 for loops and also the subplots. my TA said i was onthe right track but made some mistakes.
N.+1=N, Now, we wish to explore the dynamics of this model and how population counts are predicted to change under different conditions (L. growth rater and population count No att = 0). We can do this by Iterating the equation. We pick initial conditions (say r = 1.2 and No = 100) and then calculate the population count at the next time step, t = 1 (i.e. Ni = No = 1.2 * 120). To get future counts, we simply repeat (or iterate): N2 = FN, = 1.2.120), and so on. In the code cell below, use a for loop to perform this iteration for the following conditions: • values of t from t = 0 to Imax = 20 . No = 100 • two different values of r (r = 0.9 and r = 1.1) Plot the results in two subplots, i.e. plot N, versust for each value of r in a different subplot. Try to use the plot command only once. HINT: to do this, you will have to have two for loops, one inside the other. [2] ##### 01: YOUR CODE HERE *********** import numpy as np import matplotlib.pyplot as plt r=[0.9,1.1] tanp.arange(21) N np.zeros(21) N[0]=100 define Ni set of zeros that have the length of t. can also use (lent)) #set NO to be 100 for c in r for i in range(1,21): N[i]-c*N[1-1] Show transcribed image text N.+1=N, Now, we wish to explore the dynamics of this model and how population counts are predicted to change under different conditions (L. growth rater and population count No att = 0). We can do this by Iterating the equation. We pick initial conditions (say r = 1.2 and No = 100) and then calculate the population count at the next time step, t = 1 (i.e. Ni = No = 1.2 * 120). To get future counts, we simply repeat (or iterate): N2 = FN, = 1.2.120), and so on. In the code cell below, use a for loop to perform this iteration for the following conditions: • values of t from t = 0 to Imax = 20 . No = 100 • two different values of r (r = 0.9 and r = 1.1) Plot the results in two subplots, i.e. plot N, versust for each value of r in a different subplot. Try to use the plot command only once. HINT: to do this, you will have to have two for loops, one inside the other. [2] ##### 01: YOUR CODE HERE *********** import numpy as np import matplotlib.pyplot as plt r=[0.9,1.1] tanp.arange(21) N np.zeros(21) N[0]=100 define Ni set of zeros that have the length of t. can also use (lent)) #set NO to be 100 for c in r for i in range(1,21): N[i]-c*N[1-1]
Expert Answer
Answer to im coding with python. If i could get some help on how to come up with the 2 for loops and also the subplots. my TA said…
OR