DATA 420 - Modeling and Simulation - Spring 2026

Homework #1 — Systems Dynamics Models I

Possible experience: +40XP

Due: Wednesday, Feb. 11, midnight

Drugs

Use the drug simulation code we developed in class (drugs.py) to complete the following items. (See the instructions for how to clone and use the class git repo.)

  1. A new medication has been developed to treat patients with a particular kind of liver deficiency. The MEC for this medication is 250 μg/ml and the MTC is 500 μg/ml. Its half-life is estimated to be about 15.5 hours. Develop a dosage schedule for adults (assumed to have between 2.7 and 3.3 liters of plasma each) and another one for children (assumed to have between 1.25 and 1.75 liters). Each dosage schedule should be in the form of "take X milligrams every Y hours," and should be accompanied by plot(s) demonstrating that such a schedule, when followed properly, will maintain proper levels of the drug in the patient's blood 24/7, for any patient within the above plasma assumptions.
  2. Up to now, we've modeled only the elimination of the drug from the patient's system as a time-varying quantity: the absorption into the bloodstream has been instantaneous. Remedy this inaccuracy by extending the model to a two-compartment model. This somewhat amusing term means that you'll represent the human body as having two "compartments" into which the drug travels: first, the digestive tract (which in reality has many component parts, but which in your model will be just one big box), and then, the bloodstream (plasma). It takes time for the drug to get distributed from the first box to the second, but only the concentration of the second box has any therapeutic effect.
    Your revised simulation should correspond to the model below:

    After writing and debugging your simulation, analyze its behavior with respect to how the absorption constant and the elimination constant interact. Experiment with values where the absorption constant is higher, and where the elimination constant is higher, and where they are roughly equal. Produce plots demonstrating this behavior, and a brief analysis describing it.

Turning it in

For this assignment, send me an email with subject line "DATA/CPSC 420 Homework #1 turnin." It should have a single PDF file as an attachment, in PDF format, with a filename ending in .pdf. This PDF file should have the following contents:

  1. The parameter values you chose for (a) the adult dosing schedule for the one-compartment model, and (b) the child dosing schedule for the one-compartment model.
  2. A plot showing the plasma concentration when using the one-compartment model and the adult dosing schedule over a time period of 4 days. There should be horizontal blue and red lines showing the MEC and MTC, respectively.
  3. A plot showing the plasma concentration when using the one-compartment model and the child dosing schedule over a time period of 4 days. There should be horizontal blue and red lines showing the MEC and MTC, respectively.
  4. The parameter values you chose for the adult dosing schedule for the two-compartment model.
  5. A plot showing the two-compartment model's concentration when using the adult dosing schedule over a time period of 4 days, plus MEC and MTC lines.
  6. A brief analysis describing your two-compartment model and its behavior.
  7. Your Python code for the two-compartment model. (Just slap it in the PDF file as plain text.)

Getting help

Come to office hours, or send me email with subject line "DATA/CPSC 420 Homework #1 help!!"