# Homework Help: Line integral in spherical coordinates

1. Nov 9, 2015

### Incand

1. The problem statement, all variables and given/known data
The vector field $\vec B$ is given in spherical coordinates
$\vec B(r,\theta,\phi ) = \frac{B_0a}{r\sin \theta}\left( \sin \theta \hat r + \cos \theta \hat \theta + \hat \phi \right)$.
Determine the line integral integral of $\vec B$ along the curve $C$ with the parametrization $C: \vec r = (a \cos \alpha, 2a\sin \alpha , \frac{a\alpha}{\pi})$ from $(a,0,0)$ to $(a,0,2a)$.

2. Relevant equations
Possibly of use
$d\vec r = \sum_1^3 h_i \vec e_i du_i = \frac{d\vec r}{dr}dr +\frac{d\vec r}{d\theta}d\theta +\frac{d\vec r}{d\phi}d\phi$.

3. The attempt at a solution

I'm assuming $C$ is given in Cartesian coordinates since nothing else is said. We note that in our parametrization we have $\alpha \in (0,2\pi)$. We want to calculate
$\int_C \vec F \cdot d\vec r$.
So as I see it I need to either convert the vector field into Cartesian coordinates which looks like a lot of work and probably not the purpose of the exercise or find a way to express the parametrisation in spherical coordinates and then figure out how to integrate that.

One approach would be to get the $(r,\theta,\phi)$ coordinates by the formulas
\begin{cases}
r = \sqrt{x^2+y^2+z^2}\\
\theta = \arccos \frac{z}{\sqrt{x^2+y^2+z^2}}\\
\phi = \arctan \frac{y}{x}
\end{cases}
which seems to give me even worse equations. Any hints on how to get started?

2. Nov 9, 2015

### LunaFly

It may be helpful to think about the path you are integrating on. It starts at (a, 0, 0) and ends at (a, 0, 2a)... What does the path look like?

3. Nov 9, 2015

### Incand

Like an "elliptic helix". I thought about this as well but didn't see how it really helped. Cylindrical coordinates seems to fit this a lot better than the spherical that I have for the vector field.

4. Nov 20, 2015

### Incand

I think I'm getting closer to the answer on this one but I'm not there yet.

Rewriting the basis vector in Cartesian coordinates we have
$\sin \theta \hat r = \sin^2 \theta \cos \phi \hat x + \sin^2 \theta \sin \phi \hat y + \sin \theta \cos \theta \hat z$
$\cos \theta \hat \theta = \cos^2\theta \cos \phi \hat x + \cos^2\theta \sin \phi\hat y -\cos\theta \sin \theta \hat z$
$\hat \phi = -\sin \phi \hat x + \cos \phi \hat x$.
Adding this up we have $B(r,\theta ,\phi ) = \frac{B_0a}{r\sin \theta}\left( (\cos \phi -\sin \phi) \hat x + (\sin \phi + \cos \phi) \hat y \right)$

We note that $\alpha \in (0,2\pi)$ and that $\alpha = \phi$. Calculating $\frac{d\vec r}{d\phi}d\phi = a(-\sin \phi, 2\cos \phi,\frac{1}{\pi})d\phi$. Hence we have the integral
$B_0a^2 \int_0^{2\pi} \frac{\sin^2 \phi - \sin \phi \cos \phi + 2\cos^2 \phi + 2\cos \phi \sin \phi }{r\sin \theta} d\phi = B_0a^2 \int_0^{2\pi} \frac{\cos^2 \phi +1 +\cos \phi \sin \phi}{r\sin \theta} d\phi$.

Next we note that $r\sin \theta = \rho = a\sqrt{\cos^2 \phi + 4\sin ^2\phi} = a\sqrt{1+3\sin^2 \phi}$. The integral should then be
$B_0a \int_0^{2\pi} \frac{\cos^2 \phi +1 +\cos \phi \sin \phi}{\sqrt{1+3\sin^2 \phi}}$. An integral that is quite beyond me but wolfram alpha give the numerical answer $~8.1B_0a$ and I'm supposed to get $2\pi a B_0$ and looking through my calculations several times for errors I can't find any.

5. Nov 27, 2015

### Incand

I managed to solve this now so I thought I add the solution in case anyone else happens upon this thread.

The field can be rewritten in polar coordinates as
$\vec B = \frac{B_0a}{\rho}(\hat \rho + \hat \phi)$.
Using that $\rho = a\sqrt{cos^2(\phi)+4sin^2(\phi)}$ we have that $\frac{d\rho}{d\phi} = \frac{3a\sin \phi \cos \phi}{\sqrt{cos^2(\phi)+4sin^2(\phi)}}$ So for the $\rho hat$ component we have
$B_0a \int_0^{2\pi} \frac{3a}{cos^2(\phi)+4sin^2(\phi)}d\phi = 0$.
While in the $\hat \phi$ component we have
$B_0a \int_0^{2\pi} \frac{1}{\rho}\rho d\phi = 2\pi B_0a$.

Another way of getting the same result with less work would be to notice we have a line charge and a line current of strength $2\pi B_0a$ . Since the field got no $\hat z$ component it's for our purpose a closed loop and we then get the contribution of $2\pi B_0a$ from the line current while the line charge doesn't contribute.