# Modeling Caffeine Metabolism - time offset

What’s the next level of complexity to add to our model? As noted previously, our model is not able to generate an arbitrary caffeine schedule. Let’s add functionality to enable it to do so!

What do we need in order to do this? What we would like to do is to be able to simulate a single day as a combination of caffeine inputs at arbitrary times during the day. We would then like to repeat the day periodically. To accomplish this, we need the ability to add a time offset to a dose delivered every 24 hours. This enables...

# Modeling Caffeine Metabolism - mathematical note

I wanted to make a quick mathematical note on the long term behavior of our caffeine metabolism function. In the previous post, we came up with the expressions

$f(t)=d\cdot e^{-t/\tau}$ as the exponential decay for a single dose of $d~$ milligrams at time $t$.

$\displaystyle f(t) = d e^{-t/\tau} \left(\frac{1-e^{a(n+1)/\tau}}{1-e^{a/\tau}}\right)$ for the behavior at time $t~$ for a dose of $d~$ mg delivered every $a~$ hours, where $n=\lfloor t/a \rfloor$.

In this post, we’ll look at the long term behavior using two similar approaches. The quantity we are most interested in...

# Modeling Caffeine Metabolism

Caffeine is a stimulant drug that is widely consumed in tea, coffee, soda, and chocolate, among other beverages and foods. In this post, we construct a toy model for caffeine metabolism.

The mechanism of action of caffeine is complex, as is the process of developing tolerance. These are important factors to consider when thinking about the ultimate effect of the drug on alertness and we will discuss them briefly at the end.

So–let’s build our model. We need to consider caffeine input (consumption) and caffeine output (metabolism).

For our caffeine input, let’s consider a semi-realistic model of consuming Read More

# this is a test of math and code

int main( ) {
printf("hello, world");
return 0;
}