Can Sage draw the Batman Equation directly with implicit_plot ?

65 views
Skip to first unread message

slabbe

unread,
Nov 14, 2011, 2:39:54 PM11/14/11
to sage-support
Hi,

A friend of mine wants to draw the Batman Equation using Sage. The
equation is defined here [1]. He is able to do it separately but doing
it directly in Sage as one equation does not seem to work. Do you know
why? Can you help him?

[1] http://www.gizmodo.fr/2011/07/30/lequation-de-batman.html

The 6 parts of the equation :

sage: x,y = var('x,y')
sage: f1 = ((x/7)^2*sqrt((abs(abs(x)-3))/(abs(x)-3))+(y/
3)^2*sqrt((abs(y+3*sqrt(33)/7)/(y+3*sqrt(33)/7)))-1)
sage: f2 = abs(x/2)-(3*sqrt(33)-7)/112*x^2-3+sqrt(1-
(abs(abs(x)-2)-1)^2)-y
sage: f3 = 9*sqrt(abs((abs(x)-1)*(abs(x)-0.75))/((1-
abs(x))*(abs(x)-0.75)))-8*abs(x)-y
sage: f4 = -y+3*abs(x)+0.75*sqrt(abs((abs(x)-0.75)*(abs(x)-0.5))/(-
(abs(x)-0.75)*(abs(x)-0.5)))
sage: f5 = 2.25*sqrt(abs((x-0.5)*(x+0.5))/(-(x-0.5)*(x+0.5)))-y
sage: f6 = 6*sqrt(10)/7+(1.5-0.5*abs(x))*sqrt(abs(abs(x)-1)/
(abs(x)-1))-6*sqrt(10)/14*sqrt(4-(abs(x)-1)^2)-y

Drawing the equation directly does not work:

sage: implicit_plot(f1*f2*f3*f4*f5*f6==0,(x,-8,8),
(y,-4,4)).show(aspect_ratio=1)

But, separately works :

sage: num = 2000
sage: A = implicit_plot(f1,(x,-8,8),(y,-5,5),plot_points=num)
sage: B = implicit_plot(f2,(x,-8,8),(y,-5,5),plot_points=num)
sage: C = implicit_plot(f3,(x,-8,8),(y,-5,5),plot_points=num)
sage: D = implicit_plot(f4,(x,-8,8),(y,-5,5),plot_points=num)
sage: E = implicit_plot(f5,(x,-8,8),(y,-5,5),plot_points=num)
sage: F = implicit_plot(f6,(x,-8,8),(y,-5,5),plot_points=num)
sage: show(A+B+C+D+E+F)

Being able to draw it directly would be nice!

Sébastien

achrzesz

unread,
Nov 14, 2011, 4:41:55 PM11/14/11
to sage-support
Workaround:

sage: f=[f1,f2,f3,f4,f5,f6]
sage: sum([implicit_plot(g,(x,-8,8),(y,-5,5),plot_points=num) for g in
f])

(The eq. prod(f)==0 is really complicated)

Andrzej Chrzeszczyk

Reply all
Reply to author
Forward
0 new messages