クリフォード/デヨン アトラクタ https://gihyo.jp/book/2021/978-4-297-12383-3
def Clifford(x, y, a = -1.1, b = -1, c = -3.0, d = -0.1): # -3 ~ 3
x_ = np.sin(a*y) + c*np.cos(a*x)
y_ = np.sin(b*x) + d*np.cos(b*y)
return x_, y_
def DeJong(x, y, a = -2, b = -2.3, c = -1.4, d = 2.1): # -3 ~ 3
x_ = np.sin(a*y) - np.cos(b*x)
y_ = np.sin(c*x) - np.cos(d*y)
return x_, y_
def Hopalong(x, y, p): # 0 ~ 10
a, b, c = p
x_ = y - 1 - ((x-1)*np.sqrt(abs(b*x-1-c)))/abs(x-1)
y_ = a - x - 1
return x_, y_
def Goldfish(x, y, p):
a, b = p
x_ = np.cos(a*x - y) + y*np.sin(b*x*y)
y_ = x + b*np.sin(y)
return x_, y_
def Rebirth(x, y, p):
a, b = p
x_ = a*x + b*y
y_ = x**2 + b
return x_, y_
def Cylinder(x, y, p):
a = p[0]
x_ = x + a*np.sin(2*np.pi*y)
y_ = x*np.cos(2*np.pi*y) + a*y
return x_, y_
cnt = 2**15
xs = np.zeros(cnt)
ys = np.zeros(cnt)
xs[0], ys[0] = 0.1, 0.1
f = Clifford
for i in range(1, cnt):
xs[i], ys[i] = f(xs[i-1], ys[i-1])