Re: 1 equals 3 (among others)

*To*: mathgroup at smc.vnet.net*Subject*: [mg32187] Re: 1 equals 3 (among others)*From*: "Mikael Persson" <lillpele79 at hotmail.com>*Date*: Sat, 5 Jan 2002 00:10:23 -0500 (EST)*References*: <a13v7l$dgb$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

In article <a13v7l$dgb$1 at smc.vnet.net>, "Grischa Stegemann" <Stegemann at physikdonot.spamtu-berlin.de> wrote: > Dear group > > Can anyone explain to me what is going on here? Look at this: > > In[1]:=f[x_] = (4 - x + Sqrt[-4*(3 - x) + (x - 4)^2])/2; > In[2]:=Simplify[-4*(3 - x) + (x - 4)^2] Out[2]=(-2 + x)^2 > > Well, right now we can be pretty sure that f[x]=1 for all x. But > Mathematica (4.0.2.0X) seems to know better: > > In[3]:=Map[f[#1]&, {0, 0.1, 1.7, 2, 2.5, 3}] Out[3]={3, 2.9, 1.3, 1, 1., > 1} > > It took me hours to find this error in my rather complex setting...;-( > > Bye, Grischa When I calculated I got that f(x) = 1 if x >= 2 and f(x) = 3-x if x<2 Your mistake is that you claim that sqrt((x-2)^2)=x-2. But it is |x-2| regards Micke P