Python - Ecuaciones y Funciones Caóticas Recursivas

#35 Ejemplos de Ecuaciones y Funciones Caóticas Recursivas[br][br]#1. Función logística:[br]def logistic_map(r, x):[br] return r * x * (1 - x)[br][br]x = 0.5[br]r = 3.5[br]for i in range(100):[br] x = logistic_map(r, x)[br] print(x)[br] [br]#2. Ecuación del mapa cuadrático: [br] x(n+1) = 1 - ax(n)^2 [br]#2. Ecuación del mapa logístico cuadrático:[br]def logistic_quad_map(x, r, a):[br] return r * x * (1 - x) + a * x ** 2[br][br]x = 0.5[br]r = 3.5[br]a = 0.01[br]for i in range(100):[br] x = logistic_quad_map(x, r, a)[br] print(x)[br] [br]#3. Función de Henon:[br]def henon(x, y, a, b):[br] xn = y + 1 - a * x ** 2[br] yn = b * x[br] return xn, yn[br] [br]#3. Ecuación de Hénon:[br]def henon_map(a, b, x, y):[br] return y + 1 - a * x ** 2, b * x[br][br]a = 1.4[br]b = 0.3[br]x = 0.1[br]y = 0.1[br]for i in range(100):[br] x, y = henon_map(a, b, x, y)[br] print(x, y)[br][br]#4. Ecuación del mapa de Hénon-Heiles:[br] x(n+1) = y(n)[br] y(n+1) = -x(n) - ay(n) - by(n)^2 - cy(n)^3[br]#4. Ecuación del mapa de Henon-Heiles:[br]def henon_heiles_map(x, y, p_x, p_y, alpha=1.0):[br] x_new = x + p_x[br] y_new = y + p_y[br] p_x_new = p_x - alpha * x - 2 * x * y[br] p_y_new = p_y - alpha * y - (y ** 2 - x ** 2)[br] return x_new, y_new, p_x_new, p_y_new[br][br]# parámetros del mapa[br]alpha = 1.0[br]num_steps = 10000[br][br]# condiciones iniciales[br]x0 = 0.1[br]y0 = 0.1[br]p_x0 = 0.0[br]p_y0 = 0.0[br][br]# almacenamiento de resultados[br]x_values = [x0][br]y_values = [y0][br]p_x_values = [p_x0][br]p_y_values = [p_y0][br][br]# iteración del mapa[br]for i in range(num_steps):[br] x, y, p_x, p_y = henon_heiles_map(x0, y0, p_x0, p_y0, alpha)[br] x_values.append(x)[br] y_values.append(y)[br] p_x_values.append(p_x)[br] p_y_values.append(p_y)[br] x0, y0, p_x0, p_y0 = x, y, p_x, p_y[br][br]#5. Ecuación del mapa de May:[br] x(n+1) = axn(1-xn-kyn)[br] y(n+1) = byn(1-yn-lxn)[br][br] [br]#6. Función de Lorenz:[br]def lorenz(x, y, z, sigma, rho, beta):[br] dx = sigma * (y - x)[br] dy = x * (rho - z) - y[br] dz = x * y - beta * z[br] return dx, dy, dz[br][br]#6. Ecuación de Lorenz:[br]def lorenz_map(x, y, z, sigma=10, rho=28, beta=8/3):[br] dx_dt = sigma * (y - x)[br] dy_dt = x * (rho - z) - y[br] dz_dt = x * y - beta * z[br] return x + dx_dt, y + dy_dt, z + dz_dt[br][br]x = 0.1[br]y = 0.1[br]z = 0.1[br]for i in range(100):[br] x, y, z = lorenz_map(x, y, z)[br] print(x, y, z)[br] [br]#7. Función de Rossler:[br]def rossler(x, y, z, a, b, c):[br] dx = -y - z[br] dy = x + a * y[br] dz = b + z * (x - c)[br] return dx, dy, dz[br][br]#8. Ecuación de Rossler:[br]def rossler_map(x, y, z, a=0.2, b=0.2, c=5.7):[br] dx_dt = -y - z[br] dy_dt = x + a * y[br] dz_dt = b + z * (x - c)[br] return x + dx_dt, y + dy_dt, z + dz_dt[br][br]x = 0.1[br]y = 0.1[br]z = 0.1[br]for i in range(100):[br] x, y, z = rossler_map(x, y, z)[br] print(x, y, z)[br] [br]#9. Función de Ikeda:[br]import math[br]def ikeda(x, y, u):[br] t = 0.4 - 6 / (1 + x ** 2 + y ** 2)[br] xn = 1 + u * (x * math.cos(t) - y * math.sin(t))[br] yn = u * (x * math.sin(t) + y * math.cos(t))[br] return xn, yn[br][br]#9. Ecuación de Ikeda:[br]import math[br]def ikeda_map(u, v):[br] x = 0.85 * (u * math.cos(v) - v * math.sin(u))[br] y = 0.85 * (u * math.sin(v) + v * math.cos(u))[br] return x, y[br][br]u = 1.0[br]v = 1.0[br]for i in range(100):[br] u, v = ikeda_map(u, v)[br] print(u, v)[br] [br]#10. Función de Tinkerbell:[br]def tinkerbell(x, y, a, b, c, d):[br] xn = x ** 2 - y ** 2 + a * x + b * y[br] yn = 2 * x * y + c * x + d * y[br] return xn, yn[br][br]#11. Función de Gingerbreadman:[br]def gingerbreadman(x, y):[br] xn = 1 - y + abs(x)[br] yn = x[br] return xn, yn[br][br]#12. Función de Clifford:[br]def clifford(x, y, a, b, c, d):[br] xn = math.sin(a * y) + c * math.cos(a * x)[br] yn = math.sin(b * x) + d * math.cos(b * y)[br] return xn, yn[br][br]#13. Función de Bedhead:[br]def bedhead(x, y):[br] xn = math.sin(x * y / 10) * y + math.cos(x / 10) * 10[br] yn = x + math.sin(y / 10) * 10 - math.cos(y / 10) * x[br] return xn, yn[br][br]#14. Función de De Jong:[br]def de_jong(x, y, a, b, c, d):[br] xn = math.sin(a * y) - math.cos(b * x)[br] yn = math.sin(c * x) - math.cos(d * y)[br] return xn, yn[br][br]#15. Función de Thomas:[br]def thomas(x, y, z, a, b, c, d):[br] dx = math.sin(y) - a * x[br] dy = math.sin(z) - b * y[br] dz = math.sin(x) - c * z[br] return dx, dy, dz[br][br]#16. Función de Aizawa:[br]def aizawa(x, y, z, a, b, c, d, e):[br] dx = z - b * x + d * math.sin(y)[br] dy = b * x + z - d * math.sin(y)[br] dz = c + a * z - z ** 3 / 3 - x ** 2 + e * z * x ** 2[br] return dx, dy, dz[br][br]#17. Función de Halvorsen:[br]def halvorsen(x, y, z, a):[br] dx = -a * x - 4 * x ** 3 - 4 * y ** 2 - 4 * z ** 2 + z[br] dy = -a * y - 4 * y ** 3 - 4 * z ** 2 - 4 * x ** 2 + x[br] dz = -a * z - 4 * z ** 3 - 4 * x ** 2 - 4 * y ** 2 + y[br] return dx, dy, dz[br][br]#18. Función de Rabinovich-Fabrikant:[br]def rabinovich_fabrikant(x, y, z, a):[br] dx = y * (z - 1 + x ** 2) + a * x[br] dy = x * (3 * z + 1 - x ** 2) + a * y[br] dz = -2 * z * (a + x * y)[br] return dx, dy, dz[br][br]#19. Función de Chua:[br]def chua(x, y, z, a, b, c, m0, m1):[br] if x > m1:[br] dx = -a * (x - m1) + b * (y - math.sqrt(x - m1))[br] elif x < -m1:[br] dx = -a * (x + m1) + b * (y - math.sqrt(-x - m1))[br] else:[br] dx = b * (y - x)[br] dy = x - y + z[br] dz = -c * y[br] return dx, dy, dz[br][br]#20. Función de Hadley:[br]def hadley(x, y, z, a, b, c):[br] dx = -a * y - z * x[br] dy = x + b * y[br] dz = c + x * z[br] return dx, dy, dz[br][br]#21. Función de Rössler modificada:[br]def rossler_mod(x, y, z, a, b, c, d):[br] dx = -y - z[br] dy = x + a * y[br] dz = b + z * (x - c) + d * x ** 2[br] return dx, dy, dz[br][br]#22. Función de Thomas modificada:[br]def thomas_mod(x, y, z, a, b, c, d, e):[br] dx = math.sin(y) - a * x + e * math.sin(b * z)[br] dy = math.sin(z) - b * y + e * math.sin(c * x)[br] dz = math.sin(x) - c * z + e * math.sin(d * y)[br] return dx, dy, dz[br][br]#23. Función de Chen:[br]def chen(x, y, z, a, b, c):[br] dx = a * (y - x)[br] dy = x * (b - z) - y[br] dz = x * y - c * z[br] return dx, dy, dz[br][br]#24. Función de Sprott:[br]def sprott(x, y, z, a, b, c, d, e, f):[br] dx = y[br] dy = z[br] dz = a * x + b * y + c * z + d * x ** 2 + e * y ** 2 + f * z ** 2 + x * y * z[br] return dx, dy, dz[br][br]#25. Función de Liu Chen:[br]def liu_chen(x, y, z, a, b, c, d):[br] dx = -a * x + y * y - z * z + a * b[br] dy = -x * y + b * y + x * z - c[br] dz = -x * z + c * y + d * z[br] return dx, dy, dz[br][br]#26. Función de Sine Circle:[br]def sine_circle(x, y, a, b, c, d):[br] xn = math.sin(a * y) + c * math.sin(a * x)[br] yn = math.sin(b * x) + d * math.sin(b * y)[br] return xn, yn[br][br]#27. Función de Newton-Leipnik:[br]def newton_leipnik(x, y, a):[br] dx = y[br] dy = -x + a * y - y ** 2[br] return dx, dy[br][br]#28. Función de Duffing:[br]def duffing(x, y, a, b, c, d):[br] dx = y[br] dy = -a * x - b * y - c * x ** 3 + d * math.cos(x)[br] return dx, dy[br][br]#29. Función de Rössler caótica:[br]def rossler_caotica(x, y, z, a, b, c):[br] dx = -y - z[br] dy = x + y * (a + z)[br] dz = b + z * (x - c * z)[br] return dx, dy, dz[br][br]#30. Función de Lorenz modificada:[br]def lorenz_mod(x, y, z, a, b, c, d):[br] dx = -a * x + a * y[br] dy = b * x - y - x * z[br] dz = x * y - c * z + d * z ** 2[br] return dx, dy, dz[br][br]#30. Ecuación de Lorenz modificada:[br]def lorenz_mod_map(x, y, z, sigma=10, rho=28, beta=8/3, a=0.25):[br] dx_dt = sigma * (y - x)[br] dy_dt = x * (rho - z) - y[br] dz_dt = x * y - beta * z + a * z ** 2[br] return x + dx_dt, y + dy_dt, z + dz_dt[br][br]x = 0.1[br]y = 0.1[br]z = 0.1[br]for i in range(100):[br] x, y, z = lorenz_mod_map(x, y, z)[br] print(x, y, z)[br] [br]#31. Función de Halvorsen:[br]def halvorsen(x, y, z, a):[br] dx = -a * x - 4 * y - 4 * z - y ** 2[br] dy = -a * y - 4 * z - 4 * x - z ** 2[br] dz = -a * z - 4 * x - 4 * y - x ** 2[br] return dx, dy, dz[br][br]#32. Ecuación del mapa de círculo:[br]import math[br]def circle_map(theta, k):[br] return theta + k * math.sin(2 * math.pi * theta)[br][br]theta = 0.1[br]k = 0.4[br]for i in range(100):[br] theta = circle_map(theta, k)[br] print(theta)[br][br][br]#33. Función de Sine Logistic:[br]def sine_logistic(x, y, a, b, c, d):[br] xn = a * y * math.sin(b * x) + c * math.sin(d * x)[br] yn = x[br] return xn, yn[br][br]#34. Función de Sine Quadratic:[br]def sine_quadratic(x, y, a, b, c, d):[br] xn = a * y * math.sin(b * x) + c * x * math.cos(d * y)[br] yn = x * x - y * y[br] return xn, yn[br][br]#35. Función de Burgers:[br]def burgers(x, y, a, b):[br] dx = -a * x + y * x[br] dy = b - y * x[br] return dx, dy
Geogebra Python

Information: Python - Ecuaciones y Funciones Caóticas Recursivas