# Calling Integrate with many limits of integration

I accidentally discovered that you can put many numbers into the limits of integration of Integrate and Mathematica will still evaluate it without returning an error message:

Integrate[x^2, {x, 0, 46, 53, -1, 2}]


returns 8/3. Mathematica seems to ignore all the numbers except for the first and last ones. Do the middle numbers ever affect the result in some way that I haven't noticed, or are they completely irrelevant? I don't see anything in the documentation about this.

Update: The same thing happens with NIntegrate. Trace doesn't help, but it appears that Mathematica is evaluating each integral connecting consecutive bounds of integration in the list. The integral takes longer to calculate when you add in extra numbers into the limits list, and

Integrate[1/x, {x, 1, -1, 2}]


returns

Integrate::idiv: "Integral of 1/x does not converge on {1,-1}"


even though the integral converges if you ignore the intermediate numbers.

Update 2: The behavior appears to have something to do with specifying integration contours.

Integrate[1/x, {x, -1, I, 1}]


returns -I Pi while

Integrate[1/x, {x, -1, -I, 1}]


returns I Pi.

Table[Integrate[z^-n/(1 - z - z^2), {z, 1/2, I/2, -1/2, -I/2, 1/2}]/(2 π I),

• Also, your example doesn't really need a specified contour at all - you can just do Table[Residue[z^-n/(1 - z - z^2), {z, 0}], {n, 5}] :) – tparker Mar 29 '16 at 7:09
• Yes, Residue[] would be the more readable procedure (and SeriesCoefficient[] the most convenient); since you were asking about Integrate[], I brought out one of my usual examples. This is another one. – J. M. will be back soon Mar 29 '16 at 7:15