def _eval_evalf(self, prec): c, m = self.as_coeff_Mul() if c is S.NegativeOne: if m.is_Mul: rv = -AssocOp._eval_evalf(m, prec) else: mnew = m._eval_evalf(prec) if mnew is not None: m = mnew rv = -m else: rv = AssocOp._eval_evalf(self, prec) if rv.is_number: return rv.expand() return rv
def matches(self, expr, repl_dict={}, evaluate=False): expr = sympify(expr) if self.is_commutative and expr.is_commutative: return AssocOp._matches_commutative(self, expr, repl_dict, evaluate) # todo for commutative parts, until then use the default matches method for non-commutative products return self._matches(expr, repl_dict, evaluate)
def matches(self, expr, repl_dict={}): expr = sympify(expr) if self.is_commutative and expr.is_commutative: return AssocOp._matches_commutative(self, expr, repl_dict) # todo for commutative parts, until then use the default matches method for non-commutative products return self._matches(expr, repl_dict)
def _eval_evalf(self, prec): return AssocOp._eval_evalf(self, prec).expand()
def matches(pattern, expr, repl_dict={}, evaluate=False): expr = sympify(expr) if pattern.is_commutative and expr.is_commutative: return AssocOp._matches_commutative(pattern, expr, repl_dict, evaluate) # todo for commutative parts, until then use the default matches method for non-commutative products return Basic.matches(pattern, expr, repl_dict, evaluate)