# How to treat Rule as an equality/equation

GROUPS:
 Hi guys,I am trying to solve a set of equations which have matrices (The code for that is at the bottom). Solutions are of this form{{k[1][2] -> 1 - k[1][1], k[2][2] -> 1 - k[2][1]}}{{k[1][2] -> -3 + k[1][1], k[2][2] -> 3 + k[2][1]}}Is there any way I can re-use these solutions to convert them in the form of equations as k[1][2]= 1 - k[1][1], as I intend to use these linear equation further for solving under constraints using Reduce:Reduce[{Sol1[[1, 1]] && Sol1[[1, 2]] && Sol2[[1, 1]] && Sol2[[1, 2]] && 0.9 <= m11 <= 1.1 && 0.9 <= m22 <= 1.1}, {k[1][1], k[1][2],  k[2][1], k[2][2]}] but as:  {{k[1][2] -> 1 - k[1][1], k[2][2] -> 1 - k[2][1]}} or {{k[1][2] -> -3 + k[1][1], k[2][2] -> 3 + k[2][1]}}   these are rules not equations, therefore I am unable to solve them automatically by excessing in this way "Sol1[[1, 1]]". Is there any way I can treat these rules -> as equations so that I can further use it for Reduce procedure?(you can copy paste the bellow code to execute).ThanksUsman ClearAll; K=Table[k[i][i],{i,1,2},{j,1,2}]; M=Table[m[i][i],{i,1,2},{j,1,2}]; Psi=Table[psi[i][i],{i,1,2}]; m[1][2]=0; m[2][1]=0; M//MatrixForm; Psi//MatrixForm; Sol1=Solve[K.Psi==(W^2*M).Psi/.{W->Sqrt[1],psi[1]->1,psi[2]->1,m[1][1]->1,m[2][2]->1},{k[1][1],k[1][2],k[2][1],k[2][2]}]Sol2=Solve[K.Psi==(W^2*M).Psi/.{W->Sqrt[3],psi[1]->1,psi[2]->-1,m[1][1]->1,m[2][2]->1},{k[1][1],k[1][2],k[2][1],k[2][2]}]
5 years ago
5 Replies
 Ilian Gachevski 1 Vote In[1]:= rules = {a -> b, {c -> d, e -> f}};        Equal @@@ Flatten[rules]Out[1]= {a == b, c == d, e == f}
5 years ago
 Awsome, thats good. Do it has any upper bound ? or I can convert hundreds or rules into equations using this structure?