0

I have an expression:

a + b 2^(1/2) + (c + d 2^(1/2))*I

I want to replace each occurrence of 2^(1/2) with -2^(1/2) and each occurrence of I with -I. So I input:

a + b 2^(1/2) + (c + d 2^(1/2)) I /. {2^(1/2) -> -2^(1/2), I -> (-I)}

Mathematica returns:

(* a - Sqrt[2] b - I (c - Sqrt[2] d) *)

as I expected.

Now I want to make the same replacement again on this expression. So I input:

a + b 2^(1/2) + (c + d 2^(1/2)) I /. {2^(1/2) -> -2^(1/2), 
  I -> (-I)}/. {2^(1/2) -> -2^(1/2), I -> (-I)}

Mathematica returns:

(*a + Sqrt[2] b - I (c + Sqrt[2] d) *)

I do not expect the MINUS sign in the middle of this expression. It seems like it should be PLUS.?

bbgodfrey
  • 61,439
  • 17
  • 89
  • 156
Geoffrey Critzer
  • 1,661
  • 1
  • 11
  • 14

0 Answers0