2

I am trying to understand how Mathematica handles the Integral with complex limits.

NIntegrate[Exp[Sin[y]], {y, I, 2}]

How does NIntegrate works for this limits?

Erdem
  • 869
  • 4
  • 11
  • This question is closely related. Read the both answers in case of any doubts, namely you can choose any compact curve starting from I and ending in 2. – Artes Feb 07 '17 at 12:40

1 Answers1

5

You can use EvaluationMonitor to see what points were sampled:

{res,data}=Reap[NIntegrate[Exp[Sin[y]],{y,I,2},EvaluationMonitor:>Sow[y]]];

Here is a plot of the data showing that NIntegrate uses a straight line contour:

enter image description here

Graphics[{PointSize[Large],Red,Point@@ReIm@data},Axes->True,AxesLabel->{Re,Im}]

Compare this to choosing a different contour:

{res,data}=Reap[NIntegrate[Exp[Sin[y]], {y, I, I+2, 2}, EvaluationMonitor:>Sow[y]]];
Graphics[{PointSize[Large],Red,Point@@ReIm@data},Axes->True,AxesLabel->{Re,Im}]

enter image description here

Carl Woll
  • 130,679
  • 6
  • 243
  • 355