Traveling for work are pleasure can be disruptive to our natural circadian cycle – our body’s ability to wake and sleep in accordance with the sun’s daily cycle. Restoring that cycle often takes days or weeks. For some, the disruption can last for months.

Enters Entrain, an app developed by researchers at the University of Michigan. Entrain calculates the optimal sleep and lighting cycles to help you regain rest in your new timezone. Warning: this may require a bit of sleep juggling, but it’s pretty effective.

The schedules are computed using techniques from the theory of optimal control. The big idea is that, given equations describing the human circadian clock, we can ask what light stimulus moves that clock from one “phase” to another in the least amount of time. A detailed explanation of the math involved can be found in the paper presenting the schedules, available here.