Consistent definition of partial derivatives of matrix functions in dynamics of mechanical systems