Re: What is wrong?

*To*: mathgroup at smc.vnet.net*Subject*: [mg7711] Re: [mg7696] What is wrong?*From*: "C. Woll" <carlw at u.washington.edu>*Date*: Wed, 2 Jul 1997 14:21:31 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

On Sun, 29 Jun 1997, Sergio Rojas wrote: > > > In[1]:= Integrate[x*Sin[x]/(x^2+1),{x,0,Infinity}] > > Pi > Out[1]= --- > 2 E > > In[2]:= f[x_] = Evaluate[ Integrate[x*Sin[x]/(x^2+1),x]] ; > > In[3]:= ans = f[Infinity] - f[0] > > E Pi > Out[3]= ---- > 2 > > In[4]:= $Version > > Out[4]= DEC OSF/1 Alpha 2.2 (September 9, 1994) > Hi Sergio, Using mma 3.0, the two methods agree. If you look at the result returned by mma 2.2 for the indefinite integral, you will notice that it has terms like CosIntegral[I-x] whereas mma 3 instead has terms like CosIntegral[I+x] Note that the difference between these two expressions depends on which branch in the complex plane you take, but does not depend on x. Thus, derivatives of the above expressions will be the same. Now, the reason for the discrepancy between the two methods in mma 2.2 lies in the fact that the CosIntegral function with a complex argument is an integral in the complex domain. Anytime you evaluate these types of integrals, you run the risk of not taking consistent branch cuts. Thus, if you are interested in definite integrals of a real function, it is better to use NIntegrate Carl Woll