Sharedbatman-curve.sagewsOpen in CoCalc
Author: Hal Snyder
Views : 81
License: MIT License
Description: Batman curve in Sage, Sage worksheet

Batman Curve in a Sage worksheet

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

See also:

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 p(ef,3,7) + p(-ef,4,7) + p(sh,1,3) + p(bf,0,4) + line(cl) +line(cl2)