compute_derivative function

Penalty Derivative Computation