For Checkpoint C you will extend Checkpoint B to do the following: 1. Track and then output a summary report that features o the average kelp population across the simulated timescale, o the average urchin population across the simulated timescale, o the minimum kelp population observed during the simulation, o the maximum urchin population observed during the simulation. Hint: your program will employ the min-finding and max-finding patterns we learned in class with for-loops. Sample Output Sample input/output behavior for the checkpoint are provided below. Your program's spacing, spelling, capitalization, and punctuation will need to match the sample output EXACTLY for this project. Ex 1 Sample Input/Output Given inputs xx, 8, 7, 8, ko, uo, n as: 1.5 .001 .05 100 2 10 The program outputs =>Bull Kelp and Purple Urchin Population Simulator <== Model Parameters --- Kelp growth rate: Kelp death rate: Urchin birth rate: Urchin death rate: ---Initial Population --- Kelp population (in thousands) at t = 0: Urchin population (in thousands) at t = 0: --- Simulation --- Timescale: Time t= 0: 100.000k kelp, 2.000k urchins Time 1: 249.800k kelp, 7.000k urchins Time = 2: 622.751k kelp, 76.930k urchins Time = 3: 1508.970k kelp, 2280.018k urchins Time 4: 331.946k kelp, 168603.957k urchins Time = 5: Time = 6: Time = 7: 0.000k kelp, 2545463.659k urchins 0.000k kelp, 0.000k kelp, 0.000k urchins 0.000k urchins Time 8: 0.000k kelp, 0.000k urchins Time = 9: 0.000k kelp, 0.000k urchins Time 10: 0.000k kelp, 0.000k urchins

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

How to solve this question using pyhton's code 

For Checkpoint C you will extend Checkpoint B to do the following:
1. Track and then output a summary report that features
0 the average kelp population across the simulated timescale,
o the average urchin population across the simulated timescale,
o the minimum kelp population observed during the simulation,
o the maximum urchin population observed during the simulation.
Hint: your program will employ the min-finding and max-finding patterns we learned in class with for-loops.
Sample Output
Sample input/output behavior for the checkpoint are provided below. Your program's spacing, spelling, capitalization, and punctuation will
need to match the sample output EXACTLY for this project.
Ex 1 Sample Input/Output
Given inputs xx, 6, 7, 8, ko, uo, n as:
1.5
-001
.05
2.5
100
2
10
The program outputs
==> Bull Kelp and Purple Urchin Population Simulator <==
---Model Parameters
Kelp growth rate:
Kelp death rate:
Urchin birth rate:
Urchin death rate:
Initial Population
Kelp population (in thousands) at t = 0:
Urchin population (in thousands) at t = 0:
--- Simulation ---
Timescale:
Time t = 0: 100.000k kelp, 2.000k urchins
Time t = 1: 249.800k kelp, 7.000k urchins
Time t = 2: 622.751k kelp, 76.930k urchins
Time t = 3:
Time t = 4:
Time t = 5:
Time t = 6:
Time t = 7:
1508.970k kelp, 2280.018k urchins
331.946k kelp, 168603.957k urchins
0.000k kelp, 2545463.659k urchins
0.000k kelp, 0.000k urchins
0.000k kelp, 0.000k urchins
Time t = 8: 0.000k kelp, 0.000k urchins
Time t = 9: 0.000k kelp, 0.000k urchins
Time t = 10: 0.000k kelp, 0.000k urchins
--- Simulation Statistics ---
Average kelp population: 255.770k
Average urchin population: 246948.506k
Min kelp population was 0.000k at t=5.000
Max urchin population was 2545463.659k at t=5.000
Transcribed Image Text:For Checkpoint C you will extend Checkpoint B to do the following: 1. Track and then output a summary report that features 0 the average kelp population across the simulated timescale, o the average urchin population across the simulated timescale, o the minimum kelp population observed during the simulation, o the maximum urchin population observed during the simulation. Hint: your program will employ the min-finding and max-finding patterns we learned in class with for-loops. Sample Output Sample input/output behavior for the checkpoint are provided below. Your program's spacing, spelling, capitalization, and punctuation will need to match the sample output EXACTLY for this project. Ex 1 Sample Input/Output Given inputs xx, 6, 7, 8, ko, uo, n as: 1.5 -001 .05 2.5 100 2 10 The program outputs ==> Bull Kelp and Purple Urchin Population Simulator <== ---Model Parameters Kelp growth rate: Kelp death rate: Urchin birth rate: Urchin death rate: Initial Population Kelp population (in thousands) at t = 0: Urchin population (in thousands) at t = 0: --- Simulation --- Timescale: Time t = 0: 100.000k kelp, 2.000k urchins Time t = 1: 249.800k kelp, 7.000k urchins Time t = 2: 622.751k kelp, 76.930k urchins Time t = 3: Time t = 4: Time t = 5: Time t = 6: Time t = 7: 1508.970k kelp, 2280.018k urchins 331.946k kelp, 168603.957k urchins 0.000k kelp, 2545463.659k urchins 0.000k kelp, 0.000k urchins 0.000k kelp, 0.000k urchins Time t = 8: 0.000k kelp, 0.000k urchins Time t = 9: 0.000k kelp, 0.000k urchins Time t = 10: 0.000k kelp, 0.000k urchins --- Simulation Statistics --- Average kelp population: 255.770k Average urchin population: 246948.506k Min kelp population was 0.000k at t=5.000 Max urchin population was 2545463.659k at t=5.000
1 print('==> Bull Kelp and Purple Urchin Population Simulator <==\n')
2 print('- Model Parameters ---')
a float(input ("Kelp growth rate: \n"))
if a<0:
print("Error: cannot have a negative growth rate")
exit()
b =float(input("Kelp death rate: \n"))
8 if b<0:
9
10
11 c =float
12 if c<0:
13
14
4
5
6
16
17
18
19 ko
29
30
31
print("Error: cannot have a negative death rate")
exit()
ko = max(0, float(input()))
20 u0= max(0, float(input()))
21
k =k0
33
34
35
22
u =u0
23 print( \n--- Initial Population ---')
24 print (f"Kelp population (in thousands) at t = 0: ")
25 print (f"Urchin population (in thousands) at t = 0: \n")
26
27 print('--- Simulation ---')
m m m
print("Error:
exit()
36
(input("Urchin birth rate: \n"))
print("Error: cannot have a negative birth rate")
exit()
d =float (input ("Urchin death rate: \n"))
if d<0:
37
cannot have a negative death rate")
n = int(input("Timescale: \n"))
if n < 0:
print("Error: cannot have a negative timescale ")
exit()
for t in range (n+1): # 0, 1
print (f"Time t = {t}: {k:.3f}k kelp, {u:.3f}k urchins")
k_next = max(0, k + a*k - b*k*u)
u_next
max (0, u + c*k*u - d*u)
k = k_next
u = u next
Transcribed Image Text:1 print('==> Bull Kelp and Purple Urchin Population Simulator <==\n') 2 print('- Model Parameters ---') a float(input ("Kelp growth rate: \n")) if a<0: print("Error: cannot have a negative growth rate") exit() b =float(input("Kelp death rate: \n")) 8 if b<0: 9 10 11 c =float 12 if c<0: 13 14 4 5 6 16 17 18 19 ko 29 30 31 print("Error: cannot have a negative death rate") exit() ko = max(0, float(input())) 20 u0= max(0, float(input())) 21 k =k0 33 34 35 22 u =u0 23 print( \n--- Initial Population ---') 24 print (f"Kelp population (in thousands) at t = 0: ") 25 print (f"Urchin population (in thousands) at t = 0: \n") 26 27 print('--- Simulation ---') m m m print("Error: exit() 36 (input("Urchin birth rate: \n")) print("Error: cannot have a negative birth rate") exit() d =float (input ("Urchin death rate: \n")) if d<0: 37 cannot have a negative death rate") n = int(input("Timescale: \n")) if n < 0: print("Error: cannot have a negative timescale ") exit() for t in range (n+1): # 0, 1 print (f"Time t = {t}: {k:.3f}k kelp, {u:.3f}k urchins") k_next = max(0, k + a*k - b*k*u) u_next max (0, u + c*k*u - d*u) k = k_next u = u next
Expert Solution
Step 1

Program Approach :

 

  • Take input from the user for the model parameters: kelp growth rate, kelp death rate, urchin birth rate, and urchin death rate.
  • Take input from the user for the initial population of kelp and urchin.
  • Take input from the user for the timescale of the simulation.
  • Initialize variables to store the population of kelp and urchin at each time step.
  • Use a for loop to simulate the population of kelp and urchin over the specified timescale. At each time step, update the population of kelp and urchin using the given differential equations, and store the new values in the respective variables.
  • Calculate the average population of kelp and urchin over the simulated timescale by taking the mean of the population values stored in the respective variables.
  • Find the minimum kelp population and the maximum urchin population observed during the simulation by iterating through the population values stored in the respective variables and keeping track of the minimum and maximum values.
  • Print the simulation results, including the model parameters, initial population, simulated population over time, and simulation statistics (average population, minimum kelp population, and maximum urchin population).
  • End the program.

 

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY