Re: Trouble with Integrate

*To*: mathgroup at smc.vnet.net*Subject*: [mg39268] Re: [mg39264] Trouble with Integrate*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Fri, 7 Feb 2003 03:07:11 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

On Thursday, February 6, 2003, at 05:08 PM, Marko Vojinovic wrote: > Consider the function: > > f = Sqrt[1+x^4] -x^2 > > Upon asking to > > Integrate[f,{x,0,Infinity}] > > Mathematica 4.0 answers: > > -Infinity > > which is not correct. However, > > NIntegrate[f,{x,0,Infinity}] > > gives the correct (numerical) answer: > 1.23605 > > The correct (analytical, i.e.. exact) answer to the integral is: > > Gamma[1/4] Gamma[1/4] / 6 Sqrt[Pi] > > which can be obtained after some paperwork. However, if I ask > > Integrate[1/(Sqrt[1+x^4] + x^2),{x,0,Infinity}] > > (this integrand is equivalent to f) one gets a complicated answer in > terms > of EllipticF. Meanwhile, when I ask Mathematica 3.0 the same set of > questions, I get correct answers, and analytical integration gives > answer in > terms of Gamma. Two questions: > > 1) Why does version 4.0 give so fairly incorrect result "-Infinity" > for the > first integral? > 2) How can I 'switch off' the use of elliptic functions and/or 'force' > Mathematica to use Gamma? > > Thanks, > Marko > 1). Well, it's a bug. The problem seems to be that attempts to fix bugs and improve the capabilities of Integrate in each new version of Mathematica tend to result in previously "good" integrals getting broken. In this case Mathematica's use of elliptic functions seems to be the culprit. 2). Unfortunately there is no "official" way to turn off the use of elliptic functions or anything else in Integrate. I have always considered this to be a fundamental error in design: it seems to me that Integrate should have been designed in such a way that you could turn off and on the use of certain methods, which expand the number of integrals Mathematica can manage but at the cost of increasing the risk of getting incorrect answers. Having said that, there is a way that sometimes works, and which luckily includes your case. Here is how. First we use a limit for Integrate and force Integrate to generate conditions. Since I do not wish to see the condition generated (it is simply b>0) I use Simplify with the appropriate assumption: In[1]:= Simplify[Integrate[Sqrt[1 + x^4] - x^2, {x, 0, b}, GenerateConditions -> True], b > 0] Out[1]= -(b^3/3) + b*Hypergeometric2F1[-(1/2), 1/4, 5/4, -b^4] Note that we got an answer without elliptic functions (which you would get if you did not set GenerateConditions to True). So now we try to use Limit: In[2]:= Limit[%, b -> Infinity] Out[2]= -((Gamma[-(3/4)]*Gamma[5/4])/(2*Sqrt[Pi])) Numerically this seems to agree with your answer (given by Mathematica 3.0) although Mathematica 4.2 does not seem to be able to prove that the two answers are equivalent. Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/

**Follow-Ups**:**Re: Re: Trouble with Integrate***From:*"Marko Vojinovic" <vojinovi@panet.co.yu>

**Re: finding periodicity in a set**

**Plot3D ? or sth**

**Re: Trouble with Integrate**

**Re: Re: Trouble with Integrate**