def is_nilpotent(self):
        if not self:
            return True
        if not self.is_square:
            raise NonSquareMatrixError(
                "Nilpotency is valid only for square matrices")
        x = Dummy('x')
        if self.charpoly(x).args[0] == x**self.rows:
            return True
        return False
Checks if a matrix is nilpotent.
dataset/ETHPy150Open sympy/sympy/sympy/matrices/matrices.py/MatrixBase.is_nilpotent