我想定义一个对象,该对象在其他索引中的某些变量和张量中起作用。 我在它的尝试是:定义一个对象,它在某些变量和某些其他索引中的张量中起作用
Clear[mat, k];
mat[k_] := {{0,0},{0,0}};
mat[k_][[1, 1]] := k + 1
mat[k_][[1, 2]] := k + 2
mat[k_][[2, 1]] := k + 3
mat[k_][[2, 2]] := k + 4
mat[1]
它给人的输出继电器是:
During evaluation of In[268]:= SetDelayed::setps: mat[k_] in the part assignment is not a symbol. >>
Out[270]= $Failed
During evaluation of In[268]:= SetDelayed::setps: mat[k_] in the part assignment is not a symbol. >>
Out[271]= $Failed
During evaluation of In[268]:= SetDelayed::setps: mat[k_] in the part assignment is not a symbol. >>
Out[272]= $Failed
During evaluation of In[268]:= SetDelayed::setps: mat[k_] in the part assignment is not a symbol. >>
Out[273]= $Failed
Out[274]= {{0, 0}, {0, 0}}
可能有人请指出我出去,什么地方出了错这里,什么是得到我想要什么办法呢?
嗨,不客气,在Stackoverflow。请注意,您也可以在http://mathematica.stackexchange.com/上发帖,许多专家也会为您提供帮助。 –