# Indefinite vs. definite integration contradiction in Version 11.3 [closed]

When evaluating the same integral using indefinite integration (method 1) or definite integration (method 2) I get different answers: method 1 = 0 and method 2 = 10*Pi*I. Method 2 is the correct answer, however I need the result in the form of a function so I need correct answer for method 1. Any ideas on what the problem is?

METHOD 1:

Clear[r];

Clear[z0];

contour = z0 + r Exp[I theta];

f = (z - 3)^2*(z^3 + 1);

integrand = ((D[f, z] / f ) /. z -> contour)*D[contour, theta];

indefintegral = Integrate[integrand, theta];

defintegral = (indefintegral /. {r->5, z0 -> 0, theta -> 2*Pi})-
(indefintegral /. {r -> 5, z0-> 0, theta -> 0})


METHOD 2:

r = 5;

z0 = 3;

contour = z0 + r*Exp[I theta];

f = (z - 3)^2*(z^3 + 1);

integrand = ((D[f, z] / f ) /. z -> contour)*D[contour, theta];

defintegral = Integrate[integrand, {theta, 0, 2*Pi}]

• Your indefinite integral expression may have discontinuities, in which case substituting the limits in the indefinite integral expression gives incorrect results, which are avoided by the definite integral calculation. This is discussed in the "Possible Issues" subsection of the Integrate docs. See also: Definite and Indefinite integral give different results for piecewise function. Jun 19 '18 at 15:55
• If you do the subsittution for r and z0 into indefintegral, then plot the real and imaginary parts over theta, you will see the latter has discontinuities. Basically this is what @MarcoB surmised. Jun 19 '18 at 16:14
• Possible duplicate of Definite and Indefinite integral give different results for piecewise function Jun 19 '18 at 18:00
• OK, perhaps, but I plotted the real and imaginary parts of the integrand (from method 1) using values r=5 and z0 = 0. As expected, it is easily visually seen the real part will integrate to 0 while imaginary part integrates to a positive number. No obvious discontinuity in real part. Further, this is a simple application of the argument principle in complex analysis. The integrand itself contains only a polynomial in the denominator, so it has 5 poles that are interior to the contour (a circle of radius 5). The integrand must be holomorphic on the contour of integration. Am I wrong?
– Karl
Jun 20 '18 at 1:43
• Ok I'am not very strong in contour integration,but we can easily visually seen: Plot[indefintegral /. {r -> 5, z0 -> 0} // Im, {theta, 0, 2 Pi}]` obvious discontinuity in imaginary parts. Jun 20 '18 at 8:32