I solve an integral that yields a hypergeometric function + gamma function. The point is that my values of `n`

(see code below) are integers, so `n = 1,2,3,4 ...`

, But there is complex singularity if I want to introduce the value of `n`

in the expression, if the integral has already been calculated.

```
f[r_, k_, kl_, n_] : = Sin[k*kl*r]/ (k ^ 2 * r) * k ^ -n
integration[r_, kl_, n_, m_] : =
Accepted,[{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 every value of `n`

, But if I use the value of this expression `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: Undefined expression of ComplexInfinity + ComplexInfinity.`

But I do not underestimate, as I attribute the integral to the value of `n`

Well, then I get an analistic expression for it

```
f[r_, k_, kl_, n_] : = Sin[k*kl*r]/ (k ^ 2 * r) * k ^ -n
integration[r_, kl_, n_, m_] : =
Accepted,[{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 no singularity in this expression. So my question is: There is a way to get a general expression in terms of the variable `n`

without getting a singular behavior as it happens through the gamma and the hypergeometry function? *Mathematica* Can this term be simplified to remove the differences?