Re: 1 equals 3 (among others)
- To: mathgroup at smc.vnet.net
- Subject: [mg32195] Re: [mg32180] 1 equals 3 (among others)
- From: BobHanlon at aol.com
- Date: Sat, 5 Jan 2002 00:10:34 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 1/4/02 6:07:44 AM, Stegemann at physikDONOT.SPAMtu-berlin.de
writes:
>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...;-(
>
Sqrt returns a positive number
Simplify[Sqrt[(x-2)^2], x>=2]
-2 + x
Simplify[Sqrt[(x-2)^2], x<2]
2 - x
Plot[{Sqrt[(x-2)^2]}, {x, 0, 5}];
Bob Hanlon
Chantilly, VA USA