(self, uind, udep=[], coneqs=[], diffconeqs=None, u_auxiliary=[])
Supply all the generalized speeds in a list.

        If there are motion constraints or auxiliary speeds, they are provided
        here as well (as well as motion constraints).

        Parameters
        ==========

        uind : list
            A list of independent generalized speeds
        udep : list
            Optional list of dependent speeds
        coneqs : list
            Optional List of constraint expressions; these are expressions
            which are equal to zero which define a speed (motion) constraint.
        diffconeqs : list
            Optional, calculated automatically otherwise; list of constraint
            equations; again equal to zero, but define an acceleration
            constraint.
        u_auxiliary : list
            An optional list of auxiliary speeds used for brining
            non-contributing forces into evidence
Supply all the generalized speeds in a list.
Supply all the generalized speeds in a list .
def _speeds(self, uind, udep=[], coneqs=[], diffconeqs=None, u_auxiliary=[]):
        """Supply all the generalized speeds in a list.

        If there are motion constraints or auxiliary speeds, they are provided
        here as well (as well as motion constraints).

        Parameters
        ==========

        uind : list
            A list of independent generalized speeds
        udep : list
            Optional list of dependent speeds
        coneqs : list
            Optional List of constraint expressions; these are expressions
            which are equal to zero which define a speed (motion) constraint.
        diffconeqs : list
            Optional, calculated automatically otherwise; list of constraint
            equations; again equal to zero, but define an acceleration
            constraint.
        u_auxiliary : list
            An optional list of auxiliary speeds used for brining
            non-contributing forces into evidence

        """

        if not hasattr(uind, '__iter__'):
            raise TypeError('Supply generalized speeds in an iterable.')
        self._u = uind + udep
        self._udot = [diff(i, dynamicsymbols._t) for i in self._u]
        self._uaux = u_auxiliary

        if not hasattr(udep, '__iter__'):
            raise TypeError('Supply dependent speeds in an iterable.')
        if len(udep) != len(coneqs):
            raise ValueError('There must be an equal number of dependent '
                             'speeds and constraints.')
        if diffconeqs is not None:
            if len(udep) != len(diffconeqs):
                raise ValueError('There must be an equal number of dependent '
                                 'speeds and constraints.')
        if len(udep) != 0:
            u = self._u
            uzero = dict(list(zip(u, [0] * len(u))))
            coneqs = Matrix(coneqs)
            udot = self._udot
            udotzero = dict(list(zip(udot, [0] * len(udot))))

            self._udep = udep
            self._f_nh = coneqs.subs(uzero)
            self._k_nh = (coneqs - self._f_nh).jacobian(u)
            # if no differentiated non holonomic constraints were given, calculate
            if diffconeqs is None:
                self._k_dnh = self._k_nh
                self._f_dnh = (self._k_nh.diff(dynamicsymbols._t) * Matrix(u) +
                               self._f_nh.diff(dynamicsymbols._t))
            else:
                self._f_dnh = diffconeqs.subs(udotzero)
                self._k_dnh = (diffconeqs - self._f_dnh).jacobian(udot)

            o = len(u)  # number of generalized speeds
            m = len(udep)  # number of motion constraints
            p = o - m  # number of independent speeds
            # For a reminder, form of non-holonomic constraints is:
            # B u + C = 0
            B = self._k_nh[:, :]
            C = self._f_nh[:, 0]

            # We partition B into indenpendent and dependent columns
            # Ars is then -Bdep.inv() * Bind, and it relates depedent speeds to
            # independent speeds as: udep = Ars uind, neglecting the C term here.
            self._depB = B
            self._depC = C
            mr1 = B[:, :p]
            ml1 = B[:, p:o]
            self._Ars = - _mat_inv_mul(ml1, mr1)
def _speeds ( self , uind , udep = [ ] , coneqs = [ ] , diffconeqs = None , u_auxiliary = [ ] ) : if not hasattr ( uind , '__iter__' ) : raise TypeError ( 'Supply generalized speeds in an iterable.' ) self . _u = uind + udep self . _udot = [ diff ( i , dynamicsymbols . _t ) for i in self . _u ] self . _uaux = u_auxiliary if not hasattr ( udep , '__iter__' ) : raise TypeError ( 'Supply dependent speeds in an iterable.' ) if len ( udep ) != len ( coneqs ) : raise ValueError ( 'There must be an equal number of dependent ' 'speeds and constraints.' ) if diffconeqs is not None : if len ( udep ) != len ( diffconeqs ) : raise ValueError ( 'There must be an equal number of dependent ' 'speeds and constraints.' ) if len ( udep ) != 0 : u = self . _u uzero = dict ( list ( zip ( u , [ 0 ] * len ( u ) ) ) ) coneqs = Matrix ( coneqs ) udot = self . _udot udotzero = dict ( list ( zip ( udot , [ 0 ] * len ( udot ) ) ) ) self . _udep = udep self . _f_nh = coneqs . subs ( uzero ) self . _k_nh = ( coneqs - self . _f_nh ) . jacobian ( u ) # if no differentiated non holonomic constraints were given, calculate if diffconeqs is None : self . _k_dnh = self . _k_nh self . _f_dnh = ( self . _k_nh . diff ( dynamicsymbols . _t ) * Matrix ( u ) + self . _f_nh . diff ( dynamicsymbols . _t ) ) else : self . _f_dnh = diffconeqs . subs ( udotzero ) self . _k_dnh = ( diffconeqs - self . _f_dnh ) . jacobian ( udot ) o = len ( u ) # number of generalized speeds m = len ( udep ) # number of motion constraints p = o - m # number of independent speeds # For a reminder, form of non-holonomic constraints is: # B u + C = 0 B = self . _k_nh [ : , : ] C = self . _f_nh [ : , 0 ] # We partition B into indenpendent and dependent columns # Ars is then -Bdep.inv() * Bind, and it relates depedent speeds to # independent speeds as: udep = Ars uind, neglecting the C term here. self . _depB = B self . _depC = C mr1 = B [ : , : p ] ml1 = B [ : , p : o ] self . _Ars = - _mat_inv_mul ( ml1 , mr1 )