preliminary functions neccessary for implementing steepest descent