# How do I find line integrals?

For example, how can I calculate

$$\int_{\left | z \right |=1}\frac{dz}{z}$$

I know that the answer is $2\pi i$ but how do I do it using Mathematica?

-
Parametrize the range of integration. Then make sure you properly rewrite dz using the chain rule. (@Nasser gave a response with explicit detail in case this is not clear.) –  Daniel Lichtblau Aug 23 '13 at 23:08

If you want to calculate this integral with Mathematica use beautiful (and very powerful!)$\;$ Cauchy Integral Formula implying an adequate theorem of Complex Residue. Thus we have $$\int_{\left | z \right |=1}\frac{dz}{z}= 2\pi i\; Res_{z_{0}=0} f$$ where $f(z)=\frac{1}{z}$.

We can find the residue at $z_0=0$ of $f(z)$ in Mathematica with Residue:

Residue[1/z, {z, 0}]

1


therefore:

$$\int_{\left | z \right |=1}\frac{dz}{z}= 2\pi i$$

-
z = Exp[I t];
dz = D[z, t];
Integrate[(1/z) dz, {t, 0, 2 Pi}]


The idea is to convert it to complex contour integration.

-
This is incorrect, dt is "infinitesimal" while D[z[t],t] is not (in dt = D[z[t], t]), etc... –  Artes Aug 23 '13 at 23:08
@Artes, so I assume you do not want the first way of expression it? i.e. use explicit function? Will remove the function, and keep the expression. no problem. –  Nasser Aug 23 '13 at 23:14
You could write dz = D[z, t] dt but you musn't write dz = D[z, t]. Next Integrate[(1/z) dz, {t, 0, 2 Pi}] doesn't make sense. –  Artes Aug 23 '13 at 23:17
Now, your approach is more appropriate, unfortunately using this symbol dz it seems to be a differential while it seems you are using it in a different context. You haven't demonstrated seamlessly why you change $\frac{dz}{z}$ to another function using the same symbols. –  Artes Aug 24 '13 at 10:11