Linear Algebra III - Primitive Shapes in Numpy

Al Jabr pattern generated in Matplotlib

Al Jabr pattern, created using numpy and matplotlib © Sam Swift-Glasman

In this post we will start to break down techniques used to generate the piece Al-Jabr. This can be found on the first post in this series. In the embedded IPython notebook below, you will find an implementation of geometric arabic design using the numpy and matplotlib. These libraries as well as another called pandas, are the bread and butter of scientific python so this is a great chance to show some possibilities.

The Jupyter Notebook can be found with all of the other source files on this website at the Learning Machine Learning Github. I recommend you clone the repo and have a play with some of the parameters to get some different patterns.

A few notes about the maths and code below:

-The vectors and matrices are all in augmented matrix form to allow composition of transformations. Therefore 2D vectors are represented as 3d vectors, these are called homogenous coordinates.
More info about this can be found here and here.

-Numpy and Matplotlib are worth learning, there are some interesting examples below of numpy array slicing and multiple matplotlib figures. Lots of great tutorials out there for the two, will do at least a whole post on each library later in the series.

I hope you enjoy this as much as i did, comments below if you have any questions - next post will be implementing this in Houdini and Vex.