Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import matplotlib.pyplot as plt import numpy as np population = 763 Scur = population -1 # number of people susceptible Icur = 1 # number

image text in transcribed

image text in transcribed

import matplotlib.pyplot as plt import numpy as np population = 763 Scur = population -1 # number of people susceptible Icur = 1 # number of people infected Rcur = 0 # number of people recovered trans_const = 0.00218 # infectiousness of disease r = kb/N recov_rate = 0.5 # recovery rate a = 1/(# days infected) simlength = 20 # number of days in simulation SIRrray = np.zeros((simlength+1,3)) # using floats as -% of popn SIRrray[0,:] = Scur, Icur, Rcur # record initial values for i in range(1, simlength+1): new_infected = trans_const * Scur * Icur # = rSI new_recovered = recov_rate * Icur # = al Scur = Scur - new_infected Icur = Icur + new_infected - new_recovered Rcur = Rcur + new recovered SIRrray[i,:] Scur, Icur, Rour print("SIR Model simulation") print("Scur\t\tIcur\t\tRcur") print("- for i in range(len(SIRrray)): print("{0:.2f}\t\t{1:.2f}\t\t {2:.2f}".format(SIRrray[i,0], SIRrray[i,1], SIRrray[i,2])) plt.plot(SIRrray[:,0], "b") plt.plot(SIRrray[:,1], "r") plt.plot(SIRrray[:,2], "g" ) plt.show() INSERT Modify the Python script to: 1. Have labels on the x and y axes, and a plot title that include the values for r and a (the key parameters of the SIR model). 2. Save the plot to a filename that includes the values for r and a. 3. Accept command line arguments for r and a

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions

Question

5. Arranging for the training facility and room.

Answered: 1 week ago

Question

1. Discuss the five types of learner outcomes.

Answered: 1 week ago