Search code examples
listfunctiontagswolfram-mathematica

Tag List is protected - Mathematica - Multivariable matrix equations


Here is my code and the error it produced.

My function has two inputs and the output is a matrix whose entries are in terms of the inputs.

I did the same thing that one does for typical functions, but I have not done this with matrices before.

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

I tried troubleshooting with a simpler multivariable matrix function, but there were no errors with that

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

Solution

  • b3m2a1 gave the advice I needed. Thanks, big help.

    I need to put Clear[TransformX] above TransformX so there is no trouble when I re-run my code.