MathGroup Archive 2007

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

Search the Archive

RE: Have I found a bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84225] RE: [mg84209] Have I found a bug?
  • From: "Jaccard Florian" <Florian.Jaccard at he-arc.ch>
  • Date: Fri, 14 Dec 2007 07:03:36 -0500 (EST)
  • References: <200712140855.DAA07725@smc.vnet.net>

Hello Louise,

Why do you expect 1/Sqrt[1-x^2] ?

If I look into the details :

In[18]:= g[x_] := 1 - x^2
h[x_] := -x
Exp[-Integrate[(D[g[x], x] - h[x])/g[x], x]]

Out[20]= 1/Sqrt[x^2 - 1]

In[21]:= f[x_] = (D[g[x], x] - h[x])/g[x]

Out[21]= -(x/(1 - x^2))

In[22]:= k[x_] = Integrate[f[x], x]

Out[22]= (1/2)*Log[x^2 - 1]

In[23]:= E^(-k[x])

Out[23]= 1/Sqrt[x^2 - 1]

I must say that I agree with Mathematica.

I suppose your reason to think about a bug is the following :

Integrating k[x] by hand, you obtain : (1/2)*Log[Abs[1-x^2]] , which is =
(1/2)Log[1-x^2] if -1<x<1.
So, if -1<x<1, you obtain as final result :
E^(-(1/2)Log[1-x^2]]=1/Sqrt[1-x^2]
Is it so?

Well, you have not to forget that if Abs[x]>1, then
1/2)*Log[Abs[1-x^2]]=(1/2)*Log[x^2-1] and you would so obtain the same =
result as Mathematica.

The reason is very simple : "Integrate" gives a primitive which is =
defined only modulo an arbitrary constant. Mathematica works in the =
complex space, so you can for example choose the integrating constant =
I*Pi/2.
Integrating k[x], you would, with -1<x<1, have obtained :
(1/2)Log[Abs[1-x^2]]+I*Pi/2 = (1/2)Log[1-x^2]+I*Pi/2
And so, your final result would be :
E^(-((1/2)Log[1-x^2]+I*Pi/2))=1/Sqrt[1-x^2]*E^(-I*Pi/2)=1/Sqrt[1-x^2]=
*(-I)
But as -1<x<1, Sqrt[1-x^2]=Sqrt[-1*(x^2-1)]=-I*Sqrt[x^2-1]
(because if a and b are negative, Sqrt[a*b]=-Sqrt[a]*Sqrt[b] )
So you finally obtain : 1/(-I*Sqrt[x^2-1])*(-I)=1/Sqrt[x^2-1]
Which is also the same result as Mathematica.


So I definitively think Mathematica is doing very well!

Regards


Florian Jaccard



-----Message d'origine-----
De=A0: Louise Hoffman [mailto:louise.hoffman at gmail.com]
Envoy=E9=A0: vendredi, 14. d=E9cembre 2007 09:55
=C0=A0: mathgroup at smc.vnet.net
Objet=A0: [mg84209] Have I found a bug?

Dear readers,

When I calc. this in Mathematica 5.2

g[x_] := 1 - x^2
h[x_] := -x
Exp[-Integrate[ (D[g[x], x] - h[x])/g[x], x ] ]

it returns
1/Sqrt[-1+x^2]

where I would expect

1/Sqrt[1-x^2]

Have I found a bug, or have I made a mistake?

Lots of love,
Louise



  • Prev by Date: Re: Unwanted Button
  • Next by Date: Re: Returning a local array
  • Previous by thread: Have I found a bug?
  • Next by thread: Re: Have I found a bug?