# Integrate with complex limits

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?

• 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 7 '17 at 12:40

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:

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}]