first and second derivs calced in firstDeriv.m function