List of eigenvalues of a list of abstract states

Suppose I have the states \Psi, \Phi and \Zeta and I also have the following relations given by the operators A and B when acting in the states

A.\Psi=1*\Psi;
B.\Psi=2*\Psi;
A.\Phi=3*\Phi;
B.\Phi=4*\Phi;
A.\Zeta=3*\Zeta;
B.\Zeta=4*\Zeta;


where I am denoting by a dot the action of A and B. If I define

list1={A,B};
list2={10*\Psi,5\Phi + \Zeta};


And, from them, I multiply the two lists

list3=Table[Table[i.j,{i,list1}],{j,list2}]



giving

list3={{A.10*\Psi,B.10*\Psi},{A.(5\Phi + \Zeta),B.(5\Phi + \Zeta)}}
={{1*(10*\Psi),2*(10*\Psi)},{3*(5\Phi + \Zeta),4*(5\Phi + \Zeta)}}


where the second line comes after using the relations given in the first lines of code.

How do I make Mathematica write only the eigenvalues of the operators A and B when acting on list2 (I want it to write {{1,2},{3,4}} from list3)?

• Can you please explain why 5\Phi + \Phi is not equal to 6\Phi? Also, I'm having troubles understanding the task ... Are you looking for something like: a[psi] = 1; b[psi] = 2; a[phi] = 3; b[phi] = 4; Table[f[First@Variables@j], {f, {a, b}}, {j, {10 psi, 6 phi}}]? Dec 26, 2021 at 23:18
• @Domen Sorry, It was a mistake and now I edited. Dec 27, 2021 at 0:31
• are you sure in advance that all the states in list2 are eigenstates? What should be the result of the code if it is not an eigenstate, for example, A[Ψ + Φ]? Dec 27, 2021 at 0:48
• @Domen Yes, all states in list2 are eigenstates of the operators in list1 in my case Dec 27, 2021 at 0:52
• In that case, the code from my comment above should work. Have you tried it? Given your definitions of the operators, the prefactors you are looking for can be simply determined by the combination of the operator and the state. Dec 27, 2021 at 0:57

As @Domen wrote in the comments, the question can be answered by the following code

A[\[Psi]] = 1;
B[\[Psi]] = 2;
A[\[Phi]] = 3;
B[\[Phi]] = 4;
A[\[Zeta]] = 3;
B[\[Zeta]] = 4;

list1 = {A, B};
list2 = {10*\[Psi], 5 \[Phi] + \[Zeta]};

list3 = Table[Table[i[First@Variables[j]], {i, list1}], {j, list2}]


which gives as the output the desired answer

{{1, 2}, {3, 4}}