Posts about numpy
Quantitative data analysis of the 2D Ising model
Last time, we made a neat little implementation of a 2D Ising model simulation, and we showed that it looks reasonable. Well, that it might, but we can't be certain of that! I know I said that next time we would, er, %timeit
, put it on the GPU and make it GO FAST, but perhaps it's a better idea to start with some data analysis first, making sure the result we're getting are quantitatively what we would like them to be - physical.
Parallelizable Numpy implementation of 2D Ising model
In the next few posts I'd like to discuss a fun project I've been procrastinating things with recently - a parallelizable (up to the GPU level) Python Numpy implementation of the 2D Ising model, which I won't introduce at length here because it's been covered really well in multiple places out there and I'd rather not repeat them.
The gist of it is that we have a grid of discrete spins represented by integers, +1 for spin up and -1 for spin down. Each spin interacts with its nearest neighbors via a sum of products of that spin's value and the neighbor's value, times minus a positive constant J. The minus is there so that spins pointing the same way decrease the total energy and spins pointing in the opposite direction increase it.
NumPy-ish GPU computations with CuPy
I've recently come across the amazing CuPy library, and given that I haven't updated this blog in a while, I figured this would be a great opportunity to showcase a few of its capabilities.
If you haven't heard yet, CuPy is NumPy, but on the GPU, and it's amazing how close that simple description is to reality.