functions to perform smoothed differentiation (gradients) on noisy data