transitionDerivative and costFunctionGradient functions added, some functions corrected