MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: problem of evaluating SQRT

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28007] RE: [mg27981] problem of evaluating SQRT
  • From: "David Park" <djmp at earthlink.net>
  • Date: Wed, 28 Mar 2001 02:40:35 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Would you expect your expression to be zero if x was negative? The answer
depends upon the sign of x. Mathematica will simplify if you specify the
sign.

Simplify[Sqrt[x^2] - x, x > 0]
0

Simplify[Sqrt[x^2] - x, x < 0]
-2 x

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/



> From: Pek [mailto:phsoh at alum.mit.edu]
To: mathgroup 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
>
>



  • Prev by Date: Re: seeking Wagner's Mathematica book
  • Next by Date: Re: problem of evaluating SQRT
  • Previous by thread: Re: problem of evaluating SQRT
  • Next by thread: Re: problem of evaluating SQRT