From: S. B. Gray on
Can anyone tell me why the following results appear?

Clear[xc1, xc2]
Simplify[Abs[xc1 - xc2]^2, Assumptions -> {xc1 < 0, xc2 < 0}]
Simplify[Abs[xc1 - xc2]^2, Assumptions -> {xc1 < 0, xc2 > 0}]
Simplify[Abs[xc1 - xc2]^2, Assumptions -> {xc1 > 0, xc2 < 0}]
Simplify[Abs[xc1 - xc2]^2, Assumptions -> {xc1 > 0, xc2 > 0}]
(xc1 - xc2)^2
(xc1 - xc2)^2
(xc1 - xc2)^2
(xc1 - xc2)^2

Simplify[Abs[xc1 - xc2]^2, Assumptions -> xc2 < 0]
Simplify[Abs[xc1 - xc2]^2, Assumptions -> xc2 > 0]
Simplify[Abs[xc1 - xc2]^2, Assumptions -> xc1 > 0]
Simplify[Abs[xc1 - xc2]^2, Assumptions -> xc1 < 0]
Abs[xc1 - xc2]^2
Abs[xc1 - xc2]^2
Abs[xc1 - xc2]^2
Abs[xc1 - xc2]^2
Abs[xc1 - xc2]^2

Simplify[Abs[xc1 - xc2]^2 - (xc1 - xc2)^2, Assumptions -> {xc1 -> 0}]
Simplify[Abs[xc1 - xc2]^2 - (xc1 - xc2)^2, Assumptions -> {xc2 -> 0}]
-xc2^2 + Abs[xc2]^2
-xc2^2 + Abs[xc2]^2

(* the next lines say that xc1, xc2 are Reals **)

Simplify[Abs[xc1 - xc2]^2, Assumptions -> {xc1 \[Element] \!\(\*
ButtonBox["Reals",
BaseStyle->"Link",
ButtonData->"paclet:ref/Reals"]\), xc2 \[Element] \!\(\*
ButtonBox["Reals",
BaseStyle->"Link",
ButtonData->"paclet:ref/Reals"]\)}]
Abs[xc1 - xc2]^2


I would expect all 9 answers to be (xc1 - xc2)^2. Wrong?

Steve Gray

From: Sjoerd C. de Vries on
As long as one of the variables can be Complex you cannot simplify
Abs[xc1 - xc2]^2 any further. If for instance xc1 = 1+i and xc2 = 0
then Abs[xc1 - xc2]^2 = 2, but (xc1 - xc2)^2 = 2i.

Cheers -- Sjoerd

On Jun 6, 12:41 pm, "S. B. Gray" <stev...(a)ROADRUNNER.COM> wrote:
> Can anyone tell me why the following results appear?
>
> Clear[xc1, xc2]
> Simplify[Abs[xc1 - xc2]^2, Assumptions -> {xc1 < 0, xc2 < 0}]
> Simplify[Abs[xc1 - xc2]^2, Assumptions -> {xc1 < 0, xc2 > 0}]
> Simplify[Abs[xc1 - xc2]^2, Assumptions -> {xc1 > 0, xc2 < 0}]
> Simplify[Abs[xc1 - xc2]^2, Assumptions -> {xc1 > 0, xc2 > 0}]
> (xc1 - xc2)^2
> (xc1 - xc2)^2
> (xc1 - xc2)^2
> (xc1 - xc2)^2
>
> Simplify[Abs[xc1 - xc2]^2, Assumptions -> xc2 < 0]
> Simplify[Abs[xc1 - xc2]^2, Assumptions -> xc2 > 0]
> Simplify[Abs[xc1 - xc2]^2, Assumptions -> xc1 > 0]
> Simplify[Abs[xc1 - xc2]^2, Assumptions -> xc1 < 0]
> Abs[xc1 - xc2]^2
> Abs[xc1 - xc2]^2
> Abs[xc1 - xc2]^2
> Abs[xc1 - xc2]^2
> Abs[xc1 - xc2]^2
>
> Simplify[Abs[xc1 - xc2]^2 - (xc1 - xc2)^2, Assumptions -> {xc1 -> 0}]
> Simplify[Abs[xc1 - xc2]^2 - (xc1 - xc2)^2, Assumptions -> {xc2 -> 0}]
> -xc2^2 + Abs[xc2]^2
> -xc2^2 + Abs[xc2]^2
>
> (* the next lines say that xc1, xc2 are Reals **)
>
> Simplify[Abs[xc1 - xc2]^2, Assumptions -> {xc1 \[Element] \!\(\*
> ButtonBox["Reals",
> BaseStyle->"Link",
> ButtonData->"paclet:ref/Reals"]\), xc2 \[Element] \!\(\*
> ButtonBox["Reals",
> BaseStyle->"Link",
> ButtonData->"paclet:ref/Reals"]\)}]
> Abs[xc1 - xc2]^2
>
> I would expect all 9 answers to be (xc1 - xc2)^2. Wrong?
>
> Steve Gray