I would like to compute the following integral $I(k)$ in Mathematica to check if the result equals something I 'feel' is correct but I have no experience with contour integrals in Mathematica.

I want to compute $$ I(k) = \frac{k}{4\pi}\int_\gamma \log(t) \frac{1}{\sqrt{1-t}} J_1(k\sqrt{1-t}) dt,$$ where $k > 0$, $J_1$ is the Bessel function of the first kind and where $\gamma$ is a contour starting at $1$ and ending at $-\infty$ which does not contain the origin.

I have a feeling this should have some relation to the function $H_0^{(1)}(k)$ which is the is the Hankel function of the first kind of order $0$.

Edit: I noticed I was missing the $\log(t)$ term in the integral after a comment by Carl.

  • $\begingroup$ Just write down all intermediate points inside Integrate iterator. For example, answ= 1 - k/2 Integrate[ 1/Sqrt[1 - t] BesselJ[1, k Sqrt[1 - t]], {t, 1, 1/2, I/2, -I/2, -1/2, -Infinity}, Assumptions -> k > 0] After simplification it yields answ=2. $\endgroup$
    – Acus
    Jul 20, 2019 at 15:17
  • $\begingroup$ Since you effectively changed the question completely due to the missing term, I suggest starting a new question with the correct integral. Otherwise, It is not fair to the person who answered you using your original integral, and keep this question the way it was before. $\endgroup$
    – Nasser
    Jul 21, 2019 at 4:36
  • $\begingroup$ They didn't answer my question my question which specifically was on how to integrate from $-\infty$ to $1$ while avoiding the origin, i.e. how to do contour integration. Their answer features an incorrect path of integration - integration from $-\infty$ to $0$ which is just a standard line integral, something I already know how to do. However, their subsequent comment was helpful as it made we realise I was missing a term in the integral. $\endgroup$
    – sonicboom
    Jul 21, 2019 at 6:08

1 Answer 1


Mathematica can do the integral analytically:

1 - k/2 Integrate[1/Sqrt[1-t] BesselJ[1, k Sqrt[1-t]], {t, -Infinity, 0}, Assumptions->k>0]

1 - BesselJ[0, k]

I believe the $H_0^1$ function you are referring to is called the HankelH1 function in Mathematica (check the Wolfram Language code in the copyable plain text button in the WA link you provided). In that case, note:

FunctionExpand[HankelH1[0, k]]

BesselJ[0, k] + I BesselY[0, k]

So, your integral is related by the equation $i(k)=1-\Re(H_0^{(1)}(k))$.

  • $\begingroup$ Thanks but the contour actually has to 'arc around' 0, i.e., it has to go from $-\infty$ to $1$ without passing over zero. $\endgroup$
    – sonicboom
    Jul 20, 2019 at 17:26
  • 1
    $\begingroup$ @sonicboom Since your function has no singularity at the origin, why are you trying to 'arc around' it? $\endgroup$
    – Carl Woll
    Jul 20, 2019 at 17:47
  • $\begingroup$ You are correct, I just realised I am missing a $\frac{1}{2\pi}\log(t)$ in the integral! I will edit my original post. $\endgroup$
    – sonicboom
    Jul 20, 2019 at 19:23
  • $\begingroup$ I am now back home and have access to Mathematica. It seems it can't evaluate the integral at all now that I have included the logarithmic term. Even just trying to evaluate the indefinite integral is failing, I might have to just try and do it numerically with NIntegrate and plot it instead. $\endgroup$
    – sonicboom
    Jul 20, 2019 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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