vpasolve returns emptyset for all variables, although a solution does exist (proof inside)
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jean-Philippe Leonard Bossuat
am 14 Dez. 2020
Kommentiert: Jean-Philippe Leonard Bossuat
am 1 Jan. 2021
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?
0 Kommentare
Akzeptierte Antwort
Karan Nandankar
am 30 Dez. 2020
Hi,
The reason why 'vpasolve' returns empty [0x1] structure is that it is not able to find any analytical solution for the system of symbolic equations.
>> A*B == C
[ x0*y0 == 1, x2*y1 == 1, x1*y0 == 1, x3*y1 == 1]
[ x0*y2 == 2^(1/2)/2, x2*y3 == -2^(1/2)/2, x1*y2 == 2^(1/2)/2, x3*y3 == -2^(1/2)/2]
[ x4*y4 == 8321567036706121/9007199254740992, x6*y5 == -3446905926800557/9007199254740992, x5*y4 == -8321567036706119/9007199254740992, x7*y5 == 6893811853601121/18014398509481984]
[ x4*y6 == 1723452963400287/4503599627370496, x6*y7 == 2080391759176529/2251799813685248, x5*y6 == -6893811853601139/18014398509481984, x7*y7 == -2080391759176529/2251799813685248]
As you can see, there are 16 equations with as many variables, but there are multiple instances when solving couple of equations together leads to an already existing one, which falls under a case of Infinite Solutions, and the one which you shared earlier belongs to one of them.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Assumptions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!