02 07 2009 Python matplotlib Tweet
ローレンツのついでにgumowski
class Gumowski:
"Gumowski-Mira Map"
def __init__(self, x0, y0, a):
self.x0 = x0; self.y0 = y0
self.a = a;
def f(self,x):
return self.a*x + 2*(1-self.a)*x**2/(1+x**2)
def calc(self, n):
dat = []
x,y = self.x0, self.y0
for i in range(n):
nx = y + self.f(x)
ny = -x + self.f(nx)
dat.append([nx,ny])
x,y = nx,ny
return dat
if __name__ == "__main__":
from pylab import *
from random import random
n = 3
for i in range(n*n):
p = str(n) + str(n) + str(i+1)
subplot(p)
a = random() * 0.1 + 0.3
gumow = Gumowski(20, 20, a)
dat = gumow.calc(1000)
x = [d[0] for d in dat]
y = [d[1] for d in dat]
plot(x,y,'bo', alpha=0.1,ms=5)
savefig("gumow.png")