Blood caffeine concentration

Looking through an old server from a hosting provider I’m migrating away from, I found an old algorithm I used to estimate blood caffeine concentration.

Just a word of warning, I’ve lost the link to the paper I drew this information from. If someone wants to find where my assumptions came from I’ll buy you a coffee. Update: I’ve found the reference in an old notebook! Consumption and Metabolism of Caffeine — Biology Online.

Times here are specified to be in seconds from any arbitrary epoch. Since only time differences really factor into the equations it doesn’t matter what your epoch is.

Let LL be a constant value allowing us to approximate a person’s blood volume based on their body mass. I found L=0.007LkgL = 0.007 \mathrm{\frac{L}{kg}}.

Let MM be your mass and tt be the current time. Let λ\lambda represent the half-life of caffeine in the body and let α\alpha represent an absorption coefficient. My estimates for these values are λ=5hours\lambda = 5\,\mathrm{hours} and α=1hour\alpha = 1\,\mathrm{hour}.

Let aia _ i and tit _ i be series representing doses of caffeine. aia _ i represents the amount of the dose while tit _ i represents the time of the dose.

The amount of caffeine in your bloodstream can be approximated by:

i(anexp((ttn)ln2λ)(1exp((ttn)ln0.05α))ML)\sum_i \left( \frac{ a _ n \exp\left({\frac{-(t - t _ n)\ln 2}{\lambda}}\right) \left( 1 - \exp\left(\frac{(t - t _ n)\ln 0.05}{\alpha}\right) \right)} {ML} \right)

Again, I’ve lost the links to my original references. Even though I’ve found the references, that’s not to say that the assumptions I made are any good. I’m not a doctor. Use at your own risk.

Below is the original algorithm. I hope I’ve faithfully translated it back to abstract mathematics. Later I’ll integrate it so that we can evaluate the effects of a slowly-consumed cup of coffee rather than considering consumption as a point event.