Extra Credit 1

Due: October 15, 2025
Points: 25

In the given examples, what you type is in red and the program prints what is in black. Your program output should look exactly like the output in the examples, except that what you type won’t be in red, and the results may differ in the last few digits.

  1. (10 points) For the SI model for which the equation is given in homework 1, print the proportion of the population infected for each day, up to and including the number of days entered as input. Remember to check your input as in the homework problem.

    To turn in: Please turn in the program in the file siloop.py.

    Example:

    
    Number of days: 10
    1 	 0.0012211323960795992
    2 	 0.00149109134209279
    3 	 0.0018206220327889482
    4 	 0.0022228167755574827
    5 	 0.0027136190661283567
    6 	 0.0033124316939081035
    7 	 0.00404284825698398
    8 	 0.004933530020258307
    9 	 0.006019252361985584
    10 	 0.007342146711703001
    
  2. (15 points) Change the focus of your program for the SI model. For this, read in a floating point number greater than 0 but less than 1. Then determine the number of days after which that proportion of the population will be infected.

    To turn in: Please turn in the program in the file siupto.py.

    Examples:

    
    Proportion of population (between 0 and 1, non-inclusive): 0.5
    In 35 days, at least 0.5 of the population will be infected
    The actual proportion will be 0.5232944296657519
    
    
    Proportion of population (between 0 and 1, non-inclusive): 0.25
    In 30 days, at least 0.25 of the population will be infected
    The actual proportion will be 0.287664368675717
    
    
    Proportion of population (between 0 and 1, non-inclusive):  1
    You must enter a decimal fraction between 0 and 1, non-inclusive!
    
    
    Proportion of population (between 0 and 1, non-inclusive):  3/4
    You must enter the proportion as a decimal fraction between 0 and 1 non-inclusive
    

UC Davis sigil
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email: mabishop@ucdavis.edu
MHI 289I, Programming in Health Informatics
Version of October 1, 2025 at 2:55PM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh