Re: Re: Trouble with Integrate

*To*: mathgroup at smc.vnet.net*Subject*: [mg39316] Re: [mg39268] Re: [mg39264] Trouble with Integrate*From*: "Marko Vojinovic" <vojinovi at panet.co.yu>*Date*: Tue, 11 Feb 2003 04:41:28 -0500 (EST)*References*: <200302070807.DAA26439@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Thanks to DrBob, Andrzej, David and Daniel for their responces. Andrzej has found one workaround for the problem. Just to note that there is also another way: Let g = Sqrt[1+x^(2a)]-x^a where if we put the parameter a to be 2 we recover the original function, f. Now, Integrate[g,{x,0,Infinity}] /. a->2 gives the correct answer, in terms of Gamma. Also, we could choose not to set a->2, but just to use the assumption Re[a]>0, and then Integrate[g,{x,0,Infinity}, Assumptions->Re[a]>0] gives a (nice) answer for general a (also in terms of Gamma). Another (rather minor and unrelated) question arises: one can write down the result in many various forms using the identity Gamma(1+x) = x * Gamma(x) (I am not using Mathematica notation here), and FullSimplify knows about this identity, but applies it only "from right to left", i.e. 1/2 Gamma(1/2) reduces to Gamma(3/2), but never the other way around, which is sometimes wanted (in my case, particularly). Since I am not very familiar with FullSimplify, is there any way to explain to FullSimplify that I want only Gamma[1/4] to appear in the result? Best regards and thanks again, Marko ----- Original Message ----- From: "Andrzej Kozlowski" <akoz at mimuw.edu.pl> To: mathgroup at smc.vnet.net Subject: [mg39316] [mg39268] Re: [mg39264] Trouble with Integrate > > 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: Re: Trouble with Integrate***From:*Vladimir Bondarenko <vvb@mail.strace.net>

**References**:**Re: Trouble with Integrate***From:*Andrzej Kozlowski <akoz@mimuw.edu.pl>

**Re: Detecting unsuccessful computations**

**Linear and logarithmic fit**

**Re: Trouble with Integrate**

**Re: Re: Re: Trouble with Integrate**