Obtain the GitHub repository you will use to complete the homework
assignment, which contains the starter Jupyter notebook file
homework2.ipynb
. The notebook template provides space for you to
answer each question. Your notebook should run without error when you
select Restart Kernel and Run All
Cells:
When you’re done, save your file, then stage, commit, and push (upload) it to GitHub, and then follow the instructions in the How to submit section.
-
Develop a model for Newton’s Law of Heating and Cooling. This model states that the rate of change of the temperature with respect to the time of an object is proportional to the difference between the temperatures of an object and its surroundings. In your model, use the variable name
object_temperature
for the object temperature andexternal_temperature
for the temperature of the surroundings. For the proportionality constant, usealpha
. Place any functions you write in a file namednewton.py
.-
Write the model inside a function named
newton_heating_cooling
that takes the following inputs:- Initial object temperature
- Temperature of surroundings
- Proportionality constant
The function, upon completion, should return a pandas DataFrame of the object temperature as a function of time (“clock time”, not just the time steps).
-
Suppose the object is cold water at that is placed in a room of temperature . After 1 hour, the temperature of the water is . Modify your simulation to allow you to calculate the constant of proportionality.
-
Using the constant of proportionality you found in part ii, run your simulation to figure out how much of the water’s temperature changes after 15 minutes.
-
How long will it take to warm the water to room temperature? Create a plot showing the temperature as a function of time as it warms to room temperature.
-
-
It has been estimated that for the Antarctic fin whale, per year, whales, and whales in 1976. Model this population by starting with the constrained growth model we derived in class and save your functions in a file named
whales.py
. Then, inside the Jupyter notebook, visualize the whale population as a function of time (in units of years) using a line plot. Then, revise the model to consider harvesting the whales as a percentage of . Give various values for this percentage that lead to extinction and other values that lead to increases in population. Estimate the maximum sustainable yield, or the percentage of that gives a constant population in the long term. -
Develop a two-compartment model for one dose of aspirin, where the rate of change of absorption from the stomach to the plasma is proportional to the volume of the stomach and to the difference of the aspirin concentrations in the stomach and plasma. Check the effect of three stomach sizes, 400 milliliters, 500 milliliters, and 600 milliliters. Plot the original one compartment model and the results for the three stomach sizes on the same graph for comparison.
-
In an attempt to quickly raise the drug concentration in a person’s body, sometimes doctors give a patient a loading dose, which is an initial dosage that is much higher than the maintenance dosage. A loading dose for Dilantin is three doses — 400 milligrams, 300 milligrams, and 300 milligrams two hours apart. Twenty-four hours after the loading dose, normal dosage of 100 milligrams every eight hours begins. Develop a model for this dosage regime. Plot the results of the original model and your modified model on the same graph and then discuss the following questions:
-
Is there a risk of breaching the toxicity threshold?
-
How much sooner does the concentration reach the therapeutic range compared to the conventional dosing schedule?
-
To lock in your submission time, export your notebook to PDF and upload the PDF file to the assignment posting on Blackboard.
In addition, be sure to save, commit, and push your final result so that everything is synchronized to GitHub. I may want to inspect your source files directly and run your notebook, so it’s very important that the files in your homework repository match what I see in the PDF export uploaded to Blackboard.