Re: 1 equals 3 (among others)
- To: mathgroup at smc.vnet.net
- Subject: [mg32194] Re: 1 equals 3 (among others)
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Sat, 5 Jan 2002 00:10:32 -0500 (EST)
- References: <a13v7l$dgb$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Grischa, Sqrt[x^2] need not be x; for real x it will be Abs[x] Forcomplex z, Sqrt[z^2] is z if -Pi/2< Arg[z]<=Pi/2, otherwise is - z. These comes from the definition: z^a = Exp[ a (Log[Abs[z]] +Arg[z] I)], where Log is the natural logarithm and -Pi<Arg[z] <=Pi -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "Grischa Stegemann" <Stegemann at physikDONOT.SPAMtu-berlin.de> wrote in message news:a13v7l$dgb$1 at smc.vnet.net... > 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 > -- > ------------------------------------------------------------------------- > Grischa Stegemann Technische Universität Berlin -- > >