Minimizing an integral to find optimum Covid testing times

39 Views Asked by At

Let $f(y)=\int_0^1x-\max(\{0,1,y,y+0.5,y-0.5\}\cap[0,x])dx$. What is the value of $y$ that minimizes $f(y)$ on the interval $[0,1]$?

Believe it or not, I'm trying to find this $y$ value in order to optimize synchronization of Covid testing for me and my Dad. I am required by my University to get tested for Covid once every fifteen days. My Dad is required by his employer to get tested for Covid once every thirty days. I’m trying to find out when I should be tested relative to his Covid tests, to maximize the number of days when someone in my family has been tested as recently as possible. So I’m modeling his testing dates as the set of all integers, and then I’m modeling my testing dates as $\{y+n/2: n \in \mathbb{Z}\}$ for some $y$. And I’m minimizing the integral of the time since the last testing date over the course of one month.

In any case, I'm not sure if it's practical to evaluate this integral in closed form, so if not differentiating under the integral sign may be required.