Re: problem of evaluating SQRT
- To: mathgroup at smc.vnet.net
- Subject: [mg28051] Re: problem of evaluating SQRT
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Thu, 29 Mar 2001 03:24:16 -0500 (EST)
- References: <99pd51$leb@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Pek
Simplify[Sqrt[z^2]-z, z>=0]
0
Simplify[Sqrt[z^2]-z, -Pi/2< Arg[z] <=Pi/2]
0
Here is what is going on
Sqrt assumes that we are working with complex numbers.
For real non-negative r it gives the normal non-negative square root of r
For non-zero complex numbers z= x+Iy and r = Sqrt[x^2+y^2], the principal
argument (angle) of z is the angle a such that z = r (Cos[a]+ I Sin[a])
and -Pi<a<=Pi.
Sqrt[z] is the principal square root of z, that is
Sqrt[r]( Cos[a/2]+ r I Sin[a/2] )
Now,
z^2 = r^2(Cos[2a]+ I Sin[2a])
The question is: what is the principal argument of z^2?
(we know that -Pi<a<=Pi).
If -Pi/2<a<=Pi/2, and then it is 2a , so
Sqrt[z^2] = r (Cos[a]+ I Sin[a]) = z
If Pi/2 <a<=Pi then it is 2a -2Pi, so
Sqrt[z^2] = r (Cos[a-Pi]+ I Sin[a-Pi]) = -z
If -Pi <a<=-Pi/2 then it is 2a +2Pi, so
Sqrt[z^2] = r (Cos[a+Pi]+ I Sin[a+Pi]) = -z
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Pek" <phsoh at alum.mit.edu> wrote in message news:99pd51$leb at smc.vnet.net...
> Hi,
>
> We have a question of how sqrt can be evaluated.
>
> In[1]:=
> Sqrt[x^2]
>
> Out[1]=
> (This part is just sqrt[X^2])
>
> Below we expect the result to be zero but it isn't. How can we get the
> correct answer in this case?
>
> In[2]:=
> Sqrt[x^2] - x
>
> Out[2]=
> (This part is -x + sqrt[x^2] )
>
> Will really appreciate your help. Thanks.
>
> Pek
>
>