Analytic solution to selection gradient, plus updates