18

I can't find how to calculate path integrals of complex functions in the complex plane.

For example: $$\oint_{\mid z \mid =2}\frac{1-e^z+z}{z^3 (z-1)^2}dz$$

Michael E2
  • 235,386
  • 17
  • 334
  • 747

2 Answers2

26

For this function:

f[z_] := (1 - E^z + z)/(z^3 (z - 1)^2)

there are no branch cuts in the complex plane therefore we simply use Cauchy integral theorem and the related formula of the complex residue, i.e. we sum up residues of the function $f$ in the circle $\mid z \mid =2$. Let's denote $$int = \oint_{\mid z \mid =2}\frac{1-e^z+z}{z^3 (z-1)^2}dz$$ Now we have:

int = 2 Pi I Total[ Residue[f[z], {z, #}] & /@ {0, 1}] // Simplify
 I (-11 + 4 E) Pi

Alternatively we can parametrize z over the given circle z -> 2 E^(I t):

(1 - E^z + z)/(z^3 (z - 1)^2) /. z -> 2 E^(I t)
(E^(-3 I t) (1 - E^(2 E^(I t)) + 2 E^(I t)))/(8 (-1 + 2 E^(I t))^2)

and d z -> 2 I E^(I t) d t, now we have:

Integrate[(E^(-3 I t)(1 - E^(2 E^(I t)) + 2 E^(I t)))/( 8(-1 + 2 E^(I t))^2) 2 I E^(I t), 
          {t, 0, 2 Pi}]
I (-11 + 4 E) Pi 
% // TraditionalForm

enter image description here

Artes
  • 57,212
  • 12
  • 157
  • 245
20

If a numerical answer is good enough you can just enter the path. As @Artes said it doesn't have to be the circle exactly.

NIntegrate[f[z], {z, 2 - 2 I, 2 + 2 I, -2 + 2 I, -2 - 2 I, 2 - 2 I}]
(* 0. - 0.398582 I *)

Check :

I (-11 + 4 E) Pi // N
(* 0. - 0.398582 I *)

Another suggestion from @Artes (thanks !) : one can use symbolic integration as well and

Integrate[f[z], {z, 2 - 2 I, 2 + 2 I, -2 + 2 I, -2 - 2 I, 2 - 2 I}] // FullSimplify

will reproduce his result.

b.gates.you.know.what
  • 20,103
  • 2
  • 43
  • 84
  • I upvoted your answer, I think it shouldn't be deleted since as far as I know this way of computing integrals couldn't be found in documentation. – Artes Nov 14 '13 at 15:16
  • 2
    @Artes, FYI this usage is the third bullet point under Details and Options for NIntegrate. – chuy Nov 14 '13 at 15:29
  • 2
    @chuy Thanks, in fact there is it, but what about Integrate? Perhaps there is it somewhere, but couldn't find it. – Artes Nov 14 '13 at 15:34