-
-
Save ajinkyakulkarni/4b2a93b530fef71d539050e4b3fa01c1 to your computer and use it in GitHub Desktop.
Batman Equation (Python)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Fri Dec 16 09:30:30 2011 | |
Python Batman Equation | |
@author: Trae Blain | |
""" | |
from __future__ import division | |
import matplotlib.pyplot as plt | |
from numpy import sqrt #originally had from scipy import sqrt | |
from numpy import meshgrid | |
from numpy import arange | |
xs = arange(-7.25, 7.25, 0.01) | |
ys = arange(-5, 5, 0.01) | |
x, y = meshgrid(xs, ys) | |
eq1 = ((x/7)**2*sqrt(abs(abs(x)-3)/(abs(x)-3))+(y/3)**2*sqrt(abs(y+3/7*sqrt(33))/(y+3/7*sqrt(33)))-1) | |
eq2 = (abs(x/2)-((3*sqrt(33)-7)/112)*x**2-3+sqrt(1-(abs(abs(x)-2)-1)**2)-y) | |
eq3 = (9*sqrt(abs((abs(x)-1)*(abs(x)-.75))/((1-abs(x))*(abs(x)-.75)))-8*abs(x)-y) | |
eq4 = (3*abs(x)+.75*sqrt(abs((abs(x)-.75)*(abs(x)-.5))/((.75-abs(x))*(abs(x)-.5)))-y) | |
eq5 = (2.25*sqrt(abs((x-.5)*(x+.5))/((.5-x)*(.5+x)))-y) | |
eq6 = (6*sqrt(10)/7+(1.5-.5*abs(x))*sqrt(abs(abs(x)-1)/(abs(x)-1))-(6*sqrt(10)/14)*sqrt(4-(abs(x)-1)**2)-y) | |
#eq1 = ((x/7.0)**2.0*sqrt(abs(abs(x)-3.0)/(abs(x)-3.0))+(y/3.0)**2.0*sqrt(abs(y+3.0/7.0*sqrt(33.0))/(y+3.0/7.0*sqrt(33.0)))-1.0) | |
for f in [eq1,eq2,eq3,eq4,eq5,eq6]: | |
plt.contour(x, y, f, [0]) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment