I created a matrix F2
using SparseArray
and ArrayFlatten
as follows:
f0[x_, y_] = (3 - (Cos[x] + Cos[y])) PauliMatrix[0] + 5 PauliMatrix[3];
nf = 2;
F1[x_, y_] =
SparseArray[{Band[{1, 1}, {2 nf, 2 nf}] -> {f0[x, y]},
Band[{1, 3}, {2 nf, 2 nf}] -> {7 PauliMatrix[0]},
Band[{3, 1}, {2 nf, 2 nf}] -> {7 PauliMatrix[0]}}];
nt = 2;
IC = SparseArray[{{(2 nf - 1), 1} -> 1, {(2 nf), 2} ->
1, {(2 nf - 1), 3} -> 1, {(2 nf), 4} -> 1}, {2 nf, 4 nt}];
F2[x_, y_] = ArrayFlatten[{{F1[x, y], IC}}];
As an example, I put nf=nt = 2
. but what I have is a very large matrix. The problem now is that F2[0, 0]
will not substitute x = 0
and y = 0
in the matrix. It is working if I define F2
with SetDelayed
, i.e., F2[x_, y_] := ....
. But I do not want to use SetDelayed
because I have heavy calculations to do with F2
. So how can I solve this, please?