summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/asymptote/examples/magnetic.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/asymptote/examples/magnetic.asy')
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/magnetic.asy18
1 files changed, 18 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/asymptote/examples/magnetic.asy b/Master/texmf-dist/doc/asymptote/examples/magnetic.asy
new file mode 100644
index 00000000000..3ae40466d43
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/magnetic.asy
@@ -0,0 +1,18 @@
+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),
+ render(merge=true));
+
+xaxis3(Label("$x$",1),red);
+yaxis3(Label("$y$",1),red);
+zaxis3(Label("$z$",1),red);