Skip to content

Instantly share code, notes, and snippets.

@akira093
Created September 5, 2013 08:31
Show Gist options
  • Save akira093/6447466 to your computer and use it in GitHub Desktop.
Save akira093/6447466 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
#coding:utf8
import pylab
from mpl_toolkits.mplot3d import Axes3D
fig = pylab.figure()
ax = fig.add_subplot(111, projection="3d")
def dk(x, y, a = 1):
return (1 + 4*pylab.cos(3**.5 * a * x / 2) * pylab.cos(a * y / 2) + 4 * pylab.cos(a * y / 2) ** 2)**.5
def e_k(x, y, a = 1, g = 3.0033, s = 0.129):
return g * dk(x, y, a) / (1 + s * dk(x, y, a))
def e_k_(x, y, a = 1, g = 3.0033, s = 0.129):
return -g * dk(x, y, a) / (1 - s * dk(x, y, a))
x = pylab.arange(-6, 6, .1)
y = pylab.arange(-6, 6, .1)
X, Y = pylab.meshgrid(x, y)
ax.plot_surface(X, Y, -e_k(X, Y), cmap = pylab.cm.coolwarm, rstride=1, cstride=1)
ax.plot_surface(X, Y, -e_k_(X, Y), cmap = pylab.cm.coolwarm, rstride=1, cstride=1)
pylab.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment