# Vector field change of variables

#### ballzac

1. Homework Statement
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. Homework 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.

Related Calculus and Beyond Homework Help News on Phys.org

#### lanedance

Homework Helper
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

#### ballzac

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
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...

#### 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:

#### lanedance

Homework Helper
can you post the original vector field?

#### 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:

#### 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.

#### Attachments

• 29.5 KB Views: 371
• 26.2 KB Views: 418
Last edited:

#### lanedance

Homework Helper
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

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving