def is_Linear(self):
        """Returns True if expression is linear (a polynomial with degree 1 or 0) (read-only)."""
        coeff_dict = self.expression.as_coefficients_dict()
        for key in coeff_dict.keys():
            if len(key.free_symbols) < 2 and (key.is_Add or key.is_Mul or key.is_Atom):
                pass
            else:
                return False
            if key.is_Pow and key.args[1] != 1:
                return False
        else:
            return True
def is_Linear ( self ) : coeff_dict = self . expression . as_coefficients_dict ( ) for key in coeff_dict . keys ( ) : if len ( key . free_symbols ) < 2 and ( key . is_Add or key . is_Mul or key . is_Atom ) : pass else : return False if key . is_Pow and key . args [ 1 ] != 1 : return False else : return True
Returns True if expression is linear (a polynomial with degree 1 or 0) (read-only).