CoCalc Shared FilesEMBED / batman-python.ipynbOpen in CoCalc with one click!
Author: ℏal Snyder
Views : 15

Batman Curve in Sage

Math from Figure 2 in SIAM News: Julia: A Fast Language for Numerical Computing
See also:

In [3]:
sf(x) = sqrt(1-x^2) # semicircle ef(x) = 3*sf(x/7) # ellipse sh(x) = 4.2 - .5*x -2.8*sf(.5*x -.5) # shoulders bf(x) = sf(abs(2 - x) - 1) - x^2/11 + .5*x -3 # bottom cl = [(0,1.7), (.5,1.7), (.8,2.6), (1,.9)] # cowl right cl2 = [(-x,y) for (x,y) in cl] # cowl left def p(f,xmin,xmax): "symmetric plot across y-axis" p1 = plot(f,xmin,xmax) p2 = plot(lambda x:f(-x),-xmax,-xmin) return p1 + p2 show(p(ef,3,7) + p(-ef,4,7) + p(sh,1,3) + p(bf,0,4) + line(cl) +line(cl2), figsize=4)
In [ ]: