# How do I suppress an automatic sign change?

In a comment on the answer of user JimB to Evaluate a certain three-dimensional constrained integral , I remarked

"I have a integration limit transformation rule of the form

Sqrt[(1 - 2 x) (2 - x + 2 Sqrt[1 - x - 2 x^2])] -> 1 - 2 x + Sqrt[1 - x - 2 x^2]


, which Mathematica implements finely, but I also need

Sqrt[(-1 + 2 x) (2 - x + 2 Sqrt[1 - x - 2 x^2])] -> 1 - 2 x + Sqrt[1 - x - 2 x^2]


,--note changes of sign in first Sqrt--which Mathematica immediately converts to the previous rule, so the second rule doesn't get enforced. So, I need to suppress the immediate conversion."

Any suggestions?

Correction:

The introductory remark (and earlier comment) should have read (note introduction of minus sign in the first of the second Sqrt of the second transformation, so the two transformations should yield equivalent outcomes):

"I have a integration limit transformation rule of the form

Sqrt[(1 - 2 x) (2 - x + 2 Sqrt[1 - x - 2 x^2])] -> 1 - 2 x + Sqrt[1 - x - 2 x^2]


, which Mathematica implements finely, but I also need

Sqrt[-(-1 + 2 x) (2 - x + 2 Sqrt[1 - x - 2 x^2])] -> 1 - 2 x + Sqrt[1 - x - 2 x^2]


,--note changes of sign in first Sqrt--which Mathematica immediately converts to the previous rule, so the second rule doesn't get enforced. So, I need to suppress the immediate conversion."

So, the code of Daniel Huber would now take the form

r1 = Sqrt[(1 - 2 x) (2 - x + 2 Sqrt[1 - x - 2 x^2])] -> a;r2 = Sqrt[-(-1 + 2 x) (2 - x + 2 Sqrt[1 - x - 2 x^2])] -> b;expr = Sqrt[(1 - 2 x) (2 - x + 2 Sqrt[1 - x - 2 x^2])] + Sqrt[-(-1 + 2 x) (2 - x + 2 Sqrt[1 - x - 2 x^2])];expr /. r1;expr /. r2;expr /. {r1, r2}


yielding

2a

2b

2a

I'll have to mull over/play around with this a little more, and see if I can get the desired results. My apologies for the initial minus sign omission.

• For me it does not work as described: Mma converts these two rules into two different rules as expected. Sep 22, 2020 at 14:51
• I see the point of the comment of Alexei Boulbitch--the transformation works as intended if it is directly applied--not saved as a rule for futher use. But I'm still having some trouble using it immediately repeatedly, using /. I'll keep working on it. Sep 22, 2020 at 15:35
• It seems that if I use the transformation once, it works as intended. But it seems that one use "contaminates/alters" it, and then it doesn't apply. Sep 22, 2020 at 15:55

r1 = Sqrt[(1 - 2 x) (2 - x + 2 Sqrt[1 - x - 2 x^2])] -> a;