MathGroup Archive 2001

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

Search the Archive

Re: problem of evaluating SQRT

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28027] Re: problem of evaluating SQRT
  • From: "Ian McInnes" <ian at whisper-wood.demon.co.uk>
  • Date: Wed, 28 Mar 2001 02:40:59 -0500 (EST)
  • References: <99pd51$leb@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Sqrt[x^2] is only equal to x when the real part of x is non-negative. This
is because the value x^2 is the same as the value (-x)^2, and its inverse
Sqrt takes the positive root in order to be a valid function (i.e. map to a
single target value).

Using Simplify under the assumption that x is a non-negative real gives the
required result:
        Simplify[Sqrt[x^2], x >= 0]     --> x
        Simplify[Sqrt[x^2]-x, x >= 0]  --> 0

Regards,

Ian McInnes.

"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
>
>




  • Prev by Date: RE: Q: global options for styleform
  • Next by Date: Re: problem of evaluating SQRT
  • Previous by thread: Re: problem of evaluating SQRT
  • Next by thread: Re: problem of evaluating SQRT