Tag Info

New answers tagged


No, this is not possible. A cell can only be evaluated if it contains a complete and syntactically correct expression. You might want to try Code style cells (Alt-8 or Command-8) which contain plain text and allow arbitrary formatting with spaces, tabs and newlines.


Allways you can use pattern replace expr1 = a^2 - b + c*d expr2 = a - b expr3 = -a + b - c expr/. Times[-1, x_] :> Times[1, x] (* a^2 + b + c * d a + b a + b + c *)


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 ...


The simple rule I to -I is not guaranteed to work, e.g. Exp[3 I] /. I -> -I and ComplexConjugate might be too slow (for lengthy expressions). Therefore, I rather define an alternative function to conjugate ClearAll[AltConjugate] AltConjugate[x_] := ReplaceAll[FullSimplify[x], Complex[a_, b_] -> Complex[a, -b]]; This functions looks for the ...

Top 50 recent answers are included