Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def mandel_iter_vectorized(a,b,Nx,Ny,max_escape_time):
- escape_times = np.empty((Ny,Nx))
- escape_times[:] = -1
- x = np.zeros([Ny,Nx])
- y = np.zeros([Ny,Nx])
- for count in range(max_escape_time+1):
- print("count",count)
- print("escape",escape_times)
- x_pow_2 = x**2
- y_pow_2 = y**2
- below = x_pow_2 + y_pow_2 <= 4 #get the points the are not diverging
- xtemp=x[below]
- x[below] = x_pow_2[below] - y_pow_2[below] + a[below]
- y[below] = 2*xtemp*(y[below]) + b[below]
- # print(below)
- escape_times += below
- print("res",escape_times)
- return escape_times
- 3 3 -2 1 -1 1 5 2 1
- count 0
- escape [[-1. -1. -1.]
- [-1. -1. -1.]
- [-1. -1. -1.]]
- count 1
- escape [[ 0. 0. 0.]
- [ 0. 0. 0.]
- [ 0. 0. 0.]]
- count 2
- escape [[ 0. 1. 1.]
- [ 1. 1. 1.]
- [ 0. 1. 1.]]
- count 3
- escape [[ 0. 2. 1.]
- [ 2. 2. 2.]
- [ 0. 2. 1.]]
- count 4
- escape [[ 0. 3. 1.]
- [ 3. 3. 2.]
- [ 0. 3. 1.]]
- count 5
- escape [[ 0. 3. 1.]
- [ 4. 4. 2.]
- [ 0. 3. 1.]]
- res [[ 0. 3. 1.]
- [ 5. 5. 2.]
- [ 0. 3. 1.]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement