I want to do a simple thing:
M: matrix([a,b], [c,d]);
N: matrix([1,2], [3,4]);
solve(M = N, [a,b,c,d]);
but I get the result []
. If I break the above into many constraints, like this:
M: matrix([a,b], [c,d]);
N: matrix([1,2],[3,4]);
c1: M[1,1] = N[1,1];
c2: M[1,2] = N[1,2];
c3: M[2,1] = N[2,1];
c4: M[2,2] = N[2,2];
solve([c1, c2, c3, c4], [M[1,1], M[1,2], M[2,1], M[2,2]]);
I get a good result [[a=1,b=2,c=3,d=4]]
. But this method would be painful for big matrices. Is there some easier way to do this?
Converting matrixes to list can help
(%i1) M: matrix([a,b], [c,d])$
(%i2) N: matrix([1,2] [c,d])$
(%i3) f(M):= apply(join, args(M))$
(%i4) e: map("=", f(M), f(N));
(%o4) [a = 1, c = 3, b = 2, d = 4]
(%i5) solve(e, [a, b, c, d]);
(%o4) [a = 1, c = 3, b = 2, d = 4]