2
$\begingroup$

when i try the answere of Mr.Wizard from How can I reproduce a beautiful 3D vector plot?

ϕ[x_, y_, z_] := (Pi Exp[-Dot[{x, y}, {x, y}]/2] - Pi/2);
V[x_, y_, z_] := Evaluate[Simplify[ComplexExpand[-RotationMatrix[ϕ[x, y, z], {y, -x, 0}].{x, y, 0}/Sqrt[{x, y}.{x, y}]]]];
V[0, 0, z_] := {0, 0, -1};
R = Pi; 
P = Select[Flatten[Table[Table[{x, y, 0}, {y, -R, R, R/20}],{x, -R, R, R/20}], 1], X \[Function] -R <= X[[1]] - X[[2]] <= R];
P = Transpose[{{1, -1/2, 0}, {0, Sqrt[3]/2, 0}, {0, 0, 1}}.Transpose[P]];
colfun[x_, y_, z_] := Evaluate[Simplify[ColorData["TemperatureMap"][(Pi/2 - ϕ[x, y, z])/Pi]]];
arrow[p1_, p2_] := {EdgeForm[], FaceForm[colfun @@ p1], Cone[{p1, p2}, 1/24]};
Show[
 Graphics3D[{arrow @@@ Transpose[{P, P + 1/4 V @@@ P}]}],
 PlotRange -> All,
 Lighting -> "Neutral",
 Boxed -> False
 ]

i get

 Power: Infinite expression 1/0^2 encountered.

as error message and there is one line missing:

Skyrmion with defect line due to 1/0 infinite expression encountered

Can you tell me, what i am doing wrong? It seems that he just used exactly that lines to produce the figure shown there. I am using Mathematica 12.3 while theirs seems to be v8. Did something changed or am i just missing a definition?

Thank you in advance!

$\endgroup$
8
  • 4
    $\begingroup$ Welcome to the Mathematica Stack Exchange. Go to the Evaluation menu and choose Quit Kernel -> Local and then try this code again. Thanks. $\endgroup$
    – Syed
    Aug 24, 2022 at 12:29
  • $\begingroup$ Thank you for the suggestion.Unfortunately this does not work. I get the same error message. Can i try something else? $\endgroup$
    – RamonD
    Aug 24, 2022 at 13:02
  • 2
    $\begingroup$ MMA version13.1 does not show an error message, nor the missing line. $\endgroup$ Aug 24, 2022 at 14:44
  • 1
    $\begingroup$ Add // Simplify[#, Assumptions -> Element[{x, y, z}, Reals]] & at the end of definition of V[x_,y_,z_] to get rid of Abs and so on, and it works fine ! $\endgroup$
    – Akku14
    Aug 24, 2022 at 17:46
  • 2
    $\begingroup$ By the way, you notice this, if you check step by step and use Set instead of SetDelayed in defintion of functions like V to see at once how they look like. Since you define V with Evaluate SetDelayed makes no sence. $\endgroup$
    – Akku14
    Aug 24, 2022 at 17:53

0

Browse other questions tagged or ask your own question.