I have two sparse NxN matrices A and B, and I want to solve A*B = C for a specific dense NxN matrix C.
A small scale example of this problem (for N = 4) is :
vars = [x0 x1 x2 x3 x4 x5 x6 x7 y0 y1 y2 y3 y4 y5 y6 y7]A = [[y0 y1 0 0] [y2 y3 0 0] [ 0 0 y4 y5] [ 0 0 y6 y7]]B = [[x0 0 x1 0] [ 0 x2 0 x3] [x4 0 x5 0] [ 0 x6 0 x7]]C = [[1.0, 1.0, 1.0, 1.0], [0.707106781186548, -0.7071067811865477, 0.707106781186548, -0.7071067811865477], [0.9238795325112871, -0.3826834323650893, -0.9238795325112868, 0.38268343236508967], [0.38268343236509117, 0.9238795325112865, -0.38268343236509067, -0.9238795325112865]]
when calling
sol = vpasolve(A*B == C, vars)
I get the empty-set [0*1 sym] for all variables.
However, an exact (up to the precision of the given matrix C) solution does exist because we can remplace A and B by
A = [[ 1, 1, 0, 0] [0.707106781186548, -0.707106781186548, 0, 0] [ 0, 0, 1, 1] [ 0, 0, 0.4142135623730962, -2.4142135623730976]]B = [[ 1, 0, 1, 0] [ 0, 1, 0, 1] [0.9238795325112871, 0, -0.9238795325112868, 0] [ 0, -0.3826834323650893, 0, 0.3826834323650893]]
And you can check by yourself that A*B = C.
I must have done something wrong, but I can't find out what and where. Am I using the correct solver?
Best Answer