# Absolute value and argument of a complex expression

I would like to find the absolute value and the argument of the expression: $x + \sqrt { x^2 + y^2 }$ under the assumption that the absolute values of $x$ and $y$ are equal.

I have written:

Simplify[ComplexExpand[Abs[x + (x^2 + y^2)^(1/2)], {x, y}, TargetFunctions -> {Abs, Arg}],
Assumptions -> Abs[x] == Abs[y]] // FullSimplify


Why does Mathematica return the un-evaluated expression?

I would like to have a solution that will also find a simplified version of my expression when Arg is substituted for Abs.

• Are you aware that ComplexExpand, Simplify, and FullSimplify all return your expression unevaluated? Are you aware that FullSimplify doesn't inherit your assumptions from Simplify? Do have any simplification of your expression in mind that you expect Mathematica to find? Commented Jun 22, 2014 at 8:11
• I do not have any simplification of the expression in mind. Commented Jun 22, 2014 at 8:16
• Then you should consider the proposition that the input form of the expression is as simple as possible by Mathematica's standards. Commented Jun 22, 2014 at 8:19

Try this:

   expr1 = x + Sqrt[x^2 + y^2];


Let us use tha condition that the absolute values of x and y are equal:

expr2 = Simplify[
expr1 /. {x -> \[Rho]*Exp[I \[CurlyPhi]1],
y -> \[Rho]*Exp[I \[CurlyPhi]2]}, {\[Rho] > 0, \[CurlyPhi]1 >
0, \[CurlyPhi]2 > 0}]

(*  (E^(I \[CurlyPhi]1) + Sqrt[
E^(2 I \[CurlyPhi]1) + E^(2 I \[CurlyPhi]2)]) \[Rho]  *)


expr3 = ComplexExpand[expr2]

The result is rather long:

  (*     \[Rho] Cos[\[CurlyPhi]1] + \[Rho] Cos[
1/2 Arg[E^(2 I \[CurlyPhi]1) + E^(
2 I \[CurlyPhi]2)]] ((Cos[2 \[CurlyPhi]1] +
Cos[2 \[CurlyPhi]2])^2 + (Sin[2 \[CurlyPhi]1] +
Sin[2 \[CurlyPhi]2])^2)^(1/4) +
I (\[Rho] Sin[\[CurlyPhi]1] + \[Rho] ((Cos[2 \[CurlyPhi]1] +
Cos[2 \[CurlyPhi]2])^2 + (Sin[2 \[CurlyPhi]1] +
Sin[2 \[CurlyPhi]2])^2)^(1/4)
Sin[1/2 Arg[E^(2 I \[CurlyPhi]1) + E^(2 I \[CurlyPhi]2)]])                               *)


     expr4 = Simplify[
Sqrt[Simplify[
Re[expr3], {\[Rho] > 0, \[CurlyPhi]1 > 0, \[CurlyPhi]2 > 0}]^2 +
Simplify[
Im[expr3], {\[Rho] > 0, \[CurlyPhi]1 > 0, \[CurlyPhi]2 >
0}]^2], {\[Rho] > 0, \[CurlyPhi]1 > 0, \[CurlyPhi]2 > 0}]


(* [Rho] [Sqrt](1 + 2 Abs[Cos[[CurlyPhi]1 - [CurlyPhi]2]] + 2 Sqrt[2] Sqrt[Abs[Cos[[CurlyPhi]1 - [CurlyPhi]2]]] Cos[[CurlyPhi]1 - 1/2 Arg[E^(2 I [CurlyPhi]1) + E^(2 I [CurlyPhi]2)]]) *)

and the phase:

  expr5 = ArcTan@
Simplify[Simplify[
Im[expr3], {\[Rho] > 0, \[CurlyPhi]1 > 0, \[CurlyPhi]2 > 0}]/
Simplify[
Re[expr3], {\[Rho] > 0, \[CurlyPhi]1 > 0, \[CurlyPhi]2 >
0}], {\[Rho] > 0, \[CurlyPhi]1 > 0, \[CurlyPhi]2 > 0}]

(*          ArcTan[(Sin[\[CurlyPhi]1] +
Sqrt[2] Sqrt[Abs[Cos[\[CurlyPhi]1 - \[CurlyPhi]2]]]
Sin[1/2 Arg[E^(2 I \[CurlyPhi]1) + E^(2 I \[CurlyPhi]2)]])/(
Cos[\[CurlyPhi]1] +
Sqrt[2] Sqrt[Abs[Cos[\[CurlyPhi]1 - \[CurlyPhi]2]]]
Cos[1/2 Arg[E^(2 I \[CurlyPhi]1) + E^(2 I \[CurlyPhi]2)]])]          *)


Now, if you want it in terms of x and y, you might do something like this:

    expr4 /. {\[Rho] -> Abs[x], \[CurlyPhi]1 -> Arg[x], \[CurlyPhi]2 ->
Arg[y]}


yielding

(* Abs[x] [Sqrt](1 + 2 Abs[Cos[Arg[x] - Arg[y]]] + 2 Sqrt[2] Sqrt[Abs[Cos[Arg[x] - Arg[y]]]] Cos[1/2 Arg[E^(2 I Arg[x]) + E^(2 I Arg[y])] - Arg[x]]) *)

while this gives the phase:

      expr5 /. {\[Rho] -> Abs[x], \[CurlyPhi]1 -> Arg[x], \[CurlyPhi]2 ->
Arg[y]}

(*         ArcTan[(Sqrt[2] Sqrt[Abs[Cos[Arg[x] - Arg[y]]]]
Sin[1/2 Arg[E^(2 I Arg[x]) + E^(2 I Arg[y])]] +
Sin[Arg[x]])/(Sqrt[2] Sqrt[Abs[Cos[Arg[x] - Arg[y]]]]
Cos[1/2 Arg[E^(2 I Arg[x]) + E^(2 I Arg[y])]] + Cos[Arg[x]])]      *)


These expressions are so long that I doubt that you will use them. It seems to be better in its original form.

• Yes, these expressions are so long! Commented Jun 22, 2014 at 8:51

Let's give Mathematica some help. The condition that Abs[x]=Abs[y] can be rewritten using the polar form of complex numbers (where m is the common magnitude and tx, ty are the angles). Then the expression can be simplified by making explicit assumptions about the domain of the parameters.

x = m*Exp[I tx];
y = m*Exp[I ty];
FullSimplify[x + Sqrt[x^2 + y^2],
Assumptions -> {m > 0, 0 <= tx <= 2 Pi, 0 <= ty <= 2 Pi}]

(E^(I tx) + Sqrt[E^(2 I tx) + E^(2 I ty)]) m


To keep the phases the same:

x = m1*Exp[I t];
y = m2*Exp[I t];
FullSimplify[x + Sqrt[x^2 + y^2], Assumptions -> {m1 > 0, m2 > 0, 0 <= t <= 2 Pi}]

E^(I t) m1 + Sqrt[E^(2 I t) (m1^2 + m2^2)]