function for the first derivative
function of the second derivative