# Use float limits with Integrate?

Posted 1 month ago
441 Views
|
6 Replies
|
1 Total Likes
|
 I am a little confused with how Mathematica is integrating with Integrate. I am trying to compute an internal of the product of special functions (modified Bessel functions) with symbolic limits. After working for a minute, the computation stops with no success. However, if I carry out the same integral, but with floating point limits, it spits out an answer. What's going on here? When I give Integrate floating point limits is it reverting to NIntegrate?Thanks, JeffEdit: Here's an example. See how it fails even with rational limits? In[1]:= (*Doesn't evaluate*) Integrate[BesselK[1, k r] BesselI[1, k r], {r, 1/2, 3/2}] Out[1]//InputForm= Integrate[BesselI[1, k*r]*BesselK[1, k*r], {r, 1/2, 3/2}] In[2]:= (*Evaluates with float limits*) Integrate[BesselK[1, k r] BesselI[1, k r], {r, .5, 1.5}] Out[2]= -0.0705237 MeijerG[{{0.5, 0.5}, {}}, {{0., 1.}, {-1., -0.5}}, 0.5 k, 0.5] + 0.211571 MeijerG[{{0.5, 0.5}, {}}, {{0., 1.}, {-1., -0.5}}, 1.5 k, 0.5] 
6 Replies
Sort By:
Posted 1 month ago
 Has seemingly to do with argument $k r$: In[5]:= Integrate[BesselK[1, k r] BesselI[1, k r], {r, 1/2, 3/2}, Assumptions -> k \[Element] Complexes] Out[5]= Integrate[BesselI[1, k r] BesselK[1, k r], {r, 1/2, 3/2}, Assumptions -> k \[Element] Complexes] stating that $k \in \mathbb{C}$ does not help, so substitute the argument  In[7]:= Integrate[BesselK[1, x] BesselI[1, x]/k, {x, k/2, 3 k/2}, Assumptions -> k \[Element] Complexes] Out[7]= (1/(4 k Sqrt[\[Pi]])) (-MeijerG[{{1, 1}, {}}, {{1/2, 3/2}, {-(1/2), 0}}, k/2, 1/2] + MeijerG[{{1, 1}, {}}, {{1/2, 3/2}, {-(1/2), 0}}, (3 k)/2, 1/2] ) 
Posted 1 month ago
 When I give Integrate floating point limits is it reverting to NIntegrate? no, by no means: NIntegrate[] returns a number (possibly with conditions), but you got a symbolic result parametrized by reals: In[1]:= Integrate[(r k)^2, {r, 1/2, 3/2}] Out[1]= (13 k^2)/12 In[2]:= NIntegrate[(r k)^2 , {r, 0.5, 1.5}] During evaluation of In[2]:= NIntegrate::inumr: The integrand k^2 r^2 has evaluated to non-numerical values for all sampling points in the region with boundaries {{0.5,1.5}}. Out[2]= NIntegrate[(r k)^2, {r, 0.5, 1.5}] 
Posted 1 month ago
 Hi Dent de Lion,I really appreciate your investigation of my problem. You are correct that they argument $kr$ seems to be to blame for some of these computation failures. However, even with a simple argument, Integrate acts differently for float limits than for rational limits. Can you explain this?For example, In[1]:= Integrate[BesselI[0, x] BesselK[1, x]/x^2, {x, 1/2, 3/2}] // InputForm Out[1]//InputForm=Integrate[(BesselI[0, x]*BesselK[1, x])/x^2, {x, 1/2, 3/2}] In[2]:= Integrate[BesselI[0, x] BesselK[1, x]/x^2, {x, .5, 1.5}] Out[2]= 1.45921 Thanks, Jeff
Posted 1 month ago
 This is what I get on my old-fashioned Mma 7 In[1]:= Integrate[BesselI[0, x] BesselK[1, x]/x^2, {x, 1/2, 3/2}] // InputForm Out[1]//InputForm= 16/9 - (Pi^(3/2)*(MeijerG[{{-1/2, 0}, {-1/4, 1/4, 1}}, {{0, 0, 0}, {-1, -1, -1/4, 1/4}}, 3/2, 1/2] - 4*MeijerG[{{1/2, 1}, {3/4, 5/4, 2}}, {{1, 1, 1}, {0, 0, 3/4, 5/4}}, 1/2, 1/2]))/2 
 And here is the latest and greatest In[4]:= \$Version Out[4]= "11.3.0 for Microsoft Windows (64-bit) (March 7, 2018)" In[5]:= Integrate[BesselI[0, x] BesselK[1, x]/x^2, {x, 1/2, 3/2}] Out[5]= 2/9 (8 + \[Pi]^( 3/2) (9 MeijerG[{{1/2, 1}, {3/4, 5/4, 2}}, {{1, 1, 1}, {0, 0, 3/4, 5/4}}, 1/2, 1/2] - MeijerG[{{1/2, 1}, {3/4, 5/4, 2}}, {{1, 1, 1}, {0, 0, 3/4, 5/ 4}}, 3/2, 1/2])) In[6]:= % // N Out[6]= 1.45921 In[7]:= Integrate[BesselI[0, x] BesselK[1, x]/x^2, {x, .5, 1.5}] Out[7]= 1.45921  Can you explain this? It's a neverending story to explain software (implementations). Nevertheless Mathematica has an overwhelming strong relation to science and there it's quite usual to switch to numerical results (in contrast to symbolic ones) if the user chooses to give numerical input. Compare In[8]:= 1/2 Out[8]= 1/2 In[9]:= 1/2. Out[9]= 0.5 nothing obscure in that.