Implement numerical differentiation