1
$\begingroup$

I am trying to make a 3D plot of arrows showing the directions of my magnetic field on different points on a sphere. I am constantly facing errors about the scaling which I do not know how to fix. I would be thankful if somebody can help.

d = {Sin[2 θ] Cos[ϕ], Sin[2 θ] Sin[ϕ], Cos[ 2 θ]}
σ = {PauliMatrix[1], PauliMatrix[2], PauliMatrix[3]}
B = d.σ
dat = N[Table[B, {θ, .15, 3, .1}, {ϕ, 0, 6, .2}]]
spherearrow1 = Graphics3D[Table[{Arrowheads[.01], Arrow[dat[[i]]]}, {i, 1, Length[dat]}]
$\endgroup$
  • $\begingroup$ It looks like there's some code missing. What do you define dvec1 and \[Sigma]vec to be? Graphics3D is expecting that each coordinate is given as {x, y, z}. So make sure that dat[[1]] for example, is something like {{x1, y1, z1}, {x2, y2, z2}} so that it knows where to start each arrow and where to end each arrow. $\endgroup$ – MassDefect Jan 27 '19 at 23:22
  • $\begingroup$ I fixed that, thank you. the problem is that my B is 2 by 2 matrix, but I still want to plot the arrows. So Isn't it possible to show the direction of B on each point of a 3D configuration (like a sphere)? $\endgroup$ – Delaram Nematollahi Jan 27 '19 at 23:27
  • $\begingroup$ Well, a 2 x 2 matrix doesn't seem to specify a direction in 3D Cartesian or spherical coordinates. For an example of theta = 0, phi = 0, we get d = {0, 0, 1} and B = {{1, 0}, {0, -1}}. It's not clear to me which direction such an arrow should be pointing. Should it be a vector that goes from the point {1, 0, 0} to {0, -1, 0} or something? That would be fairly easy to do, but I'm guessing that's not it since the Pauli matrices show up. $\endgroup$ – MassDefect Jan 27 '19 at 23:40
1
$\begingroup$

I figured out my problem. Here I wanted to plot the direction of magnetic field. The direction of B is defined by vector "d". So I should not use the Pauli matrices to plot the external magnetic field direction (which was also causing the error because of the B dimensions).

  d = {Sin[2 \[Theta]] Cos[\[Phi]], Sin[2 \[Theta]] Sin[\[Phi]], 
  Cos[ 2 \[Theta]]}
  dat = N[Table[{{Sin[2 \[Theta]] Cos[\[Phi]], 
  Sin[2 \[Theta]] Sin[\[Phi]], 
  Cos[ 2 \[Theta]]}, {Sin[2 \[Theta]] Cos[\[Phi]], 
  Sin[2 \[Theta]] Sin[\[Phi]], Cos[ 2 \[Theta]]} + 
  d}, {\[Theta], .15, 3, .1}, {\[Phi], 0, 6, .2}]]
  datflat = Flatten[dat, 1];
  spherearrow1 = 
  Graphics3D[
  Table[{Arrowheads[.01], Arrow[dat[[i]]]}, {i, 1, Length[dat]}]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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