0
$\begingroup$

I am solving some integral which gives an hypergeometric function+gamma function . The point is that my values of n (see the code below) are integers, so n = 1,2,3,4.... But it gives complex singularity when I want to introduce the value of n in the expression once the integral has been already computed.

f[r_, k_, kl_, n_] := Sin[k*kl*r]/(k^2*r)*k^-n
Integration[r_, kl_, n_, m_] := 
 Assuming[{kl > 0, n > 0, r > 0, m > 0}, 
   Integrate[f[r, k, kl, n], {k, 1, m}]] // FullSimplify

function[r_] := Integration[r, kl, n, Infinity] // FullSimplify
function[r]

The result is :

-kl (kl r)^n Cos[(n \[Pi])/2] Gamma[-1 - n] + (
 kl HypergeometricPFQ[{-(n/2)}, {3/2, 1 - n/2}, -(1/4) kl^2 r^2])/n

So Mathematica can solve the integral for any value of n. But when I substitue in this expression the value of n that I want then I get a singularity (of course, due to the gamma function and the hypergeometric function)

-kl (kl r)^n Cos[(n \[Pi])/2] Gamma[-1 - n] + (
  kl HypergeometricPFQ[{-(n/2)}, {3/2, 1 - n/2}, -(1/4) kl^2 r^2])/
  n /. n -> 2

I get

Infinity::indet: Indeterminate expression ComplexInfinity+ComplexInfinity encountered.

But I don't undersrtand, since If I perform the integral given the value of n already, then I get an analityical expression for that

f[r_, k_, kl_, n_] := Sin[k*kl*r]/(k^2*r)*k^-n
Integration[r_, kl_, n_, m_] := 
 Assuming[{kl > 0, n > 0, r > 0, m > 0}, 
   Integrate[f[r, k, kl, n], {k, 1, m}]] // FullSimplify

function[r_] := Integration[r, kl, 2, Infinity] // FullSimplify
function[r]

I get:

(kl r Cos[kl r] + 
 kl^3 r^3 CosIntegral[kl r] + (2 - kl^2 r^2) Sin[kl r])/(6 r)

And there is not any kind of singularity in this expression. So my question is: There is some way to get a general expression in terms of the variable n, without get a singular behaviour as happens due to the Gamma and the Hypergeometric function? Mathematica can simplify this expression in order to cancel the divergences?

$\endgroup$
  • $\begingroup$ I am currently not at a machine with Mathematica to check, but a cursory look at your integrand tells me that you could try using the complex exponential representation of $\sin$ to derive an expression in terms of the generalized exponential integral $E_p(z)$ (which Mathematica implements as ExpIntegralE[]). $\endgroup$ – J. M. is in limbo Feb 18 '19 at 14:25
4
$\begingroup$

If you add a further condition Element[n, Integers] in Integration, then the integral for $m=\infty$ returns exponential integral functions, not singular hypergeometric/Gamma functions:

f[r_, k_, kl_, n_] := Sin[k*kl*r]/(k^2*r)*k^-n
Integration[r_, kl_, n_, m_] := 
  Assuming[{kl > 0, n > 0, r > 0, m > 0, Element[n, Integers]}, 
    Integrate[f[r, k, kl, n], {k, 1, m}]] // FullSimplify

function[r_] := Integration[r, kl, n, Infinity] // FullSimplify
function[r]

(I (-ExpIntegralE[2 + n, -I kl r] + ExpIntegralE[2 + n, I kl r]))/(2 r)

This should solve your problem.

Further, if you use direct assignments = instead of delayed assignments := then your code only has to do one integration instead of a new one for every value of $m$.

$\endgroup$
  • $\begingroup$ Okay thank your very much!! $\endgroup$ – Joe Feb 18 '19 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.