Re: problem of evaluating SQRT
- To: mathgroup at smc.vnet.net
- Subject: [mg28002] Re: problem of evaluating SQRT
- From: Yossi Lonke <jrl16 at po.cwru.edu>
- Date: Wed, 28 Mar 2001 02:40:30 -0500 (EST)
- Organization: Case Western Reserve University, Cleveland, OH, USA
- References: <99pd51$leb@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
> From: "Pek" <phsoh at alum.mit.edu> To: mathgroup at smc.vnet.net > Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. > Newsgroups: comp.soft-sys.math.mathematica > Date: 27 Mar 2001 01:49:05 -0500 > Subject: [mg28002] problem of evaluating SQRT > > 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 > > There is actually no reason to expect the result to be zero. For example, it is 2 if x = -1. Since Sqrt[x^2] = |x| ( the absolute value of x ) the result will be zero only if x is positive. Yossi Lonke