Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 1735
Image: ubuntu1804
Kernel: Python 3 (system-wide)
import numpy as np import matplotlib.pyplot as plt step = 0.01 def diss(x,y): return np.sqrt(x**2+y**2) x = np.arange(-1 ,1,step) y = np.arange(-1,1,step) x0 = -0.8 y0 = 0.168 px = x0 py = y0 z = np.zeros(len(x),len(y)) for i in range(len(x)): for j in range(len(y)): counter = 0 while diss(px,py)<2 and counter <500: p1 = px**2 - py**2 p2 = py**2 - px**2 px = p1 + x0 py = p2 + y0 counter +=1 z[i,j] = counter plt.imshow(z) plt.show()
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-1-517909353003> in <module> 16 py = y0 17 ---> 18 z = np.zeros(len(x),len(y)) 19 20 for i in range(len(x)): TypeError: data type not understood