太极,,matplotlib画散


matplotlib画散点图 一例

from pylab import *from time import timet=time()def f(x,y):    return sqrt(x**2+y**2)def g(x,y):    return 0.62**1000 * f(x,y)**1000 + ((0.9 - 2*((-2*sin(2.4)*x*y)/(x**2+y**2) + (cos(2.4)*(x**2 - y**2))/(x**2 + y**2))*f(x,y)**2 + f(x,y)**4)*(-y + x*cos(f(x,y)) + y*sin(f(x,y))))/f(x,y)L=arange(-2,2,0.02)d=[(x,y) for x in L for y in L if g(x,y)<0]print time()-tplot(zip(*d)[0],zip(*d)[1],'ko',markersize=2)axis('equal')show()#该片段来自于http://byrx.net

评论关闭