What is this?
A small personal experiment: a mathematical guess at how productive I am at a given moment, built from four things I suspect matter: the time of day, how much daylight there is, how much caffeine is active in my body, and how many people are around me. Each factor is a multiplier between 0 and 1, and the prediction is their product, so the score is always between 0 (nothing gets done) and 1 (best case).
The score is not scientifically validated and is not medical advice. Only the caffeine absorption and elimination part rests on established pharmacology; the rest are hypotheses with knobs, meant to be tuned against my own logged productivity later.
The model
Every curve on the chart is computed on the fly from these functions (every two minutes across the day, plus exact points at sunrise, sunset and each caffeine event). Nothing is precomputed.
1. Time of day: a two-hour rhythm
Productivity oscillates, peaking every two hours, with one peak aligned to 22:00 by default. A cosine keeps it smooth and continuous across midnight.
With , , this is : maximum 1 on the even hours, minimum 0.2 on the odd hours.
2. Daylight
The hypothesis is that bright daylight makes me less productive. Daylight is modeled as a smooth arch between sunrise and sunset, zero at night and highest halfway between them:
This is an approximation, not a solar irradiance calculation. Sunrise and sunset can be typed in or calculated for a date and location with SunCalc, which uses standard solar-position astronomy similar to NOAA's solar calculator equations.
3. Caffeine
Caffeine is handled in two steps: how much is active in the body over time (pharmacokinetics), and how that amount maps to productivity (a hypothesis).
How much is active
Caffeine is absorbed quickly and almost completely from the gut and eliminated with first-order kinetics, so a one-compartment model with first-order absorption and elimination is a common simplification. For a dose taken at , with :
Doses before contribute nothing, every earlier dose adds independently, and doses from previous days carry over midnight because the calculation uses absolute timestamps. A single dose peaks at
This is in line with peak plasma levels commonly reported within roughly 30–120 minutes of drinking caffeine. The half-life varies a lot between people (smoking shortens it; oral contraceptives lengthen it), which is why it is adjustable. When and are nearly equal the formula above becomes numerically unstable, so the simulator switches to its exact limit, .
is an estimated amount in the body in mg, not a measured blood concentration in mg/L.
How it maps to productivity (hypothesis)
With no caffeine the multiplier is 0.6; it rises to 1 at the hypothetical optimum mg of active caffeine, then slowly declines toward 0.9.
The 400 mg optimum is my modeling assumption, not an established optimal level and not a recommendation. The FDA's commonly cited 400 mg figure is about total daily intake for most adults, not an amount to have active in your body. Don't use this page to decide how much caffeine to consume.
4. People nearby
I'm most productive alone. One other person causes the biggest single drop (sudden self-consciousness). Each extra person adds less, up to a maximum around 20 people. Beyond that, a crowd makes me feel less individually watched, so productivity recovers a little, but never back to being alone.
is the social-awareness penalty (0 alone, 1 at its peak); is the productivity multiplier. The curve is continuous at , with a corner there. With the defaults (, so the denominator is ):
| People | R(n) |
|---|---|
| 0 | 1.000 |
| 1 | 0.849 |
| 5 | 0.744 |
| 20 | 0.650 |
| 100 | 0.729 |
What's established and what's a guess
- Established (simplified): caffeine absorption and elimination as a one-compartment, first-order process. Real people vary, and the model ignores body weight, volume of distribution and metabolites.
- Hypotheses: the two-hour rhythm, the daylight penalty, the caffeine-to-productivity response and the social-awareness curve. These are my assumptions, chosen to be tested against self-recorded productivity, not findings from the literature.
All parameters and defaults
| Symbol | Meaning | Default |
|---|---|---|
| Local time of day, decimal hours (0–24) | — | |
| People nearby | 0 | |
| Rhythm period | 2 h | |
| Rhythm phase (time of a peak) | 22:00 | |
| Minimum rhythm multiplier | 0.2 | |
| Sunrise, sunset | 07:00, 19:00 | |
| Daylight curve exponent | 1 | |
| Sunlight sensitivity | 2 | |
| Dose (mg) and time of caffeine event i | — | |
| Bioavailability | 1 | |
| Absorption rate constant | 4 h⁻¹ | |
| Elimination half-life | 5 h | |
| Elimination rate constant, ln 2 / h | ≈ 0.139 h⁻¹ | |
| Hypothetical caffeine-response optimum | 400 mg | |
| Below- and above-optimum response strengths | 0.4, 0.1 | |
| Above-optimum decline width | 200 mg | |
| Maximum social productivity penalty | 0.35 | |
| Crowd size at maximum self-consciousness | 20 | |
| Initial sensitivity to the first few people | 8 | |
| Crowd recovery strength | 0.25 | |
| Crowd recovery decay (people) | 35 |
References
- U.S. Food and Drug Administration. Spilling the Beans: How Much Caffeine Is Too Much? (400 mg/day cited for most adults, as total daily intake.)
- Institute of Medicine (2001). Pharmacology of Caffeine. In Caffeine for the Sustainment of Mental Task Performance: Formulations for Military Operations. National Academies Press.
- Grzegorzewski J, Bartsch F, Köller A, König M (2022). Pharmacokinetics of Caffeine: A Systematic Analysis of Reported Data for Application in Metabolic Phenotyping and Liver Function Testing. Frontiers in Pharmacology 12.
- NOAA Global Monitoring Laboratory. General Solar Position Calculations.
- Agafonkin V. SunCalc, a JavaScript library for sun position and sunlight phases.