analytical gradient

still not working