Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Trouble/Question with/about Maxwell Equations

  1. Apr 16, 2005 #1
    I was bored yesterday and started messing around with Maxwell equations to try to solve for electric field for spherically symmetric cases (as opposed to just using the integral formulation).

    For example, a simple case of a solid sphere with uniform charge distribution [itex]\rho[/itex]. Using Gauss's Law an equation can be simply derived for the electric field inside the sphere.
    [tex]\oint_S \mathbf{E} \cdot d\mathbf{A} = \frac{1}{\epsilon_0} \int_S \rho dV[/tex]
    (Edit - whoops)
    [tex]E4\pi r^2 = \frac{4/3 \pi r^3 \rho_0}{\epsilon_0}[/tex]
    [tex]E = \frac{r\rho_0}{3\epsilon_0}[/tex]

    However, when I try plugging this back into Maxwell Equation:
    [tex]\nabla \cdot E = \frac{\rho}{\epsilon_0}[/tex]
    ...using Mathematica and spherical coordinates I take:
    [tex]E = <\frac{r\rho_0}{3\epsilon_0},\phi, \theta>[/tex]
    and it becomes
    [tex]\nabla \cdot E = \frac{\rho_0}{\epsilon_0} + \frac{1 + \phi cot(\phi) + csc(\phi)}{r} [/tex]

    I then tried a simpler case such as the Electric field from a static charge.
    [tex] E = \frac{q}{4\pi\epsilon_0 r^2} [/tex]
    When I plugin
    [tex] E = <\frac{q}{4\pi\epsilon_0 r^2}, \phi, \theta> [/tex]
    into Mathematica I get.
    [tex] \nabla \cdot E = \frac{1 + \phi cot(\phi) + csc(\phi)}{r}[/tex]

    I'm confused as to where this
    [tex] \frac{1 + \phi cot(\phi) + csc(\phi)}{r}[/tex]
    is coming from or what am I doing wrong in the application of the equation. I originally had trouble when I tried to solve the differential equation
    [tex] \nabla \cdot E(r,\phi,\theta) = \frac{\rho(r) }{\epsilon_0} [/tex]
    [tex] E(r,\phi,\theta) = <E(r), \phi, \theta>[/tex]
    to get a general solution for any spherically symmetric charge distribution [itex]\rho(r)[/itex]

    Please help. Thanks in advance. (I'm probably doing something really stupid and don't even realize it, but I can't figure it out)
    Last edited: Apr 17, 2005
  2. jcsd
  3. Apr 16, 2005 #2

    Meir Achuz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    You should have put <E_r,0,0> into div E. Your input gave angular derivatives of the \phi and \theta.
  4. Apr 16, 2005 #3

    Andrew Mason

    User Avatar
    Science Advisor
    Homework Helper

    Your statement of Gauss' law should be:

    [tex]\oint_S \mathbf{E} \cdot d\mathbf{A} = \frac{q_{encl}}{\epsilon_0} = \frac{\rho V}{\epsilon_0}[/tex]

    [tex]\nabla \cdot E = \frac{\rho}{\epsilon_0}[/tex]

    You correct that in your calculation but when you plug it back into mathematica you omit the Volume.

    Edit: corrected [tex]\nabla \cdot E[/tex] - Brad's post - thanks

    Last edited: Apr 17, 2005
  5. Apr 16, 2005 #4
    the right side of the differential form of gauss' law should be "rho/epsilon_0."
  6. Apr 17, 2005 #5
    Woops, I made a mistake when writing out the formula for Gauss's law. However, I still applied it correctly (Q = 4/3 rho * pi * r^3) . Also, The differential form doesn't have a V in it, as Brad already stated. Lastly, <E_r,0,0> I believe is incorrect since the electric field does have a direction and that is the direction away from the center of charge--assuming spherical symmetry (i.e. the electric field lines aren't just pointing at 0,0 all the time. They are pointing radially outwards). Additionally I don't understand what you mean by "omit[ing] the volume" when plugging back into Mathematica. I calculated E using Gauss's law and then use the differential form to try to find the divergence of E.
    Last edited: Apr 17, 2005
  7. Apr 17, 2005 #6

    Claude Bile

    User Avatar
    Science Advisor

    Pointing radially outward is exactly equivalent to pointing toward the centre. Meir is correct, your phi and theta components should both be zero.

    The divergence of an electric field in spherical coordiantes is;

    [tex] \nabla.E = \frac{1}{r^2} \frac{\partial}{\partial r} (r^2 E_r) [/tex]

    (Omitting the terms that contain derivatives of [tex] E_\phi [/tex] and [tex] E_\theta [/tex])

    When you plug your result in, the divergence comes out as it should. Your problem was either a) You didn't specify spherical coordinates or b) The program got confused because you specified non-zero values for phi and theta.

  8. Apr 19, 2005 #7
    Sorry, I don't understand how 0,0 for [itex](\phi,\theta)[/itex] could be radial, I don't have that much experience with the coordinate system. Converting <E(r),0,0> back to Cartesian yields:
    [tex]\mathbf{E} = <E(r)cos(\theta)sin(\phi),E(r)sin(\theta)sin(\phi),E(r)cos(\phi)>[/tex]
    [tex](\phi,\theta) = (0,0)[/itex]
    it becomes
    [tex]\mathbf{E} = <0,0,E(r)>[/tex]
    ([itex]\mathbf{E}[/itex] Is the electric field and E(r) is the magnitude of the electric field)
    So all of the vector field lines are pointing in the z direction? Could you point out where my fallacy is please? Many thanks in advance. .
  9. Apr 19, 2005 #8

    "So all of the vector field lines are pointing in the z direction?"

    So in spherical coordinates the field points radial out from the origin. But in cartesian coordinates it points in the z direction? Does that make sense? Are you sure your conversion from spherical to cartesian coordinates is right?
  10. Apr 19, 2005 #9
    That's the point, I don't see how <E(r), 0 ,0> is radial based on the definition of spherical coordinates. <E(r), 0, 0> means that the vector has magnitude E(r) and has a zenith angle of 0, (it's ponting up) and has an azimuthal angle of 0 (irrelevant because the polar angle is zero). That's why I'm confused people are telling me that the vector field function for the electric field should be <E(r), 0, 0> in spherical coordinates but that doesn't really make sense to me and I'm wondering where my reasoning is wrong, since when I use my reasoning it leads to conflicting results. I'm using all conversions and equations from http://mathworld.wolfram.com/SphericalCoordinates.html by the way.
    Last edited: Apr 19, 2005
  11. Apr 19, 2005 #10


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    It seems to me that <E(r),0,0> means
    "the angular components satisfy E(phi)=0 and E(theta)=0 [for any values of r, phi and theta]"
    ...and not that "phi=0 and theta=0".
  12. Apr 19, 2005 #11
    I have a feeling I'm wrong but I've always thought of vector fields (in this case spherical coordinates) as a function which takes a position vector <r, phi, theta> which corresponds to the location of the point to be evaluated and returns another vector (r, phi, theta) which corresponds to the value and direction of the vector. So a vector field <E(r), 0, 0> takes a position at any given point in space given by (r, theta, phi) and returns a vector at that point with length E(r) (i.e some function only dependant on the distance to the origin) and with direction 0 for phi and 0 for theta (i.e pointing up). A vector field <E(r), phi, theta> takes a position (r, phi, theta) and returns a vector <E(r), phi, theta> (i.e a vector with the same direction to the origin as it's position, with a length described by the function E(r)), which is why I said would be a radially symmetric electric field.)Why is this wrong?
  13. Apr 19, 2005 #12

    Now I see your problem! The spherical coordinate system is an example of a more general type of system of coordinates called curvilinear coordinates. They differ from cartesian coordinates in that the three basis vectors that define the system are not the same at all points in space. In particular, for the spherical system, the r basis vector is defined at any point P in space to point along the line between the origin and the point P. In other words r always points radially away from the origin. So any vector expressed in spherical coordinates that has phi and theta coordinates equal to zero, will point in the radial direction.

    Does that help?
  14. Apr 19, 2005 #13


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Your notation:

    <E(r), theta, phi> really doesn't make a whole lot of sense to me. How can you have a vector quantity whose components are not all the same types of quantities? The radial component is an electric field. The other two are merely position coordinates. The units don't even match.

    Let's go through it from the top:

    You are correct that a vector field is a function that assigns a vector to every point in space. (Look at a diagram of a vector field, and you will these vectors drawn for selected points in space). All this is saying is that, at any given point in space, the electric field has a certain magnitude and direction. Hence it can be represented by a vector at that point. The magnitude and direction of the electric field vector depends on the point in space where you look. So the electric field vector is a function of the three spatial position coordianates. In spherical coordinates:

    [tex] \vec{E} = \vec{E}(r, \theta, \phi ) [/tex]

    Just so we're absolutely clear, that is just function notation.

    Now, the E-field is a function of position, which is given by the three coords. But since knowing the position vector of a point in space, you know the position coordinates by definition, the E-field is a function of the spatial position vector (I realise I'm going over stuff you already know):

    [tex] \vec{r} = \ \ < r, \theta, \phi > [/tex]

    so we can write:

    [tex] \vec{E} = \vec{E}(\vec{r} ) [/tex]

    Now, in general, the E-field vector is pointing in some direction, that is a combination of the three directions of the basis vectors. So we can resolve E into components, part of it is pointing in the radial direction, part of it in the circumferential direction (phi), part of it in the polar direction (theta). We'll use subscripts to denote which component of the E vector is being referred to:

    [tex] \vec{E} = \ \ <E_r, E_{\theta}, E_{\phi}> [/tex]

    But what determines the value of each component? Well, the magnitude and direction of the E vector is a function of position. It follows that the value of each component is a function of position:

    [tex] \vec{E}(r, \theta, \phi ) = <E_r(r, \theta, \phi ), \ \ E_{\theta}(r, \theta, \phi ), \ \ E_{\phi}(r, \theta, \phi )> [/tex]

    Now, you happen to know that the field in question points in the radial direction only. What does this mean? It means that it has an r component only. The theta and phi components are zero:

    [tex] \vec{E}(r, \theta, \phi ) = <E_r(r, \theta, \phi ),\ \ 0,\ \ 0> [/tex]

    If you don't believe me, consider an analogous case in cartesian coordinates:

    what if the electric field pointed in, say, the x-direction only? Then its y and z components would be zero, and the vector would be given by:

    [tex] \vec{E}(x, y, z) = <E_x(x, y, z), \ \ 0, \ \ 0> [/tex]

    But I digress. Back to the example at hand. I believe from Coulomb's law we have some additional information for this particular case: not only is the field radial, but also its strength depends only on how far away you are (radially) from the source. That means that (by symmetry arguments for this type of charge distribution), The electric field is constant (in magnitude) at every point in space a given radius away from the source. We say that its magnitude is a function of r only. There is no theta dependence, or phi dependence. If E is not a function of theta or phi, we can write:

    [tex] \vec{E}(r) = <E_r(r), \ \ 0, \ \ 0> [/tex]

    Lastly, I don't like the angle bracket notation much. We can also write vectors as as a sum of the scalar components, each multiplied by its respective unit vector:

    [tex] \vec{E}(r) = E_r(r) \hat{r} + 0\hat{\theta} + 0\hat{\phi} [/tex]

    r hat, theta hat, and phi hat are the three basis vectors (to which jdavel referred) for this coordinate system. So they are analogous to i, j, and k in the cartesian coordinate system.

    Since E is unidirectional and a function of only one variable, we can clean that last expression up a little and simply write:

    [tex] \vec{E}(r) = E(r) \hat{r} [/tex]

    I hope all of this helps.
  15. Apr 19, 2005 #14
    I understand everything up to here.
    This is news to me. I understand most of it except for the meaning of theta and phi. Few things I still don't understand or am note sure about:

    (1) If you have a field vector (i.e a vector that is the output of a vector field) <r,0,0> (or [itex]r\hat{\mathbf{r}}[/itex] if you prefer) would it be possible to convert to cartesian without knowing it's position vector?
    (2) Considering I completely misunderstood what the radial (r) component meant/denote, what do the theta and phi component indicate? Are they sort of like deviations from the radial vector?
    (3) Does having non-zero theta and phi components change the magnitude of the vector?

    Also, thank you (and jdavel) so much for clearing up my misconception, it had been bugging me for days.
  16. Apr 19, 2005 #15

    This is pretty hard to see without a good perspective diagram of a 3D coordinate system. Try Googling spherical coordinates; you'll get all the pictures you want! And feel free to ask more questions if you get stuck. If you describe a 3D figure you find, people here will know what you're talking about and be able to help.

    Good luck.
  17. Apr 19, 2005 #16

    Claude Bile

    User Avatar
    Science Advisor

    Recall that you have converted from Spherical to Cartesian coordinates, thus you are saying that at phi=0, theta=0, which corresponds to a point on the z axis, thus it makes sense that the electric field will point in the z direction at this point (i.e. radially outward from the centre). There is nothing contradictory in your statement.

    (1) No, because the unit vector is the normalised position vector (i.e. same direction, length 1). This is one of the key differences between Spherical and Cartesian coordinate systems, the unit vectors are not constant, they depend on position.
    (2) Theta is the angle from the x axis (in the horizontal (xy) plane). Phi is the angle from the z axis (otherwise know as the azimuth angle for this reason). The direction of the phi component is toward the z axis, perpendicular to the radial vector. The direction of the theta component is perpendicular to both the phi and radial vector.
    (3) Absolutely. The mutual orthogonality of the unit vectors, means that calculating the length of a vector in spherical coordinates is exactly the same as you would calculate in cartesian coordinates.

    I suggest looking up the Mathworld website (Look up geometry -> Coordinate Geometry -> Spherical coordinates) for more information (and a picture!).

  18. Apr 19, 2005 #17


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Hrm, I see what may be the problem.

    As we all know, a geometric model for spherical coordinates is that given an (r, &theta;, &phi;) tuple, we can construct the corresponding point in x-y-z space as follows:

    Start with the point on the x-axis with coordinate r.
    Rotate this through an angle of &theta; around the z-axis.
    Now, in the plane containing the point and the z-axis, rotate it an angle of &phi; about the origin. (positive &phi; means upwards, etc)

    (For the record, I'm a mathematician -- I understand that physicists like to swap the meaning of &theta; and &phi;. Ah well)

    It would seem natural to do the same thing for a vector as well -- given an (r, &theta;, &phi;) tuple, make the same construction to produce the corresponding vector in (x, y, z) coordinates...

    But that's wrong -- there are various reasons to prefer another way...

    The right way is that the each basis vector for spherical coordinates points in the direction where the corresponding position variable is increasing, but the others remain the same.

    Or, to say that in an easier way, the r basis vector points in the direction in which r increases, and &theta; and &phi; remain constant. Similarly for the other two basis vectors.
  19. Apr 19, 2005 #18

    Andrew Mason

    User Avatar
    Science Advisor
    Homework Helper

    Just a comment. You have to be careful not to mix coordinates of these two different vectors: 1. the location of a point in space (displacement from origin) and 2. the field vector at that point.

    To describe the field, you pick a displacement vector [itex]\vec r(r, \theta, \phi)[/tex] and express the field vector at that displacement. Since E is in the same direction as [itex]\vec r[/itex], [itex]\vec E(\vec r) = \vec E(\vec r(r,\theta,\phi)) = E\hat r[/tex]

  20. Apr 20, 2005 #19
    I'm afraid you've made a very serious error here. You're confusing the total charge of the sphere with the charge contained within the Gaussian surface. With that in mind try this again and you'll clearly see your mistake.

    Hope that was helpful.

    Last edited: Apr 20, 2005
  21. Apr 20, 2005 #20
    pmb phy,

    "You're confusing the total charge of the sphere with the charge contained within the Gaussian surface."

    Are you sure that's right? He said his equation is for the field "inside the sphere". So as long as r is less than the radius of the entire sphere, the field will vary as r. Right?
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Trouble/Question with/about Maxwell Equations