The purpose of this lab is to utilize the computing power of the R environment to find future-state vectors of linear dynamical systems (Markov Processes). You will need to use the matrix_pow function from class to do this lab.
Exercises 1-7 are based on exercise 9.1 on page 174 in Boyd and Vandenberghe. You will need to refer to this exercise to do these problems.
Suppose that each “compartment” is an organ in the human body, vector xt represents the amount (in milligrams) of a certain medication in each organ at time t (in hours), and the “body” represents all 3 organs. Suppose that 10 milligrams of the medication is injected directly into Organ 1 at t = 0. This would imply that the initial vector x0 is < , , >.
Find matrix A. Check that your A matrix and initial vector x0 are correct by verifying that x3 = <7.2925, 2.5675, 0.1375>. Then find x100.
What build-in R function can you use on xt to return the total amount of the medication in the body at time t? Use this function to find the total amount of medication in the body at t = 2. Explain (in a sentence) why this answer makes sense.
Find the “half-life” of this medication by finding the (approximate) value of t at which time half of the initial dose remains in the body. (Hint: this will take some trial-and-error.)
Approximately how many hours does it take for there to be 3 milligrams of the medication left in Organ 1?
According to this model, will there ever be exactly 0 milligrams of medication left in the body? Why is this, intuitively? Is this aspect of the model match realistic?
Suppose that at t = 50 another 5 milligrams is injected into Organ 1. How much medication is left in the body at t = 100? (Hint: think about how this changes x_50 and how many more hours it will take to get to 100.)