Could this made with processing

hi

i wonder if this could achieve with processing

Bx[x_, z_, R_] = 
  If[Abs[x/R] < 10^-5, 0, z/(2 Pi x) (\[Beta] = (x + R)^2 + z^2;
     m = 4 x*R/\[Beta];
     1/Sqrt[\[Beta]] ((R^2 + x^2 + z^2)/((R - x)^2 + z^2) EllipticE[
          m] - EllipticK[m]))];
Bz[x_, z_, R_] = 1/(2 Pi) (\[Beta] = (x + R)^2 + z^2;
    m = 4 x*R/\[Beta];
    1/Sqrt[\[Beta]] ((R^2 - x^2 - z^2)/((R - x)^2 + z^2) EllipticE[
         m] + EllipticK[m]));
B[x_, z_, R_] = {Bx[x, z, R], Bz[x, z, R]};
ColorFunc[x_] = 
  Blend[{{0, Hue[0.65, 0.6, 1]}, {1/4, Hue[1/3, 0.7, 0.8]}, {1/2, 
     Hue[1/6, 0.9, 0.8]}, {1, RGBColor[0.95, 0.2, 0.2]}}, x];
R = 1;
plot = Plot3D[R /0.8^1.5 Norm[B[x, z + R/2, R] + B[x, z - R/2, R]],
  {x, -2, 2}, {z, -2.5, 2.5}, PlotRange -> {0, 2},
  BoxRatios -> {5, 6, 3}, 
  AxesLabel -> {"\[Rho]", "z", "\!\(\*FractionBox[\"B\", 
RowBox[{\"B\", 
RowBox[{\"(\", \"0\", \")\"}]}]]\)"}, 
  AxesEdge -> {{-1, -1}, {1, -1}, {1, 1}}, PlotPoints -> 401, 
  MaxRecursion -> 2, Method -> {Refinement -> {ControlValue -> 0.05}},
   ImageSize -> 800, ClippingStyle -> None, 
  Mesh -> {7, 9, Range[0, 3/2, 1/2]}, 
  MeshFunctions -> {#1 &, #2 &, #3 &}, 
  MeshStyle -> {Black, Black, {LightGray, Thickness[0.002]}}, 
  ColorFunction -> (Directive[SurfaceColor@Darker[ColorFunc[#3], 0.2],
       Glow@Darker[ColorFunc[#3], 0.8], Specularity[0.3, 40]] &),
  BaseStyle -> {FontSize -> 20}, ViewPoint -> {4, -10, 6}]
SetDirectory[NotebookDirectory[]];
Export["Helmholtz-coil-field-3D.png", plot, ImageResolution -> 300];

That is quite clearly Mathematica code, from here: File:Helmholtz-coil-field-3D.png - Wikimedia Commons

You could rewrite it in Processing, yes, but it would be quite difficult. Processing doesn’t have a lot of the handy, built-in math functions that Mathematica has. You would have to do a LOT of work just to draw the graph of a function like this in 3D. They’re completely different languages, you know? It would be a lot of work to translate from one language to the other. Like trying to translate Japanese to French… and if you don’t speak both languages well, you’re going to have a hard time doing it.

2 Likes

yes you are true i have followed a lot of your posts here and old forums your style is very understandable and great

thanks for answer