Efficiently computes derivatives of numpy code
