标签列表受保护 - Mathematica - 多变量矩阵方程

问题描述 投票:0回答:1

这是我的代码及其产生的错误。

我的函数有两个输入,输出是一个矩阵,其输入是根据输入。

我做了与典型函数相同的事情,但我之前没有使用矩阵。

In[390]:= 
RotMat[B_] := {{Cos[B], Sin[B]}, {-Sin[B], 
   Cos[B]}}

In[391]:= M1 := {{Exp[I*G], 0}, {0, 1}}

In[392]:= M2 := {{0, 0}, {0, 1}}

In[393]:= Qy := Exp[I*Pi/4]*{{1, 0}, {0, -I}}

In[394]:= Qx := Exp[-I*Pi/4]*{{1, 0}, {0, I}}

In[395]:= 
TransformX[A1_ , T1_] := 
 RotMat[-A1].M1.RotMat[A1].\
Qx.RotMat[-T1].M2.RotMat[\
T1]

During evaluation of In[395]:= SetDelayed::write: Tag List in {{0,I E^(-((I \[Pi])/4)) (-Cos[A] Sin[A]+E^(I G) Cos[A] Sin[A])},{0,I E^(-((I \[Pi])/4)) (Cos[A]^2+E^(I G) Sin[A]^2)}}[A1_,T1_] is Protected.

Out[395]= $Failed

我尝试使用更简单的多变量矩阵函数进行故障排除,但没有错误

In[413]:= f[foo_, bar_] := {{foo, bar}, {bar, foo}}

In[414]:= f[1, 2]

Out[414]= {{1, 2}, {2, 1}}

In[415]:= g[foo_, bar_] := foo + bar
g[1, 2]

Out[416]= 3
list function tags wolfram-mathematica
1个回答
0
投票

b3m2a1给出了我需要的建议。谢谢,大帮助。

我需要将Clear [TransformX]放在TransformX上面,以便在重新运行代码时没有问题。

© www.soinside.com 2019 - 2024. All rights reserved.