Analytical Gradient and Hessian Matrix ======================================