Is there a way to create a matrix $q$ of dimension $d$ with constraints on the indices given by:
$$d\longrightarrow dimension$$
$i,j $ are indices
$$q_{i,j}=\begin{cases} -b & j=i+d,\\ c & j=i+1,\\ l & j=d+i\pm1. \end{cases}$$
$b,c,l$ are constants.
This seems like a good job for Piecewise:
q[i_, j_] := Piecewise[{{-b, j == i + d}, {c, j == i + 1},
{l, j == d + i + 1}, {l, j == d + i - 1}}]
Now you can build the matrix:
d = 8; n = 15; (mat = Array[q, {n, n}]) // MatrixForm
which gives the same answer as cvgmt.
Maybe need to chack the definition of such matrix,it seems not right.
d = 8;
n = 15;
q=SparseArray[{{i_, j_} /; j == i + 1 ->
c, {i_, j_} /; j == i + d -> -b, {i_, j_} /;
j == d + i + 1 || j == d + i - 1 -> l}, {n, n}]
q//MatrixForm
Or
d = 8;
n = 15;
m = SparseArray[{Band[{1, 1+1}] -> c, Band[{1, 1 + d}] -> -b,
Band[{1, d + 1 + 1}] -> l, Band[{1, d + 1 - 1}] -> l}, {n, n}]
m // MatrixForm
q[i, j]and thenmatrix = Array[q, {d, d}]$\endgroup$