For many years, I have used Python and Numpy and other packages in the same ecosystem for pretty much all of my projects. They have been my go-to for many reasons. However, a recent event with Numpy triggered my consideration to pick up another dynamically-typed language instead.
I stumbled upon Julia, as it is quite widely used in the mathematics community, and quickly discovered how nicely designed and fast it is. Coming from Python, I find Julia to be quite easy to understand. Still, there were some quirks that I had to get used to, particularly dealing with types explicitly (you don’t really need to do much of this, but this practice can speed up the code) and the way Julia handles inheritance and whatnot.
After reading the documentation and a few tutorials over a weekend, I figured the best and quickest to get myself oriented with the language is to do something with it—and preferably that something will be similar to what I would use it for in my own work. So, this post is a by-product of that. It goes over writing some simulation code for an opinion dynamics model from scratch in Julia. Rather than a full-on tutorial of how Julia works, what you will mostly find in this post is a documentation—frankly, commentation—mostly for myself of why and how I wrote the code I did, from the perspective of someone coming from Python.Continue reading