added derivative and partial derivative functions for autodiff