Closed ev-br closed 1 year ago
Running the smoke simulation (smoke_1.py) under numpy 1.24.2 fails to apply binary subtraction operator on boolean arrays. A quick-and-dirty fix to restore the simulation:
smoke_1.py
$ git diff HEAD^ diff --git a/e2e/smoke/smoke_1.py b/e2e/smoke/smoke_1.py index f858fde..5cca8eb 100644 --- a/e2e/smoke/smoke_1.py +++ b/e2e/smoke/smoke_1.py @@ -40,7 +40,7 @@ def initialization(): D = np.fromfunction(distance, shape) return np.where(D <= radius, True, False) - D = disc(radius=32) - disc(radius=16) + D = disc(radius=32) ^ disc(radius=16) dens[...] = D*source/10 u[:, :] = force * 0.1 * np.random.uniform(-1, 1, u.shape) v[:, :] = force * 0.1 * np.random.uniform(-1, 1, u.shape)
I'll take a chance to say huge thanks for the book. I keep recommending it to students.
Also in mandelbrot.py: https://github.com/rougier/from-python-to-numpy/blob/master/code/mandelbrot.py#L34 uses np.negative
mandelbrot.py
np.negative
Thanks! Can you make a PR?
done: https://github.com/rougier/from-python-to-numpy/pull/111
Running the smoke simulation (
smoke_1.py
) under numpy 1.24.2 fails to apply binary subtraction operator on boolean arrays. A quick-and-dirty fix to restore the simulation:I'll take a chance to say huge thanks for the book. I keep recommending it to students.