Group Abstract Group Abstract

Message Boards Message Boards

0
|
13K Views
|
25 Replies
|
1 Total Like
View groups...
Share
Share this post:

Solve integral with Bessel functions?

Posted 10 years ago

Hello,

May I ask anybody to check using MATHEMATICA whether the following integral exist?:

Integrate[BesselJ[2*n + 1/2, L]*BesselJ[2*m + 1/2, L]/Sqrt[L^2 +K], {L, 0, ?}, 
  Assumptions -> n ? Integers && n ? 0 && m ? Integers && m ? 0 && K ? Reals && K > 0]

MATHEMATICA once produced some analytical expression for this integral (a few versions back) but I am not sure with the recent versions. I currently only have an access in the batch mode to the program and cannot find out how to get any visible output, nor whether the output exists.

Leslaw

POSTED BY: Leslaw Bieniasz
25 Replies

The general solution (so for every m and n) might not cover all cases for m and n.

Example:

Say I integrate:

Integrate[x^n, x]

Giving:

x^(1 + n)/(1 + n)

However this does not cover the n = -1 case:

Integrate[x^-1, x]

Gives:

Log[x]
POSTED BY: Sander Huisman

No but when I do, I get a result:

out=Integrate[BesselJ[2n+1/2,L]BesselJ[2*m+1/2,L]/Sqrt[L^2+K],{L,0,\[Infinity]},Assumptions->n\[Element]Integers&&n>=0&&m\[Element]Integers&&m>=0&&K\[Element]Reals&&K>0]
Series[out,{K,\[Infinity],4}]

outputs a very large expression. Note that you can not substitute values directly into the output, first you have to apply Normal to it. See the detailed documentation of Series.

POSTED BY: Sander Huisman
Posted 10 years ago

Hi,

Series[function,{x,Infinity,order}]

Have you tried this for the present function before writing? This does not seem to work. There are some messages about singularities or indeterminate results. But (although I cannot yet prove it), I have reasons to believe that there should exist an asymptotic expansion, probably as a series in powers of 1/Sqrt[K].

Leslaw

POSTED BY: Leslaw Bieniasz

I have used N[] in Manipulate[] to decrease the time for graph manipulation!

Nice explanation!

Of course you can do series expansions around infinity:

Series[function,{x,Infinity,order}]

But getting any kind of precision might be tricky, you might need a lot of terms!

POSTED BY: Sander Huisman

Machine Precision is not enough precision for large K (probably due to summation):

p1 = Plot[f[7, 0, K], {K, 0, 1000}, WorkingPrecision -> 32, PlotStyle -> Red];
p2 = Plot[f[7, 0, K], {K, 0, 1000}];
Show[{p1, p2, p1}]

You see that for K > 250 the error grows considerably.

So for small K, the results are roughly the same, but the larger the K, the larger the error.

POSTED BY: Sander Huisman
Posted 10 years ago

Hi,

Well, precision is one issue, but what about timings when K=10^4 or more? From my tests, I see a dramatic increase of computing times for K=10^4, compared to K= 10^3. Why actually it is so? How the hypergeometric series are evaluated internally by MATHEMATICA? If it is plain summation, then certainly there is no hope to get reasonable times.

If we now have a formula which is actually a series in powers of K, then is there any method to obtain symbolically an equivalent series in 1/K ? Then the summation could be faster for large K. Of course, I realise that this is not a trivial issue, but MATHEMATICA is supposed to encapsulate the whole current mathematical knowledge, so maybe it has some method to achieve the goal?

Leslaw

POSTED BY: Leslaw Bieniasz

Confusion... If to apply WorkingPrecision[] the graph differs from the above! Why?

That last plot just uses machine precision, to correctly plot it use:

Plot[f[7, 0, K], {K, 0, 1000}, WorkingPrecision -> 32]

No need for N[ ], as K is numerical value anyhow...

POSTED BY: Sander Huisman

Dear Leslaw,

The expression for m<n is not well defined. It's not clear what it must be. Nevertheless, for m>=n there are good news:

$MaxExtraPrecision = 300;
f[m_, n_, K_] := \[Piecewise] {
   {(2^(-2 (1 + m + n))*K^(1/2 + m + n)*Gamma[-(1/2) - m - n]*
        Gamma[1 + m + n]*
        HypergeometricPFQ[{1 + m + n, 1 + m + n}, {3/2 + 2 m, 
          3/2 + 2 n, 2 + 2 m + 2 n}, K])/(Sqrt[\[Pi]]*
        Gamma[3/2 + 2 m]*
        Gamma[3/2 + 2 n]) + (HypergeometricPFQ[{1/2, 1/2, 
         1}, {1/2 - m - n, 1 + m - n, 1 - m + n, 3/2 + m + n}, 
        K])/(1 + 2*(m + n)), m == n},
   {(2^(-2 (1 + m + n))*K^(1/2 + m + n) Gamma[-(1/2) - m - n]*
        Gamma[1 + m + n]*
        HypergeometricPFQ[{1 + m + n, 1 + m + n}, {3/2 + 2 m, 
          3/2 + 2 n, 2 + 2 m + 2 n}, K])/(Sqrt[\[Pi]] Gamma[
         3/2 + 2 m]*
        Gamma[3/2 + 2 n]) + (Pochhammer[1/2, 
          m - n]^2/(Pochhammer[1/2 - m - n, m - n]*
          Pochhammer[1 + m - n, m - n]*
          Pochhammer[1 - m + n, m - n - 1]*
          Pochhammer[3/2 + m + n, m - n]))*(K^(m - n))*((-1)^(m - n + 
          1))*(HypergeometricPFQ[{1/2 + m - n, 1/2 + m - n, 
          1}, {1/2 - 2*n, 1 + 2*(m - n), 1, 3/2 + 2*m}, 
         K])/((m - n)*(1 + 2*(m + n))), m > n}
  }

Manipulate[
 Plot[N[f[m, n, K], 32], {K, 0, 300}], {m, 0, 20, 1}, {n, 0, 20, 1}]

More the more, you must be aware of the properties of this function for the large values of K:

Plot[N[f[7, 0, K], 32], {K, 0, 1000}]

enter image description here

Posted 10 years ago

Hi again,

It seems that I have solved the problem with the expression of the integral in terms of the hypergeometric series. By a detailed expansion of the second series in the symbolic formula returned by Integrate, some rearranging of the terms, and taking a limit of Sin[pi*z]/z (with z being the factor in the denominator that is zero) when z tends to zero, one obtains the tripartite formula:

F[m,n,K_]:=(2^(-2 (1+m+n)) * K^(1/2+m+n) * Gamma[-(1/2)-m-n] * Gamma[1+m+n] * HypergeometricPFQ[{1+m+n,1+m+n},{3/2+2 m,3/2+2 n,2+2 m+2 n},K])/(Sqrt[?] * Gamma[3/2+2 m] * Gamma[3/2+2 n])+(HypergeometricPFQ[{1/2,1/2,1},{ 1/2-m-n,1+m-n,1-m+n,3/2+m+n},K])/(1+2 *(m+ n)) /; m[Equal]n

F[m,n,K_]:=(2^(-2 (1+m+n)) * K^(1/2+m+n)Gamma[-(1/2)-m-n] * Gamma[1+m+n] * HypergeometricPFQ[{1+m+n,1+m+n},{3/2+2 m,3/2+2 n,2+2 m+2 n},K])/(Sqrt[?] Gamma[3/2+2 m] * Gamma[3/2+2 n])+(Pochhammer[1/2,m- n]^2/(Pochhammer[1/2-m-n,m-n] * Pochhammer[1+m-n,m- n]*Pochhammer[1-m+n,m-n-1] * Pochhammer[3/2+m+n,m- n])) * (K^(m-n)) * ((-1)^(m-n+1)) * (HypergeometricPFQ[{1/2+m-n,1/2+ m-n,1},{1/2-2 * n,1+2 * (m-n),1,3/2+2*m},K])/((m-n) * (1+2 * (m+ n))) /; m>n

F[m,n,K_]:=F[n,m,K] /; m<n

Unfortunately, I am now surprised to see that such defined function does not get evaluated faster than the former expansion I had (at least for K < 1000). For K > 1000 both formulae are damned slow, and this is very bad news, because I need to do calculations for K > 10^4. So, perhaps the only advantage of the above formulation is that I don't have to worry about the number of terms to be summed in the expansions.

So, my new question is: Is there any method to speed up the evaluations (32 digits or more, and for K > 10^4)? Ideally, it would be nice to derive some asymptotic expansion valid for large K, and use it for calculations. However, attempts to apply a relevant Series[] command to the above expressions lead to error messages.

Leslaw

POSTED BY: Leslaw Bieniasz

Dear Leslaw,

If the number of problematic points is not large, then you can use Piecewise[] function to define the result of integration. So, for the problematic points you define specific values, but for the rest domain you use the exact formula obtained by Integrate[].

This is a sign for a pause :)

Posted 10 years ago

Hi,

Yes, the huge time is one big problem, apart from the uncertainty how many terms to sum. But I have BAD NEWS: Your trick produces wrong results!

I have tried the calculations again, and here are some values of the integral obtained by your trick:

for m=n=1, K=10:
0.15432194794717644427531871148044089860

for m=2,n=1, K=10: 0.175921073744037741410030108109402757600

The first value is correct. But the second value is identical to what one would obtain from the fully symbolic formula after omitting the term multiplied by Sin[pi*(m-n)]. This is understandable, since as a result of your trick the infinity is reduced to a finite value, which is then multiplied by Sin[pi*(m-n)]=0, giving zero.

The correct value should be: -0.009153189573949895158506406248625

So, it seems that we are back in the starting point. Any ideas?

Leslaw

POSTED BY: Leslaw Bieniasz

Sure, this formula is time consuming. I have tried it to Manipulate...

f[z_, m_, n_] := 1/2 \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(\[Mu] = 1\), \(\[Infinity]\)]\(
\*SuperscriptBox[\((\(-1\))\), \(n + m + \[Mu]\)] 
\*SuperscriptBox[\(Gamma[
\*FractionBox[\(\[Mu]\), \(2\)] + 
\*FractionBox[\(1\), \(2\)]]\), \(2\)] 
\*SuperscriptBox[\((
\*SqrtBox[\(z\)])\), \(\[Mu]\)]/\((Gamma[
\*FractionBox[\(\[Mu]\), \(2\)] + n - m + 1]*Gamma[
\*FractionBox[\(\[Mu]\), \(2\)] - n + m + 1]*Gamma[
\*FractionBox[\(\[Mu]\), \(2\)] - n - m + 
\*FractionBox[\(1\), \(2\)]]*Gamma[
\*FractionBox[\(\[Mu]\), \(2\)] + n + m + 
\*FractionBox[\(3\), \(2\)]])\)\)\)

Manipulate[
 Plot[f[z, m, n], {z, 0, 150}], {m, 0, 20, 1}, {n, 0, 20, 1}]

enter image description here

Unfortunately, it requests a huge ammount of time...

Posted 10 years ago
POSTED BY: Leslaw Bieniasz

So, do I understand properly that there is no way to obtain the integral values with 32 digits precision (or more)?

Sure, we can by using N[2,32]:

In[1]:= Integrate[
 BesselJ[N[2, 32]*n + 1/2, L]*
  BesselJ[N[2, 32]*m + 1/2, L]/Sqrt[L^2 + K], {L, 0, \[Infinity]}, 
 Assumptions -> 
  n \[Element] Integers && n >= 0 && m \[Element] Integers && m >= 0 &&
    K \[Element] Reals && K > 0]


Out[1]= (Gamma[
     0.50000000000000000000000000000000 + 
      1.0000000000000000000000000000000 m + 
      1.0000000000000000000000000000000 n] HypergeometricPFQ[{1, 1/2, 
      1/2}, {0.50000000000000000000000000000000 - 
       1.0000000000000000000000000000000 m - 
       1.0000000000000000000000000000000 n, 
      1.50000000000000000000000000000000 + 
       1.0000000000000000000000000000000 m + 
       1.0000000000000000000000000000000 n, 
      1.00000000000000000000000000000000 - 
       1.0000000000000000000000000000000 m + 
       1.0000000000000000000000000000000 n, 
      1.00000000000000000000000000000000 + 
       1.0000000000000000000000000000000 m - 
       1.0000000000000000000000000000000 n}, K])/(2 Gamma[
     1.00000000000000000000000000000000 + 
      1.0000000000000000000000000000000 m - 
      1.0000000000000000000000000000000 n] Gamma[
     1.00000000000000000000000000000000 - 
      1.0000000000000000000000000000000 m + 
      1.0000000000000000000000000000000 n] Gamma[
     1.5000000000000000000000000000000+ 
      1.0000000000000000000000000000000 m + 
      1.0000000000000000000000000000000 n]) + (K^(
    0.50000000000000000000000000000000 + 
     1.0000000000000000000000000000000 m + 
     1.0000000000000000000000000000000 n)
     Gamma[-0.50000000000000000000000000000000 - 
      1.0000000000000000000000000000000 m - 
      1.0000000000000000000000000000000 n] Gamma[
     1.00000000000000000000000000000000 + 
      1.0000000000000000000000000000000 m + 
      1.0000000000000000000000000000000 n]^2 Gamma[
     1.50000000000000000000000000000000 + 
      1.0000000000000000000000000000000 m + 
      1.0000000000000000000000000000000 n] \
HypergeometricPFQ[{1.50000000000000000000000000000000 + 
       1.0000000000000000000000000000000 m + 
       1.0000000000000000000000000000000 n, 
      1.00000000000000000000000000000000 + 
       1.0000000000000000000000000000000 m + 
       1.0000000000000000000000000000000 n, 
      1.00000000000000000000000000000000 + 
       1.0000000000000000000000000000000 m + 
       1.0000000000000000000000000000000 n}, \
{1.50000000000000000000000000000000 + 
       1.0000000000000000000000000000000 m + 
       1.0000000000000000000000000000000 n, 
      2.0000000000000000000000000000000 + 
       2.0000000000000000000000000000000 m + 
       2.0000000000000000000000000000000 n, 
      1.5000000000000000000000000000000 + 0.*10^-32 m + 
       2.0000000000000000000000000000000 n, 
      1.5000000000000000000000000000000 + 
       2.0000000000000000000000000000000 m + 0.*10^-32 n}, 
     K])/(2 \[Pi] Gamma[
     1.5000000000000000000000000000000 + 
      2.0000000000000000000000000000000 m + 0.*10^-32 n] Gamma[
     1.5000000000000000000000000000000 + 0.*10^-32 m + 
      2.0000000000000000000000000000000 n] Gamma[
     2.0000000000000000000000000000000 + 
      2.0000000000000000000000000000000 m + 
      2.0000000000000000000000000000000 n])

You use the composition Evaluate@Integrate. Will the code work the same if I first generate the formula using Integrate (and real coefficients), and next call Evaluate?

The meaning of Evaluate[] is to avoid repeated Integrate[] as you firstly Integrate[] and after Integration[] you assign the result to the function.

I still want to understand what is the reason of the error that occurs when evaluating the fully symbolic formula. Is there no method of finding out where the error actually arises? Some sort of tracing analysis?

I don't know exactly the properties of the function you investigate, but I think that it has discontinuity points which must be investigated by applying the Limit[]. When we use the approximate computations, we have the values near the discontinuity points. It's only my supposition! You must be aware of this!

You completely missed my point! My point was:

The general solution (so for every m and n) might not cover all cases for m and n.

not just specifically -1 in my example, that was just to show you that a general solutions might not cover all cases!

POSTED BY: Sander Huisman
Posted 10 years ago
POSTED BY: Leslaw Bieniasz
Posted 10 years ago
POSTED BY: Leslaw Bieniasz

I changed a little your formulas (2 by 2.) and obtained the following result:

In[37]:= Integrate[
 BesselJ[2.*n + 1/2, L]*BesselJ[2.*m + 1/2, L]/Sqrt[L^2 + K], {L, 
  0, \[Infinity]}, 
 Assumptions -> 
  n \[Element] Integers && n >= 0 && m \[Element] Integers && m >= 0 &&
    K \[Element] Reals && K > 0]

Out[37]= 1/2 ((
   Gamma[1/2 + 1. m + 1. n] HypergeometricPFQ[{1/2, 1, 1/
      2}, {1/2 - 1. m - 1. n, 3/2 + 1. m + 1. n, 1 - 1. m + 1. n, 
      1 + 1. m - 1. n}, K])/(
   Gamma[1 + 1. m - 1. n] Gamma[1 - 1. m + 1. n] Gamma[
     3/2 + 1. m + 1. n]) + (K^(1/2 + 1. m + 1. n)
       Gamma[-(1/2) - 1. m - 1. n] Gamma[1 + 1. m + 1. n]^2 Gamma[
       3/2 + 1. m + 1. n] HypergeometricPFQ[{1 + 1. m + 1. n, 
        3/2 + 1. m + 1. n, 1 + 1. m + 1. n}, {3/2 + 1. m + 1. n, 
        2 + 2. m + 2. n, 1.5 + 2. n, 1.5 + 2. m}, K])/(\[Pi] Gamma[
       1.5 + 2. m] Gamma[1.5 + 2. n] Gamma[2 + 2. m + 2. n]))

Now, I can animate the result:

f[m_, n_, K_] := 
 Evaluate@Integrate[
   BesselJ[2.*n + 1/2, L]*BesselJ[2.*m + 1/2, L]/Sqrt[L^2 + K], {L, 
    0, \[Infinity]}, 
   Assumptions -> 
    n lement] Integers && n >= 0 && m \[Element] Integers && 
     m >= 0 && K \[Element] Reals && K > 0]

t = Flatten@
   Table[Plot[f[m, n, K], {K, 0, 10}], {m, 0, 20, 1}, {n, 0, 20, 1}];

enter image description here

Hope, this will help you!

Posted 10 years ago
POSTED BY: Leslaw Bieniasz

It seems that all is ok but the result is not simple:

In[1]:= Integrate[
 BesselJ[2 n + 1/2, L] BesselJ[2*m + 1/2, L]/Sqrt[L^2 + K], {L, 
  0, \[Infinity]}, 
 Assumptions -> 
  n \[Element] Integers && n >= 0 && m \[Element] Integers && m >= 0 &&
    K \[Element] Reals && K > 0]

Out[1]= (2^(-2 (1 + Global`m + Global`n)) K^(
    1/2 + Global`m + Global`n)
     Gamma[-(1/2) - Global`m - Global`n] Gamma[
     1 + Global`m + 
      Global`n] HypergeometricPFQ[{1 + Global`m + Global`n, 
      1 + Global`m + Global`n}, {3/2 + 2 Global`m, 3/2 + 2 Global`n, 
      2 + 2 Global`m + 2 Global`n}, K])/(Sqrt[\[Pi]]
     Gamma[3/2 + 2 Global`m] Gamma[
     3/2 + 2 Global`n]) + (HypergeometricPFQ[{1/2, 1/2, 
      1}, {1/2 - Global`m - Global`n, 1 + Global`m - Global`n, 
      1 - Global`m + Global`n, 3/2 + Global`m + Global`n}, 
     K] Sin[(Global`m - Global`n) \[Pi]])/((Global`m - Global`n) (1 + 
      2 Global`m + 2 Global`n) \[Pi])
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard