Replace every Minus to Plus in Expression
You have found the snags and you're right -- it's a simple matter. You just need the right rules.
For a pure symbolic expression you can use Kuba's suggestion.
a^2 - b + c*d /. -1 -> 1
a^2 + b + c d
For dealing with complex numbers you can use
(1 - b I) a /. x_Complex /; Im[x] < 0 -> Conjugate[x]
(1 + b I) a
If your expressions are more complicated than these, you might need more elaborate rules. But I offer more without knowing what form the more complicated expression take.
For most of these cases, judicious use of the undocumented function Internal`SyntacticNegativeQ[]
works nicely:
Replace[{a^2 - b + c d, a - b, -a + b - c}, x_?Internal`SyntacticNegativeQ :> -x, {-1}]
{a^2 + b + c d, a + b, a + b + c}
It will have trouble with complex numbers, however:
(3 - 4 I) (a - b I) E^(I t) /. x_?Internal`SyntacticNegativeQ :> -x
(-3 + 4 I) (a - I b) E^(I t)
so just use Conjugate
:
(3 - 4 I) (a - b I) E^(I t) /. x_Complex /; Negative[Im[x]] :> Conjugate[x]
(3 + 4 I) (a + b I) E^(I t)
However, none of these can deal with -3 + 4 I
; thus, a separate rule for real parts is necessary:
Replace[-3 + 4 I, {x_Complex /; Negative[Re[x]] :> -I Conjugate[I x]}, {-1}]
3 + 4 I
Fold[Replace[#, #2, {-1}] &, (-3 - 4 I) (a - b I) Exp[-I t],
{x_Complex /; Negative[Re[x]] :> -I Conjugate[I x],
x_Complex /; Negative[Im[x]] :> Conjugate[x],
x_?Internal`SyntacticNegativeQ :> -x}]
(3 + 4 I) (a + I b) E^(I t)