Assignment 4 – Loops and More Discrete Time Systems

Assignment 4 – Loops and More Discrete Time Systems
Due Date: September 20, 2011
1. Include your script Lab3Loops.R (just copy and paste). How much medication is in the body
after 47 time steps with a dose of 500mg?
2. Write a script to compute the following sum. Hint: this script will use the index values inside the
for loop.
Include your script in your report (just copy and paste). What is the sum when m = 5? m = 14?
m = 250?
BONUS: What does this series coverge to? In other words, if we let m get really, really big what
does this add to? Hint: I don’t just want the value R gives you if you make m big. The answer
involves a very famous irrational number.
3. Write a script to simulate the following discrete time dynamical system for the lung model you
discussed during lecture (section 1.9).
Suppose the equilibrium value of this system is 10mmol/L. If
, meaning that air is being
exchanged, what should be to get this equilibrium value? Using this value of , simulate the
system using your script for different values of q. How do different values of q change the
system? Be specific.