I wrote this here because I was having some trouble with evaluating the matrix with lambdify and array arguments. There may be a better way to construct this matrix, but it is probably fine for now.