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}]
Integratedocs. See also: Definite and Indefinite integral give different results for piecewise function. $\endgroup$randz0intoindefintegral, then plot the real and imaginary parts overtheta, you will see the latter has discontinuities. Basically this is what `@MarcoB surmised. $\endgroup$Plot[indefintegral /. {r -> 5, z0 -> 0} // Im, {theta, 0, 2 Pi}]obvious discontinuity in imaginary parts. $\endgroup$