Possible Bug with Specific Combination of Integrate and Assumptions
- To: mathgroup at smc.vnet.net
- Subject: [mg91373] Possible Bug with Specific Combination of Integrate and Assumptions
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Tue, 19 Aug 2008 07:13:43 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <g86844$hr7$1@smc.vnet.net> <g88v87$gva$1@smc.vnet.net> <g8b8tv$8qa$1@smc.vnet.net> <48A936F7.50706@gmail.com>
Jean-Marc Gulliet wrote: > did wrote: >> On Aug 17, 12:41 pm, Jean-Marc Gulliet <jeanmarc.gull... at gmail.com> >> wrote: >>> Does the following result look better? >>> >>> In[1]:= Assuming[x > 0 && Im[a] == 0 && Im[b] == 0 && Im[y] == >> = 0, >>> FullSimplify[ >>> Integrate[(b + k*x)/k^2*Exp[-k*x]*Sin[k*a]*Sin[k*y], {k, 0, >>> Infinity}]]] >>> >>> Out[1]= 1/4 (2 b ((-a + y) ArcTan[(a - y)/x] + (a + y) ArcTan[(a + y)/ >>> x] - x ArcTanh[(2 a y)/(a^2 + x^2 + y^2)]) + >>> x Log[1 + (4 a y)/(x^2 + (a - y)^2)]) >> >> That looks much better indeed. Thanks. >> >>> Note that *Assuming* passes the assumptions to both Integrate[] *and* >>> FullSimplify[]. (In your original expression, only Integrate[] could >>> take into account the assumptions.) >> >> I understand that. But what I find puzzling the result obtained by >> Alberto >> (I got the same). I'm wondering if there is an issue there. > > The issue might be platform specific. On my system 64-bit Intel Core 2 > Duo 4 GB RAM Mac OS X Leopard 1.5.4 Mathematica 6.0.3, Alberto Verga's > expression returns unevaluated after few dozens of seconds. > > In[1]:= > Integrate[1/k^2*Exp[-k]*Sin[a k] Sin[y k], > {k,0,Infinity},Assumptions->Element[{a,y},Reals]] > > Out[1]= > Integrate[(E^-k Sin[a k] Sin[k y])/k^2, > {k,0,\[Infinity]},Assumptions->(a|y)\[Element]Reals] > > In[2]:= $Version > > Out[2]= 6.0 for Mac OS X x86 (64-bit) (May 21, 2008) Gist: The above integral cannot be correctly evaluated when using the option *Assumptions*; however, it is evaluated quickly and correctly when the assumptions are passed via the command *Assuming[]*. Following a private communication w/ Alberto Verga, I realized that I did not try to evaluate the integral twice within the same Mathematica session. Indeed, the first time one evaluates the above expression, the integral is returned unevaluated (having consumed about 90s of cpu time). Evaluating again the integral, Sqrt[-1]/8 is returned (having consumed about 60s of cpu time). Note that both results are erroneous (see below for the correct one). Also, it seems that the system cache and the evaluation of the integral interfere in some unexpected way. If we clear the symbolic system cache before evaluating again the expression, the expression is then returned unevaluated as in the first run. In[1]:= Integrate[1/k^2*Exp[-k]*Sin[a k] Sin[y k], {k, 0, Infinity}, Assumptions -> Element[{a, y}, Reals]] // Timing Out[1]= {89.2521, Integrate[(E^-k Sin[a k] Sin[k y])/k^2, {k, 0, \[Infinity]}, Assumptions -> (a | y) \[Element] Reals]} In[2]:= Integrate[1/k^2*Exp[-k]*Sin[a k] Sin[y k], {k, 0, Infinity}, Assumptions -> Element[{a, y}, Reals]] // Timing Out[2]= {62.8449, I/8} In[3]:= ClearSystemCache["Symbolic"] In[4]:= Integrate[1/k^2*Exp[-k]*Sin[a k] Sin[y k], {k, 0, Infinity}, Assumptions -> Element[{a, y}, Reals]] // Timing Out[4]= {85.4576, Integrate[(E^-k Sin[a k] Sin[k y])/k^2, {k, 0, \[Infinity]}, Assumptions -> (a | y) \[Element] Reals]} Now if we use the command *Assuming[]* rather than the option Assumptions (of course, using the same set of assumptions) we consistently get the correct result in few seconds. In[1]:= Assuming[Element[{a, y}, Reals], Integrate[ 1/k^2*Exp[-k]*Sin[a k] Sin[y k], {k, 0, Infinity}]] // Timing Out[1]= {4.87668, 1/2 ((-a + y) ArcTan[a - y] + (a + y) ArcTan[a + y] - ArcTanh[(2 a y)/(1 + a^2 + y^2)])} In[2]:= Assuming[Element[{a, y}, Reals], Integrate[ 1/k^2*Exp[-k]*Sin[a k] Sin[y k], {k, 0, Infinity}]] // Timing Out[2]= {0.639187, 1/2 ((-a + y) ArcTan[a - y] + (a + y) ArcTan[a + y] - ArcTanh[(2 a y)/(1 + a^2 + y^2)])} Tested on: 64-bit Intel Core 2 Duo 4 GB Mac OS X Leopard 1.5.4 Mathematica 6.0.3 Regards, -- Jean-Marc