I am having a hard time figuring this out:
( sample ) I have any matrix which can have an arbitrarily large dimension.
mat = SparseArray[Automatic, {4, 4},
0., {1, {{0, 1, 3, 5, 6}, {{2}, {1}, {3}, {4}, {2}, {3}}},
{5.4*Cos[1.23*x], 5.4*Cos[1.23*x], 2.7, 5.4*Cos[1.23*x], 2.7,
5.4*Cos[1.23*x]}}];(*4X4 matrix*)
eign[x_] := Eigensystem[mat]
evec[x_] := eign[x][[2]];
I find it hard to understand the evaluation order when I try to evaluate the function. Say, I want to find eval at x=1;
I try,
evec[1]
(* Unable to find all eigenvectors.
Out[128]= {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}*)
Table[evec[x], {x, 1}]
(*{{{0.316639, 0.63225, 0.63225, 0.316639}, {0.316639, -0.63225, 0.63225, -0.316639}, {0.63225, 0.316639, -0.316639, -0.63225}, {0.63225, -0.316639, -0.316639, 0.63225}}}*)
Table[evec[y], {y, 1}]
(* Unable to find all eigenvectors.
Out[128]= {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}*)
Can someone explain me what's going on in all three processes and why the 2nd one gives the value but not others. what's the most efficient way of obtaining value at any x value? Thank you
(Note: Set-delayed in the expression can't be removed if the matrix is large and complex. i.e. analytical eigensystem isn't possible in those problems. So, Evaluate
can't be used for those while defining the functions either )