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?
ExpIntegralE[]
). $\endgroup$