  A geometric derivation of numerical integrators for nonholonomic systems and
optimal control problems is obtained. It is based in the classical technique of
generating functions adapted to the special features of nonholonomic systems
and optimal control problems.
