The method of constructing of kinematical and dynamical equations of mechanical systems, applied to numerical realization, is proposed in this paper. The corresponding difference equations, which are obtained, give a guarantee of computations with given precision. The equations of programmed constraints and those of constraint perturbations are defined. The stability of the programmed manifold for numerical solutions of the kinematical and dynamical equations is obtained by means of corresponding construction of the constraint perturbation equations. The dynamical equations of system with programmed constraints are set up in the form of Lagrange equations in generalized coordinates. Certain inverse problems of rigid body dynamics are considered.