2

I want to numerically integrate the following function

$$f(p) = \frac{1}{2\pi i}\int_{\Gamma}\frac{1}{p}\exp\left(\frac{a^{2}}{2}\frac{1}{p}+\frac{b^{2}}{2}p\right)dp$$

where the contour $\Gamma$ is a circle with radius $r$ less than unity and let a and b to be unity

I wrote it like this on Mathematica, but I don't know a possible way to write the integral limits

NIntegrate[1/(2*Pi*I*p)*Exp[1/(2*p) + 1/2*p], {p, ,]
J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574

1 Answers1

3

Edit: Posted for review.. I'm not sure if this is correct.

making the substitution per comments, p=r Exp[I t] so that dp == r I Exp[I t] dt == I p dt :

With[{r = 2, a = 1, b = 1}, (1/ (2 Pi I)) NIntegrate[
   I Exp[a^2/(2 (r Exp[I t])) + b^2/2 (r Exp[I t])],
   {t, 0 , 2 Pi}]]

1.26607 + 4.24074*10^-15 I

(Note this agrees with the BesselI[0, 1] result per comments)

for the record I first though we could use the region integrate capability:

With[{r = 2, a = 1, b = 1}, 
    (1/ (2 Pi I)) NIntegrate[
       1/((x + I y))*Exp[a^2/(2*(x + I y)) + b^2/2*(x + I y)],
       Element[{x, y}, Circle[{0, 0}, r]]]]

2.82716*10^-16 - 1.13032 I

which is the same result as we get with the first sub but with dp/dt = r:

With[{r = 2, a = 1,  b = 1},
   (1/ (2 Pi I)) NIntegrate[
   1/(Exp[I t])*Exp[a^2/(2*(r Exp[I t])) + b^2/2*(r Exp[I t])],
   {t, 0 , 2 Pi}]]

7.0679*10^-17 - 1.13032 I

george2079
  • 38,913
  • 1
  • 43
  • 110
  • Note that BesselI[1,1] is approximately $0.565159 \approx \frac{1}{2}( 1.13032)$. So your second and third expressions are not giving the same result, probably because the two integrals aren't over the same circle ($r = 2$ for the second, $r = 1$ for the third.) – Michael Seifert May 19 '16 at 18:15
  • right, the first two run with r=1 agree with the BesselI result for r=1 ( That is they are all 3 right or all three wrong ! ) – george2079 May 19 '16 at 18:46
  • See this page for what looks to be the exact integral in question (with $a = b = 1$ in our integral and $z = 1, n = 0$ in that expression.) Note that this implies that the correct answer should be $I_0(1) \approx 1.26607$, which suggests to me that the last answer is the correct one and the first three are wrong. (Not sure why, though.) – Michael Seifert May 19 '16 at 19:03
  • On further reflection, I suspect that's what's happening here is that the integration over regions implicitly assumes a line element of the form $dl = \sqrt{dx^2 + dy^2}$ (or $dl = \sqrt{dr^2 + r^2 , d\theta^2}$) as we integrate around the curve. But for a complex integral in the complex plane, we should be using $dl = dx + i dy$ instead (or $dl = e^{i\theta} dr + i r e^{i\theta} , d\theta$.) – Michael Seifert May 19 '16 at 19:18
  • @MichaelSeifert i think that's right, reordered the results in the answer. – george2079 May 20 '16 at 16:53