(self)
return Ad, Bd
Return the discretized, scaled, linearized system.

        Returns
        -------
        Ad : ndarray
            The discrete-time state matrix.
        Bd : ndarray
            The discrete-time action matrix.
Return the discretized, scaled, linearized system.
Return the discretized scaled linearized system .
def linearize(self):
        """Return the discretized, scaled, linearized system.

        Returns
        -------
        Ad : ndarray
            The discrete-time state matrix.
        Bd : ndarray
            The discrete-time action matrix.

        """
        m = self.pendulum_mass
        M = self.cart_mass
        L = self.length
        b = self.rot_friction
        g = self.gravity

        A = np.array([[0, 0,                     1, 0                            ],
                      [0, 0,                     0, 1                            ],
                      [0, g * m / M,             0, -b / (M * L)                 ],
                      [0, g * (m + M) / (L * M), 0, -b * (m + M) / (m * M * L**2)]],
                     dtype=config.np_dtype)

        B = np.array([0, 0, 1 / M, 1 / (M * L)]).reshape((-1, self.action_dim))

        if self.normalization is not None:
            Tx, Tu = map(np.diag, self.normalization)
            Tx_inv, Tu_inv = map(np.diag, self.inv_norm)
            A = np.linalg.multi_dot((Tx_inv, A, Tx))
            B = np.linalg.multi_dot((Tx_inv, B, Tu))

        Ad, Bd, _, _, _ = signal.cont2discrete((A, B, 0, 0), self.dt,
                                               method='zoh')
        return Ad, Bd
def linearize ( self ) : m = self . pendulum_mass M = self . cart_mass L = self . length b = self . rot_friction g = self . gravity A = np . array ( [ [ 0 , 0 , 1 , 0 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , g * m / M , 0 , - b / ( M * L ) ] , [ 0 , g * ( m + M ) / ( L * M ) , 0 , - b * ( m + M ) / ( m * M * L ** 2 ) ] ] , dtype = config . np_dtype ) B = np . array ( [ 0 , 0 , 1 / M , 1 / ( M * L ) ] ) . reshape ( ( - 1 , self . action_dim ) ) if self . normalization is not None : Tx , Tu = map ( np . diag , self . normalization ) Tx_inv , Tu_inv = map ( np . diag , self . inv_norm ) A = np . linalg . multi_dot ( ( Tx_inv , A , Tx ) ) B = np . linalg . multi_dot ( ( Tx_inv , B , Tu ) ) Ad , Bd , _ , _ , _ = signal . cont2discrete ( ( A , B , 0 , 0 ) , self . dt , method = 'zoh' ) return Ad , Bd