# How would you calculate a contour integral? [duplicate]

How would you be able to calculate a contour integral of 1/(((z-1)^2)*(z-i)) over the contour |z-1| = 1? Not sure how to type that in :/

## 2 Answers

With

f[z_] := 1/((z - 1)^2*(z - I))


the contour integral around a circle centered at z == 1 can be parameterized by arc length around the circle.

Integrate[(f[z] /. z -> 1 + Cos[t] + I Sin[t]) D[1 + Cos[t] + I Sin[t], t],
{t, 0, 2 Pi}]
(* π *)


which, of course, is equal to the residue at z == 1, multiplied by 2 π I. (The pole at z == I is outside the contour and so does not contribute to the integral.)

Alternatively, the integral can be performed over a region.

reg = ParametricRegion[{1 + Cos[t], Sin[t]}, {{t, 0, 2 Pi}}];
Integrate[(f[z] /. z -> x + I y) (-y + I (x - 1)), {x, y} ∈ reg]


which gives the same result. (-y + I (x - 1)) is the equivalent of D[1 + Cos[t] + I Sin[t], t].

Let me know if your answer matches with the one using

f[z_] := 1/((z - 1)^2*(z - I))

Int[a_] := 2*Pi*I*Total[(Residue[f[z], {z, #1}] & ) /@ {0, a}]


So for a=1, you get Pi

• didn't do anything :/ – John Oct 11 '15 at 0:15
• What is your expected answer @Alex – thils Oct 11 '15 at 0:16
• well I did my integral by hand and just wanted to confirm my answer, I got pi when computing my integral – John Oct 11 '15 at 0:25
• Sorry, I didn't notice the a part. Thank you!! Just wanted to confirm – John Oct 11 '15 at 0:25
• I would give you an up vote but I need to be 15 rep to do that :c – John Oct 11 '15 at 0:26