Problem Statement:
Given: $\vec B = (\rho cos \phi)\hat \rho+(sin \phi)\hat \phi$
Verify Stokes' Theorem by evaluating:
a) $ \oint\limits_c \vec B \bullet d\vec l$, where c represents the closed, counter-clockwise contour along the semicircle bounded by $x^2+y^2\le 4$ and $y\ge0$.
b) $\int_s(\nabla \times \vec B)\bullet d\vec s$, where s represents the surface enclosed by the semicircle bounded by $x^2+y^2\le 4$ and $y\ge0$.
What I understand:
The curl of $\vec B$ is given by: $\nabla \times \vec B={1 \above 1 pt \rho}({\partial \above 1 pt \partial \rho}(\vec B_\phi\rho)-{\partial \above 1 pt \partial \phi}(\vec B_\rho))\ \hat z$, since $\vec B$ has no $\hat z$ component. Thus,
$\nabla \times \vec B=({sin \phi \above 1pt \rho}+sin \phi)\ \hat z$
$\int_s(\nabla \times \vec B) \bullet d\vec s$
$\ =\int_0^\pi\int_0^2(\nabla \times \vec B)\ \rho\ d\rho d\phi$
$\ =\int_0^\pi\int_0^2 (\rho\ sin \phi+sin \phi)\ d\rho d\phi$
$\ =\int_0^\pi(4\ sin\phi)\ d\phi$
$\ =8$
The contour is piece-wise smooth and can be broken up into 3 parts:
c1- straight line from origin to $(2,0){_x} {_y}$
c2- semicircular arch from $(2,0){_x} {_y}$ to $(-2,0){_x} {_y}$
c3- straight line from $(-2,0){_x} {_y}$ to origin.
Thus,
$ \oint\limits_c \vec B \bullet d\vec l$
$\ =(\int{_c}{_1}\ \vec B \bullet d\vec l)+(\int{_c}{_2}\ \vec B \bullet d\vec l)+(\int{_c}{_3}\ \vec B \bullet d\vec l)$
$\ =(\int_0^2\rho\ cos\phi\ d\rho)|{_\phi}{_=}{_0}+(\int_0^\pi\rho\ sin\phi\ d\phi)|{_\rho}{_=}{_2}+(\int_2^0\rho\ cos\phi\ d\rho)|{_\phi}{_=}{_\pi}$
$\ =(\int_0^2\rho\ d\rho)+(\int_0^\pi2\ sin\phi\ d\phi)+(\int_2^0-\rho\ d\rho)$
$\ =(2)+(4)+(2)$
$\ =8$
So we have,
$ \oint\limits_c \vec B \bullet d\vec l = \int_s(\nabla \times \vec B) \bullet d\vec s$
What I don't understand:
My initial intuition was to split the contour into two parts:
c1- straight line from $(-2,0){_x} {_y}$ to $(2,0){_x} {_y}$
c2- semicircular arch from $(2,0){_x} {_y}$ to $(-2,0){_x} {_y}$
c2 will still yield 4 as before, but c1 does not yield 4 to total to 8. Instead,
$(\int^2_{-2}\rho\ cos\phi\ d\rho)|{_\phi}{_=}{_0}$
$\ =\int^2_{-2}\rho\ d\rho$
$\ =({\rho^2 \above 1pt 2})|^2_{-2}$
$\ =0$
This seems to make intuitive sense, since the flat line on the $x$ axis is centered at the origin and for the given vetor field every point $(a,0)$ has an equal and opposite vector at $(-a,0)$. Thus $\int_{cx}\ \vec B\bullet d\vec l$ should be equal to zero if $cx$ is a flat line on the x axis centered at the origin.
Clearly, however, this violates Stokes' Theorem, so please help me understand why there is a difference between my 2-piece and 3-piece definitions of the contour and why the line integral along the flat line on the $x$ axis should be 4 and not 0. Thanks!