I'm not entirely sure how to convert from spherical coordinates to Cartesian coordinates, I believe the way to do it is by using the following code:

TransformedField["Spherical" -> "Cartesian", B, {r, θ, ϕ} -> {x, y, z}]

Where B is


Then I want to take the -Grad of this equation (after it's converted into cartesian)

MP0 = -Grad[-((0.0002906250000000001*(z/Sqrt[x^2 + y^2 + z^2])[Sqrt[x^2 + y^2]/
      Sqrt[x^2 + y^2 + z^2]]^2)/(x^2 + y^2 + z^2)), {x, y, z}] 

Then the result is a vector which I want to plot using VectorPlot3D, however it won't plot, it just gives me a blank output

  • $\begingroup$ Please format the code and define B so we can run your code and see if "something is wrong". If you include what you expect and what you actually get maybe we can help you. $\endgroup$ Apr 19, 2016 at 23:47

1 Answer 1


How about this:

B = -((0.0003*Cos[θ] (Sin[θ])^2)/r^2);

f[x_, y_, z_] = Grad[Simplify[TransformedField["Spherical" -> "Cartesian", B, {r, θ, ϕ} -> {x, y, z}]], {x, y, z}]

VectorPlot3D[f[x, y, z], {x, 0, 1}, {y, 0, 1}, {z, 0, 1}]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.