# Install the IPython magic extension %install_ext http://raw.github.com/azjps/ipython-asymptote/master/asymptote.py # Load the extension %reload_ext asymptote %%asy size(250); real a=3; real b=4; real c=hypot(a,b); transform ta=shift(c,c)*rotate(-aCos(a/c))*scale(a/c)*shift(-c); transform tb=shift(0,c)*rotate(aCos(b/c))*scale(b/c); picture Pythagorean(int n) { picture pic; fill(pic,scale(c)*unitsquare,1/(n+1)*green+n/(n+1)*brown); if(n == 0) return pic; picture branch=Pythagorean(--n); add(pic,ta*branch); add(pic,tb*branch); return pic; } add(Pythagorean(12)); %%asy -f png import graph3; import palette; import contour3; size(400); real f(real x, real y, real z) { return cos(x)*sin(y)+cos(y)*sin(z)+cos(z)*sin(x); } surface sf=surface(contour3(f,(-2pi,-2pi,-2pi),(2pi,2pi,2pi),12)); sf.colors(palette(sf.map(abs),Gradient(red,yellow))); currentlight=nolight; draw(sf,render(merge=true)); !head fin.asy %asy fin.asy %%asy fin.asy label("I added this new label right now!", (2.0,0,0), NE); %%asy --root cube import three; currentprojection=orthographic(5,4,2, center=true); size(5cm); size3(3cm,5cm,8cm); draw(unitbox); dot(unitbox, red); label("$O$", (0,0,0), NW); label("(1,0,0)", (1,0,0), S); label("(0,1,0)", (0,1,0), E); label("(0,0,1)", (0,0,1), Z); !head cube.asy