# Vector field change of variables

1. Mar 23, 2009

### ballzac

1. The problem statement, all variables and given/known data
I just need to be able to change a vector field from spherical to cartesian
The question is about verifying stokes theorem (curl theorem) for a given vector field within and on a given path. It says not to use spherical coordinates, but the vector field is given in spherical coordinates.

2. Relevant equations

3. The attempt at a solution
I tried using the equations that relate r, theta, and phi to x, y, and z. One thing is, that it gets very messy, and I don't think it's meant to be. Another thing is that I don't know what to do with the unit vectors, as I have components that are (now) functions of x, y, and z but are pointing in the r, theta, and phi directions. I gather if I fixed that up, the messyness would disappear, but I don't know how to do it.

I also considered finding the curl in spherical coordinates and then using a Jacobian determinant to evaluate the integral, but I thought this might be kind of cheating.

If I can figure out how to change the vector field from spherical coordinates to cartesian I will have no trouble doing the integrals. I have a feeling I would've learnt this in first or second year calculus, but I can't remember :( Any help would be appreciated.

2. Mar 23, 2009

### lanedance

hi ballzac

i think you're correct you need to change the spherical unit vectors into cartesian unit vectors, have a look at this
http://en.wikipedia.org/wiki/Unit_vector

once you substitute in for the unit vectors and the variables, you should be left with a vector in terms of x,y,z and the cartesian unit vectors

you can always check your answer with the spherical form of the curl operator

3. Mar 23, 2009

### ballzac

Thanks for that. I'm still having a lot of trouble because it gets so complicated when I start changing the variables. There must be an easier way. Anyway, I think maybe if I just change the unit vectors (thanks to the link you posted), and leave the variables in polar form, then I can still maybe work it out in cartesian coordinates. Haven't thought this one through, but it might work. Thanks again for the help. I'll keep working on this...

4. Mar 23, 2009

### ballzac

I'm going back to trying to change all the variables. One problem is that I have terms that are like sin(arcos(z/r)) this is obviously a projection of r in the x,y plane, but I don't know how to describe it precisely in cartesian coords because I don't know what phi direction it points in, arggg. This is causing me problems, lol.

EDIT: I've found a list of trigonometric identities on wiki that has trig functions of inverse trig functions, and this seems to be simplifying quite dramatically, so we'll see how it goes.

Last edited: Mar 23, 2009
5. Mar 23, 2009

### lanedance

can you post the original vector field?

6. Mar 23, 2009

### ballzac

certainly,

$$\textbf{f(r)}=r cos^2\theta\textbf{\hat{r}}-r cos\theta sin\theta\textbf{\hat{\theta}}+3r\textbf{\hat{\varphi}}$$

WTF? I typed it in tex, and when previewing it it has come up as something completely different. In fact it looks like something I typed in a completely different thread once. ??? Very strange. Anyway, in case it doesn't come up properly above (if it contains A and a it is not the right thing)... here it is

f(r)=rcos^2(theta)r_hat-rcos(theta)sin(theta)theta_hat+3rphi_hat

It is actually problem 1.56 in griffiths "Introduction to electrodynamics", which in the solution manual is done in spherical coordinates, hence why we're not allowed to use them.

Last edited: Mar 23, 2009
7. Mar 24, 2009

### ballzac

Here is the question
https://www.physicsforums.com/attachment.php?attachmentid=18133&stc=1&d=1237876170
After this it says not to use spherical coordinates, but I didn't scan that.

I have tried to calculate what the field is in cartesian coordinates, and after substituting the equations for the variable and the unit vectors, I cam up with this (the bit circled in red is the field that I calculated...sorry if the rests so messy. I thought I'd leave it in to a t least show a little bit of how I got to the final bit.)
https://www.physicsforums.com/attachment.php?attachmentid=18132&stc=1&d=1237876170
Underneath you can see that I started calculating the line integral for what I labeled as segment 1. Then (I didn't scan this bit) I tried to do segment 2, but x is zero along segment 2, and there are two integrals for the second part, one for the y direction and one for z. In the y part, you can see that I end up needing to divide by zero when I set x=0.

I'm sure that it's not meant to be this complicated. I can't imagine how difficult it would be to get the curl the way I'm doing it.

EDIT:Damn, the pics don't seem to be working. EDIT2: Oh I see, duh.

Oh, also, I left r in the equations where it still exists just for brevity.

Yet another edit: I am getting somewhere. I'm sure I can (and will need to) simplify it further, but now I have

$$-3y\sqrt{x^2+y^2+z^2/(x^2+y^2)}\hat{\textbf{x}}+3x\sqrt{x^2+y^2+z^2/(x^2+y^2)}\hat{\textbf{y}}+z\hat{\textbf{y}}$$

And for the grand finale...I've got the left hand side done and I know it's right because it agrees with the version in the book done in spherical coordinates. I should be okay from here. Thanks again for the help.

#### Attached Files:

File size:
29.5 KB
Views:
113
• ###### q3.jpg
File size:
26.2 KB
Views:
148
Last edited: Mar 24, 2009
8. Mar 24, 2009

### lanedance

Hi Ballzac

I just had a go and after substitution and cancelling get to:
$$-3r.sin(\phi).\hat{x} + 3r.cos(\phi) .\hat{y} + r.cos(\theta).\hat{z}$$

edit: ok - you're all good, cool