I am trying to calculate $\int_{-i}^{i}$$\mid$$z$$\mid$$dz$, along the straight line segment joining the endpoints $i$ and $-i$.
I have calculated a result but it confused me. Here is my calculation:
Since $\mid$$z$$\mid$ is hard to deal with, we parametrize $z=re^{i\theta}$, since the upper and lower level of the integral is purely imaginary, we let $r=1$.
Then, we have $dz=ie^{i\theta}d\theta$, and $\mid$$z$$\mid$$=1$, and we need to integrate it from $\frac{3\pi}{2}$ to $\frac{\pi}{2}$.
Now the integral becomes to $\int_{\frac{3\pi}{2}}^{\frac{\pi}{2}}$$ie^{i\theta}d\theta$.
Then it will give me the answer of $-2$.
However, do I really integrate along the straight line segment if I did this?
Also, if I argue that the primitive of $\mid$$z$$\mid$ is $\frac{1}{2}$$\mid$$z$$\mid^{2}$, and thus directly plug in $-i$ and $i$, and subtract them, I had the integral $=0$ in the end.
So, what is wrong?
Thank you so much!
You need to integrate over $r$ instead (as the argument $\mod\pi$ doesn't change you can parenthesize by $z=re^{\pm\frac\pi 2 i}$), so $$\int_{L_{-i,i}}|z|dz=\left(\int_{L_{-i,0}}+\int_{L_{0,i}}\right)(|z|dz)=-i\int_{-1}^0rdr+i\int_0^{1}rdr=2i\int_0^1rdr=i.$$