unittest/python/crocoddyl/state.py
def Jdiff(self, x1, x2, firstsecond='both'):
        """ Compute the partial derivatives for diff operator using NumDiff.

        :param x1: current state
        :param x2: next state
        :param firstsecond: desired partial derivative
        :return the partial derivative(s) of the diff(x1,x2) function
        """
        assert (firstsecond in ['first', 'second', 'both'])
        if firstsecond == 'both':
            return [self.Jdiff(x1, x2, 'first'), self.Jdiff(x1, x2, 'second')]
        dx = np.zeros(self.ndx)
        h = self.disturbance
        J = np.zeros([self.ndx, self.ndx])
        d0 = self.diff(x1, x2)
        if firstsecond == 'first':
            for k in range(self.ndx):
                dx[k] = h
                J[:, k] = self.diff(self.integrate(x1, dx), x2) - d0
                dx[k] = 0
        elif firstsecond == 'second':
            for k in range(self.ndx):
                dx[k] = h
                J[:, k] = self.diff(x1, self.integrate(x2, dx)) - d0
                dx[k] = 0
        J /= h
        return J
 Compute the partial derivatives for diff operator using NumDiff.

        :param x1: current state
        :param x2: next state
        :param firstsecond: desired partial derivative
        :return the partial derivative(s) of the diff(x1,x2) function
        
Compute the partial derivatives for diff operator using NumDiff.
Compute the partial derivatives for diff operator using NumDiff .
def Jdiff(self, x1, x2, firstsecond='both'):
        assert (firstsecond in ['first', 'second', 'both'])
        if firstsecond == 'both':
            return [self.Jdiff(x1, x2, 'first'), self.Jdiff(x1, x2, 'second')]
        dx = np.zeros(self.ndx)
        h = self.disturbance
        J = np.zeros([self.ndx, self.ndx])
        d0 = self.diff(x1, x2)
        if firstsecond == 'first':
            for k in range(self.ndx):
                dx[k] = h
                J[:, k] = self.diff(self.integrate(x1, dx), x2) - d0
                dx[k] = 0
        elif firstsecond == 'second':
            for k in range(self.ndx):
                dx[k] = h
                J[:, k] = self.diff(x1, self.integrate(x2, dx)) - d0
                dx[k] = 0
        J /= h
        return J
def Jdiff ( self , x1 , x2 , firstsecond = 'both' ) : assert ( firstsecond in [ 'first' , 'second' , 'both' ] ) if firstsecond == 'both' : return [ self . Jdiff ( x1 , x2 , 'first' ) , self . Jdiff ( x1 , x2 , 'second' ) ] dx = np . zeros ( self . ndx ) h = self . disturbance J = np . zeros ( [ self . ndx , self . ndx ] ) d0 = self . diff ( x1 , x2 ) if firstsecond == 'first' : for k in range ( self . ndx ) : dx [ k ] = h J [ : , k ] = self . diff ( self . integrate ( x1 , dx ) , x2 ) - d0 dx [ k ] = 0 elif firstsecond == 'second' : for k in range ( self . ndx ) : dx [ k ] = h J [ : , k ] = self . diff ( x1 , self . integrate ( x2 , dx ) ) - d0 dx [ k ] = 0 J /= h return J
Compute the partial derivatives for diff operator using NumDiff.
Compute the partial derivatives for diff operator using NumDiff .
""" Compute the partial derivatives for diff operator using NumDiff.

        :param x1: current state
        :param x2: next state
        :param firstsecond: desired partial derivative
        :return the partial derivative(s) of the diff(x1,x2) function
        """
self
x1
x2
firstsecond