Posts
-
Mar 1, 2017
Scheduling class presentations using linear programming with Python
My first year programming class culminates in a final week of group presentations. This is always a highlight of the teaching period as I get to see the awesome things my students have come up with. However, scheduling 30-40 group presentations every year could be a real nightmare. This is where mathematics comes to the rescue. I’ll describe in this post how I use linear programming implemented in the Python library Pulp to get the schedule easily.
... -
Nov 6, 2016
A linear algebraic implementation of support enumeration for the computation of equilibria using numpy
Gambit is the leading piece of software for computing Nash equilibria of strategic games. A numpy of algorithms are implemented that take advantage of the higher dimensional geometry relating to the theory of games. In this post I will describe an approach for finding Nash equilibria (of 2 player games) that reduces to solving two simple Matrix equations. This can be implemented in Python using just numpy (and is already implemented in sagemath), I will also introduce (briefly) a library that does just that.
... -
Oct 29, 2016
Anscombe's quartert, variability and studying queues with Python
Anscombe’s quartet is a great example of the importance of fully understanding variability in a data set: it is a set of 4 data sets with the same summary measures (mean, std, etc…), the same correlation and the same regression line but with very different distributions. In this post I’ll show how easy it is to play with Anscombe’s quartet using Python and then talk about another mathematical area where variability must be fully understood: the study of queues. I’ll do this with the Ciw python library.
... -
Oct 1, 2016
A make file to convert all Jupyter notebooks in a directory to pdfs
I’m going to be using Jupyter notebooks for the first time in a course I’m teaching (previously I have been using Sage notebooks and python scripting). I’d like to be able to share my notebooks with tutors and eventually students as both notebook but also pdfs. Thankfully the
...jupyter-nbconverte
command lets you easily convert notebooks to more or less whatever you want. Below is amake
file that will automatically check if any notebook files have changed and if they have convert them to pdf. -
Sep 26, 2016
Profiling and reducing memory consumption in Python
I am one of the core developers of the Axelrod-Python project. This Python library lets you carry out Iterated Prisoner’s dilemma tournaments. One of the great success of the library is the number of strategies it contains, at present (thanks to many awesome contributions) it has 139 strategies (149 if you count the cheaters). This is great but also created a bit of a challenge. Running full tournaments became quite expensive computationally. This is now fixed, thanks mainly to writing and reading to/from disk instead of using memory. This post will describe some tools and techniques that can be used to do this.
...