How would I go about creating the matrix
[[ 1 2 0 0 0]
[-1 1 2 0 0]
[ 0 -1 1 2 0]
[ 0 0 -1 1 2]
[ 0 0 0 -1 1]]
using the numpy.diag()
function in Python?
I want to define the main diagonal and also the parallel diagonals of the matrix.