How to integrate a vector function in spherical coordinates?
In my specific case, it's an electric field on the axis of charged ring (see image below), the integral is pretty easy, but I don't understand how handle the vector $(r,\theta,\phi)$ while integrating over $\phi$.
I tried the following:
$$\vec{E}=\int\limits_{Q}{\frac{kdq}{\|\vec{r}\|^3}\vec{r}}$$ $$ =\int_0^{2\pi}{\frac{k\lambda \vec{r}sin\theta d\phi}{\|\vec{r}\|^3}\vec{r}}$$ $$ =\int_0^{2\pi}{\frac{k\lambda Rd\phi}{\|\vec{r}\|^3}\vec{r}}$$ $$ =\frac{k\lambda R}{\|\vec{r}\|^3}\int_0^{2\pi}{\vec{r}d\phi} $$
Now, if I convert $\vec{r}$ to $(x,y,z)$ coordinates and integrate it's ok:
$$\int_0^{2\pi}{\vec{r}d\phi}=\int_0^{2\pi}{r(sin\theta cos\phi,sin\theta sin\phi,cos\theta)d\phi} = 2\pi r(0,0,cos\theta)=2\pi z\hat{z} $$
Putting it in the original expression will give the correct result.
But trying to do the following in spherical coordinates failed:
$$\int_0^{2\pi}{\vec{r}d\phi}=\int_0^{2\pi}{(r,\theta,\phi)d\phi} = {2\pi(r,\theta,\pi)} $$
Which is completely wrong...