Differentiable Programming for Problems in Statistical Mechanics and Biophysics