# Get the square root of a+bi,when a>0,b>0 in radical form

My code returns this result involves trigonometric functions,

ComplexExpand[Sqrt[a + b I], TargetFunctions -> {Re, Im}]
Assuming[{a > 0, b > 0}, FullSimplify@ReIm@Refine@%] In fact, it can be rewrie by radical form, following is the equivalently result from Maple How can I get the radical form result with Mathematica?

• Assuming[{a > 0, b > 0}, FullSimplify[Through@{Re, Im}@Refine@%, ComplexityFunction -> (100 Count[#, _ArcTan, {0, Infinity}] + LeafCount[#] &)]]? – kglr May 25 '18 at 7:56

Not what you expect, but as a possibility, if nothing else pops up:

eq1 = Sqrt[a + b I] == x + I*y;
eq2 = Map[#^2 &, eq1] // Expand;
eq3 = eq2 /. Complex[0, n_] -> 0
eq4 = Equal @@ MapThread[Subtract, {List @@ eq2, List @@ eq3}] //
Simplify

(*   a == x^2 - y^2

b == 2 x y    *)


Then

Solve[{eq3, eq4}, {x, y}] // Simplify

(*  {{x -> -(Sqrt[a - Sqrt[a^2 + b^2]]/Sqrt),
y -> (Sqrt[a - Sqrt[a^2 + b^2]] (a + Sqrt[a^2 + b^2]))/(
Sqrt b)},...   *)


Have fun!