Mathematicians are a step closer to understanding what makes a perfect cup of coffee.