Simulation of Nonholonomic Mechanical Systems Using Algorithmic Differentiation