I'm having the replace rule:
rule = {-g_ x_^4 - 2 g_ x_^2 y_^2 - g_ y_^4 -> -g (x^2 + y^2)^2};
Now,
(2 Re[Hy Conjugate[Hx]] kx^4 vx vy)/(k^2 (kx^2 + ky^2)) + (
4 Re[Hy Conjugate[Hx]] kx^2 ky^2 vx vy)/(k^2 (kx^2 + ky^2)) + (
2 Re[Hy Conjugate[Hx]] ky^4 vx vy)/(k^2 (kx^2 + ky^2)) //. rule
Just spits the same expression back out. The expected output would be
(2 Re[Hy Conjugate[Hx]] (kx^2 + ky^2) vx vy)/k^2
Sure, I could remove the minus signs in the rule, but is it possible to match both +
and -
? Furthermore this also fails of one of the coefficients is a complex number, how can I tell Mathematica that this should also work with complex numbers?
If there is another way to do this, e.g., using Solve
, I'd like to hear that.
Simplify
does things that I don't want it to do! I have 'fixed' everything with the replace rules, but this term doesn't want to change :-). $\endgroup$//. rule
by// Simplify
I get pretty much your desired output; I assume the discrepancies are typos. $\endgroup$