When I try to evaluate Re[Sqrt[z]], for some values of Mathematica fails to evaluate it.
For example,
Re[Sqrt[2 + I*x]]`
Re[Sqrt[2 + I x]]
How can I get the real number in Sqrt[complex number]?
|
When I try to evaluate For example,
How can I get the real number in |
||||
|
Try playing with this:
The function
|
||||
|
|
|
Given that there is a universal algebraic solution, we should not be satisfied with trigonometric expressions. The simplest, most direct way I have found to obtain the real part of the root of $x + i y$ begins with the inverse of the square root, suggesting we would like the $u$ part of this solution:
Unfortunately Mathematica complains about the presence of imaginary values when real solutions are sought. So we have to force a separation into real and imaginary parts:
We get four solutions, of which two are evidently imaginary, leaving $$u = \pm\frac{\sqrt{\sqrt{x^2+y^2}+x}}{\sqrt{2}}$$ as the two real solutions, as expected. (You could specify This technique generalizes in an obvious way to more complicated inverse functions than mere square roots. |
||||
|
|
Re[Sqrt[2 + I*x]]unevaluated, suggests 'ComplexExpand`. If you accept the suggestion, Mathematica then returns(4 + x^2)^(1/4) Cos[1/2 Arg[2 + I x]]. – m_goldberg Mar 5 at 17:45