Python implementation

Here is an example of how to construct the coefficient matrices for N = 5, P = 3, and Q = 1