I have the following expression in sympy: "Add(Mul(Integer(-1), Integer(2), Symbol('g'), Symbol('psi^ss_1'), conjugate(Symbol('psi^ss_1'))), Mul(Integer(-1), Integer(2), Symbol('g'), Symbol('psi^ss_2'), conjugate(Symbol('psi^ss_2'))), Symbol('omega_2'), Mul(Integer(-1), Rational(1, 2), Pow(Symbol('m'), Integer(-1)), Pow(Add(Mul(Integer(-1), Symbol('k')), Symbol('k_2')), Integer(2))))"
(sorry for the long line, didnt know how else to paste it) Anyway, I would like to factor 2g in front of the 2 terms that contain it (simplify doesnt do it for some reason) and also would like to replace all occurrences of x*conjugate(x) by abs(x)**2. There are two such occurrences and I tried to do expr.replace(a*conjugate(a), abs(a)**2) without any luck. Could anyone please help? Tnx, Andrei -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/5b34019d-e09a-48ed-b3c9-065c07e72a9a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.