summaryrefslogtreecommitdiff
path: root/Master/texmf/doc/asymptote/examples/magnetic.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf/doc/asymptote/examples/magnetic.asy')
-rw-r--r--Master/texmf/doc/asymptote/examples/magnetic.asy17
1 files changed, 17 insertions, 0 deletions
diff --git a/Master/texmf/doc/asymptote/examples/magnetic.asy b/Master/texmf/doc/asymptote/examples/magnetic.asy
new file mode 100644
index 00000000000..4dc187f5770
--- /dev/null
+++ b/Master/texmf/doc/asymptote/examples/magnetic.asy
@@ -0,0 +1,17 @@
+import graph3;
+import contour3;
+
+size(200,0);
+currentprojection=orthographic((6,8,2),up=Y);
+
+real a(real z) {return (z < 6) ? 1 : exp((abs(z)-6)/4);}
+real b(real z) {return 1/a(z);}
+real B(real z) {return 1-0.5cos(pi*z/10);}
+
+real f(real x, real y, real z) {return 0.5B(z)*(a(z)*x^2+b(z)*y^2)-1;}
+
+draw(surface(contour3(f,(-2,-2,-10),(2,2,10),10)),blue+opacity(0.75));
+
+xaxis3(Label("$x$",1),red);
+yaxis3(Label("$y$",1),red);
+zaxis3(Label("$z$",1),red);