Re: positive square root
- To: mathgroup at smc.vnet.net
- Subject: [mg58700] Re: positive square root
- From: Peter Pein <petsie at dordos.net>
- Date: Fri, 15 Jul 2005 03:02:15 -0400 (EDT)
- References: <db57ne$4no$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
paulvonhippel at yahoo schrieb:
> I work in a world where the square root is always a positive number.
> But Mathematica allows for the possibility of negative square roots.
> Two questions arise:
>
> (1) Is there a way to tell Mathematica that I'm only interested in
> positive square roots?
>
> (2) My current solution is to use, e.g., Abs[Sqrt[z]]. But when
> Mathematica echoes this, it puts the Abs function *under* the radical,
> so it looks like Sqrt[Abs[z]]. Is this a bug in the display?
>
Hi Paul,
I don't think so. It is just in general easier, to evaluate Sqrt[Abs[z]]
than Abs[Sqrt[z]]:
In[1]:=
Assuming[(x | y) \[Element] Reals,
FullSimplify[
{Abs[ComplexExpand[Sqrt[x + I*y]]],(*sqrt first*)
ComplexExpand[Sqrt[Abs[x + I*y]]]}]](*abs first*)
Out[1]=
{(x^2 + y^2)^(1/4)*
Abs[Cos[(1/2)*ArcTan[x, y]] + I*Sin[(1/2)*ArcTan[x, y]]],
x^2 + y^2)^(1/4)}
These are of course equivalent:
In[2]:=
SameQ @@ Simplify[ComplexExpand[%]]
Out[2]=
True
--
Peter Pein
Berlin
http://people.freenet.de/Peter_Berlin/