Mathematics of a heart beat