Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
49 views
ubuntu2004
Kernel: Python 3 (system-wide)
import numpy as np import matplotlib.pyplot as plt def Roessler(x, y, z, a=0.1, b=0.1, c=14): x_dot = -y - z y_dot = x + a*y z_dot = b + z*(x - c) return x_dot, y_dot, z_dot dt = 0.01 num_steps = 10000 xs = np.empty(num_steps + 1) ys = np.empty(num_steps + 1) zs = np.empty(num_steps + 1) xs[0], ys[0], zs[0] = (0., 2., 1.) for i in range(num_steps): x_dot, y_dot, z_dot = Roessler(xs[i], ys[i], zs[i]) xs[i + 1] = xs[i] + (x_dot * dt) ys[i + 1] = ys[i] + (y_dot * dt) zs[i + 1] = zs[i] + (z_dot * dt) ax = plt.figure().add_subplot(projection='3d') ax.plot(xs, ys, zs, lw=1.) ax.set_xlabel("X") ax.set_ylabel("Y") ax.set_zlabel("Z") ax.set_title("Roessler") plt.show()
Image in a Jupyter notebook
def Roessler(x, y, z, a=0.1, b=0.1, c=14): x_dot = -y - z y_dot = x + a*y z_dot = 0 return x_dot, y_dot, z_dot dt = 0.01 num_steps = 10000 xs = np.empty(num_steps + 1) ys = np.empty(num_steps + 1) zs = np.empty(num_steps + 1) xs[0], ys[0], zs[0] = (1., 2., 1) for i in range(num_steps): x_dot, y_dot, z_dot = Roessler(xs[i], ys[i], zs[i]) xs[i + 1] = xs[i] + (x_dot * dt) ys[i + 1] = ys[i] + (y_dot * dt) zs[i + 1] = zs[i] + (z_dot * dt) ax = plt.figure().add_subplot(projection='3d') ax.plot(xs, ys, zs, lw=1.) ax.set_xlabel("X") ax.set_ylabel("Y") ax.set_zlabel("Z") ax.set_title("Roessler") plt.show()
Image in a Jupyter notebook
def Roessler(x, y, z, a=0.1, b=0.1, c=14): x_dot = -y - z y_dot = 0 z_dot = b + z*(x - c) return x_dot, y_dot, z_dot dt = 0.01 num_steps = 10000 xs = np.empty(num_steps + 1) ys = np.empty(num_steps + 1) zs = np.empty(num_steps + 1) xs[0], ys[0], zs[0] = (1., 2., 1) for i in range(num_steps): x_dot, y_dot, z_dot = Roessler(xs[i], ys[i], zs[i]) xs[i + 1] = xs[i] + (x_dot * dt) ys[i + 1] = ys[i] + (y_dot * dt) zs[i + 1] = zs[i] + (z_dot * dt) ax = plt.figure().add_subplot(projection='3d') ax.plot(xs, ys, zs, lw=1.) ax.set_xlabel("X") ax.set_ylabel("Y") ax.set_zlabel("Z") ax.set_title("Roessler") plt.show()
Image in a Jupyter notebook
def Roessler(x, y, z, a=0.1, b=0.1, c=14): x_dot = 0 y_dot = x + a*y z_dot = b + z*(x - c) return x_dot, y_dot, z_dot dt = 0.01 num_steps = 10000 xs = np.empty(num_steps + 1) ys = np.empty(num_steps + 1) zs = np.empty(num_steps + 1) xs[0], ys[0], zs[0] = (1., 2., 1) for i in range(num_steps): x_dot, y_dot, z_dot = Roessler(xs[i], ys[i], zs[i]) xs[i + 1] = xs[i] + (x_dot * dt) ys[i + 1] = ys[i] + (y_dot * dt) zs[i + 1] = zs[i] + (z_dot * dt) ax = plt.figure().add_subplot(projection='3d') ax.plot(xs, ys, zs, lw=1.) ax.set_xlabel("X") ax.set_ylabel("Y") ax.set_zlabel("Z") ax.set_title("Roessler") plt.show()
Image in a Jupyter notebook
def Roessler(x, y, z, a=0.1, b=0.1, c=14): x_dot = -y - z y_dot = x + a*y z_dot = 0 return x_dot, y_dot, z_dot dt = 0.01 num_steps = 10000 xs = np.empty(num_steps + 1) ys = np.empty(num_steps + 1) zs = np.empty(num_steps + 1) xs[0], ys[0], zs[0] = (0., 2., 1.) for i in range(num_steps): x_dot, y_dot, z_dot = Roessler(xs[i], ys[i], zs[i]) xs[i + 1] = xs[i] + (x_dot * dt) ys[i + 1] = ys[i] + (y_dot * dt) zs[i + 1] = zs[i] + (z_dot * dt) ax = plt.figure().add_subplot(projection='3d') ax.plot(xs, ys, zs, lw=1.) ax.set_xlabel("X") ax.set_ylabel("Y") ax.set_zlabel("Z") ax.set_title("Roessler") plt.show()
Image in a Jupyter notebook
from tqdm import tqdm import matplotlib.pyplot as plt import numpy as np def LogisticMap(): mu = np.arange(0, 2, 0.0001) a = 0.1 c = 14 y = 0.2 z = 0.1 x = 0.5 # Valor inicial iters = 1000 # Número de iteraciones sin salida last = 100 # Finalmente dibuje el número de iteraciones del resultado for i in tqdm(range(iters+last)): x = -(x + a*y) - (mu + z*(x - c)) if i >= iters: plt.plot(mu, x, ',k', alpha=1) # alphaSet transparencia plt.show() LogisticMap()
100%|██████████| 1100/1100 [00:00<00:00, 2762.77it/s]
Image in a Jupyter notebook
from tqdm import tqdm import matplotlib.pyplot as plt import numpy as np def LogisticMap(): mu = np.arange(0, 2, 0.0001) x = 0.2 # Valor inicial iters = 1000 # Número de iteraciones sin salida last = 100 # Finalmente dibuje el número de iteraciones del resultado for i in tqdm(range(iters+last)): x = -(x + a*y) - (mu + z*(x - c)) if i >= iters: plt.plot(mu, x, ',k', alpha=0.5) # alphaSet transparencia plt.show() LogisticMap()
0%| | 0/1100 [00:00<?, ?it/s]
--------------------------------------------------------------------------- NameError Traceback (most recent call last) /tmp/ipykernel_1121/2146635841.py in <cell line: 18>() 16 17 ---> 18 LogisticMap() /tmp/ipykernel_1121/2146635841.py in LogisticMap() 10 last = 100 # Finalmente dibuje el número de iteraciones del resultado 11 for i in tqdm(range(iters+last)): ---> 12 x = -(x + a*y) - (mu + z*(x - c)) 13 if i >= iters: 14 plt.plot(mu, x, ',k', alpha=0.5) # alphaSet transparencia NameError: name 'a' is not defined