stability objective functions and gradients