Going from cylindrical to cartesian coordinates

Click For Summary

Homework Help Overview

The discussion revolves around converting the expression for the magnetic field from an infinite wire, originally given in cylindrical coordinates, into Cartesian coordinates. The original poster attempts to express the magnetic field in terms of Cartesian variables but encounters issues with the resulting expressions, particularly when plotting the field.

Discussion Character

  • Exploratory, Mathematical reasoning, Problem interpretation

Approaches and Questions Raised

  • Participants discuss the simplification of trigonometric functions related to arctangent and how these relate to the original expression for the magnetic field. There are attempts to clarify the transformations needed for the sine and cosine of arctangent expressions.

Discussion Status

Participants are actively exploring different approaches to the problem, with some providing guidance on simplifying expressions. The original poster expresses confusion about the results when plotting the magnetic field, indicating that there is no clear consensus on the correct formulation yet.

Contextual Notes

There are indications of potential errors in the original poster's expressions, particularly regarding the signs of components in the magnetic field when plotted for negative x-values. The discussion also highlights the challenges of visualizing the magnetic field correctly in different coordinate systems.

Niles
Messages
1,834
Reaction score
0

Homework Statement


Hi

The expression for the magnetic field from an infinite wire is
<br /> \boldsymbol B(r) = \frac{\mu_0I}{2\pi}\frac{1}{r} \hat\phi<br />
which points along \phi. I am trying to convert this into cartesian coordinates, and what I get is
<br /> \boldsymbol B(x, y) = \frac{\mu_0I}{2\pi}\frac{1}{\sqrt{x^2+y^2}} \hat\phi<br />
where
<br /> \hat\phi = -\sin\phi \hat x + \cos\phi \hat y<br />
I am trying to make a phase plot of this expression, so what I have done is to say that \phi = \arctan(y/x), so \hat\phi = -\sin(\arctan(y/x))\hat x + \cos(\arctan(y/x))\hat y. However I don't get the desired result. Have I missed something in my approach?
 
Physics news on Phys.org
sin (arctan a) and cos (arctan a) can be simplified. Let z = arctan a, that means tan z = a, and tan z = sin z/cos z = a, so you can express sin z and cos z in terms of a.
 
voko said:
sin (arctan a) and cos (arctan a) can be simplified. Let z = arctan a, that means tan z = a, and tan z = sin z/cos z = a, so you can express sin z and cos z in terms of a.

Thanks, so I know that
<br /> \frac{y}{x} = \frac{\sin(\phi)}{\cos(\phi)}<br />
I can't see how this enables me to rewrite e.g. \sin(\arctan(y/x)).
 
## \sin (\arctan a) = \sin z ##. Since ##\tan z = \sin z/\cos z = a##, ##\sin^2 z = a^2 \cos^2 z = a^2(1 - \sin^2 z)##. So you can find ##\sin z## as a function of ##a##; ditto for ##\cos z##. Then substitute ## a = y/x ##.
 
Ah, I see. So I get
<br /> \sin z = \frac{a}{\sqrt{1+a^2}} \\<br /> \cos z = \frac{1}{\sqrt{1+a^2}}<br />
But I still have my original problem: That when I plot B using these for negative x, then I don't see the correct magnetic field. I thought that I was perhaps missing a term \pi/2, but that didn't solve it either.
 
What do you get and what is your expectation?
 
I have attached a plot of what I see (the axes are (x, y), the current 1A and the units on the axis in meters), it is called "negative_x". If I only plot for positive x-values I get "positive_x", and there I see what I expect (as shown here, on the top: http://www.netdenizen.com/emagnet/solenoids/frommaxwellonly.htm).

My code in Mathematica for plotting is:

VectorPlot[(mu0/2 pi)*
current*(1/(x^2 + y^2)^(1/2))*{-(y/x)/(1 + y^2/x^2)^(1/2),
1/(1 + y^2/x^2)^(1/2)}, {x, -0.01, 0.01}, {y, -0.01, 0.01}]
 

Attachments

  • positive_x.jpeg
    positive_x.jpeg
    19.2 KB · Views: 580
  • negative_x.jpeg
    negative_x.jpeg
    9.3 KB · Views: 565
You should be able to simply the formula very significantly. Note that ## \frac 1 {\sqrt {1 + y^2/x^2}} = \frac x {\sqrt {x^2 + y^2}} ##, and the radical in the denominator nicely couples with that in the common factor. But even then your formula is not wrong, I am not sure why Mathematica does not plot it correctly.
 
voko said:
You should be able to simply the formula very significantly. Note that ## \frac 1 {\sqrt {1 + y^2/x^2}} = \frac x {\sqrt {x^2 + y^2}} ##, and the radical in the denominator nicely couples with that in the common factor. But even then your formula is not wrong, I am not sure why Mathematica does not plot it correctly.

I don't know either. Strange, but nice to know that I have the correct exprssion. Thanks!
 
  • #10
OK, I just plotted it in MatLAB, and it *isn't* correct. For x<0 the y-coordinates all have to change sign. So the expression is not correct.

EDIT: I have attached the plot.
 

Attachments

  • untitled.jpg
    untitled.jpg
    12.8 KB · Views: 452
Last edited:
  • #11
Have you tried the simplified formula as I suggested?
 
  • #12
Yes, it didn't change anything. It shouldn't either, since it is just a different way of expressing it.
 
  • #13
Your formula is ## (\mu_0/2 \pi)
I \frac 1 {(x^2 + y^2)^{1/2}} \left(\frac {-y/x } {(1 + y^2/x^2)^{1/2}},
\frac 1 {(1 + y^2/x^2)^{1/2}} \right)##

Observe that the y-component is always positive, which is incorrect. If you transform it the way I suggested, you will get ## (\mu_0/2 \pi) I \frac 1 {x^2 + y^2} \left(-y, x\right)##, which restores the correct sign.
 
  • #14
thanks! I must have made an error somewhere then when I tried
 

Similar threads

  • · Replies 10 ·
Replies
10
Views
2K
Replies
1
Views
1K
  • · Replies 13 ·
Replies
13
Views
1K
  • · Replies 21 ·
Replies
21
Views
2K
Replies
2
Views
1K
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
933
  • · Replies 18 ·
Replies
18
Views
1K
Replies
1
Views
1K
  • · Replies 11 ·
Replies
11
Views
1K