checked gradient of stabilityObj wrt w