Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In the below examples, clearly m_want = m_l * m_r

Nope :

m_l = Matrix([[1, 1, 0, 0, 0, 0, 0, 0],
[0.7071067811865475, -0.7071067811865475, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 1, 0, 0, 0, 0],
[0, 0, 0.4142135623730962, -2.4142135623730976, 0, 0, 0, 0],
[0, 0, 0, 0, 1.0, 1.0, 0, -0.7071067811865483],
[0, 0, 0, 0, 1.414213562373096, -0.7071067811865457, -1, 0],
[0, 0, 0, 0, 0, -0.7071067811865472, 1.0, 1.0],
[0, 0, 0, 0, -1, 0, 1.4142135623730945, -0.7071067811865468]]
)

m_r = matrix([
[1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0],
[0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0],
[0.9238795325112865, 0.0, -0.9238795325112865, 0.0, 0.9238795325112865, 0.0, -0.9238795325112865, 0.0],
[0.0, -0.38268343236509034, 0.0, 0.38268343236509034, 0.0, -0.38268343236509034, 0.0, 0.38268343236509034],
[0.9807852804032295, 0, 0.19509032201612828, 0, -0.9807852804032295, 0, -0.19509032201612828, 0],
[0, -0.27589937928294467, 0, 1.38703984532215, 0, 0.27589937928294467, 0, -1.38703984532215],
[0.8314696123025446, 0, -0.5555702330196017, 0, -0.8314696123025446, 0, 0.5555702330196017, 0],
[0, -1.175875602419359, 0, 0.7856949583871042, 0, 1.175875602419359, 0, -0.7856949583871042]]
)

want =  matrix([
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
[0.7071067811865475, -0.7071067811865475, 0.7071067811865475, -0.7071067811865475, 0.7071067811865475, -0.7071067811865475, 0.7071067811865475, -0.7071067811865475],
[0.9238795325112865, -0.38268343236509034, -0.9238795325112865, 0.38268343236509034, 0.9238795325112865, -0.38268343236509034, -0.9238795325112865, 0.38268343236509034],
[0.38268343236508906, 0.9238795325112872, -0.38268343236508906, -0.9238795325112872, 0.38268343236508906, 0.9238795325112872, -0.38268343236508906, -0.9238795325112872],
[0.9807852804032303, 0.5555702330196018, 0.1950903220161283, 0.8314696123025453, -0.9807852804032303, -0.5555702330196018, -0.1950903220161283, -0.8314696123025453],
[0.5555702330196017, 0.19509032201612886, 0.8314696123025453, -0.9807852804032305, -0.5555702330196017, -0.19509032201612886, -0.8314696123025453, 0.9807852804032305],
[0.8314696123025446, -0.9807852804032307, -0.5555702330196028, -0.19509032201612753, -0.8314696123025446, 0.9807852804032307, 0.5555702330196028, 0.19509032201612753],
[0.19509032201612703, 0.8314696123025446, -0.9807852804032307, -0.5555702330196031, -0.19509032201612703, -0.8314696123025446, 0.9807852804032307, 0.5555702330196031]])

print(want-(m_l-m_r))

[   1.00000000000000   0.000000000000000    2.00000000000000    1.00000000000000    2.00000000000000    1.00000000000000    2.00000000000000    1.00000000000000]
[  0.000000000000000    1.00000000000000   0.707106781186547   0.292893218813453   0.707106781186547   0.292893218813453   0.707106781186547   0.292893218813453]
[   1.84775906502257  -0.382683432365090   -2.84775906502257  -0.617316567634910    1.84775906502257  -0.382683432365090   -1.84775906502257   0.382683432365090]
[  0.382683432365089   0.541196100146197  -0.796896994738185    1.87301746222690   0.382683432365089   0.541196100146197  -0.382683432365089  -0.541196100146197]
[   1.96157056080646   0.555570233019602   0.390180644032257   0.831469612302545   -2.96157056080646   -1.55557023301960  -0.390180644032257  -0.124362831115997]
[  0.555570233019602 -0.0808090572668158   0.831469612302545   0.406254564918919   -1.96978379539270   0.787915838453362   0.168530387697455  -0.406254564918919]
[   1.66293922460509  -0.980785280403231   -1.11114046603920  -0.195090322016128   -1.66293922460509    1.68789206158978   0.111140466039205  -0.804909677983872]
[  0.195090322016127  -0.344405990116814  -0.980785280403231   0.230124725367501   0.804909677983873   0.344405990116814  -0.433428281969864   0.476982055819046]

In the below examples, clearly m_want = m_l * m_r

Nope :

m_l = Matrix([[1, 1, 0, 0, 0, 0, 0, 0],
[0.7071067811865475, -0.7071067811865475, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 1, 0, 0, 0, 0],
[0, 0, 0.4142135623730962, -2.4142135623730976, 0, 0, 0, 0],
[0, 0, 0, 0, 1.0, 1.0, 0, -0.7071067811865483],
[0, 0, 0, 0, 1.414213562373096, -0.7071067811865457, -1, 0],
[0, 0, 0, 0, 0, -0.7071067811865472, 1.0, 1.0],
[0, 0, 0, 0, -1, 0, 1.4142135623730945, -0.7071067811865468]]
)

m_r = matrix([
[1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0],
[0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0],
[0.9238795325112865, 0.0, -0.9238795325112865, 0.0, 0.9238795325112865, 0.0, -0.9238795325112865, 0.0],
[0.0, -0.38268343236509034, 0.0, 0.38268343236509034, 0.0, -0.38268343236509034, 0.0, 0.38268343236509034],
[0.9807852804032295, 0, 0.19509032201612828, 0, -0.9807852804032295, 0, -0.19509032201612828, 0],
[0, -0.27589937928294467, 0, 1.38703984532215, 0, 0.27589937928294467, 0, -1.38703984532215],
[0.8314696123025446, 0, -0.5555702330196017, 0, -0.8314696123025446, 0, 0.5555702330196017, 0],
[0, -1.175875602419359, 0, 0.7856949583871042, 0, 1.175875602419359, 0, -0.7856949583871042]]
)

want =  matrix([
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
[0.7071067811865475, -0.7071067811865475, 0.7071067811865475, -0.7071067811865475, 0.7071067811865475, -0.7071067811865475, 0.7071067811865475, -0.7071067811865475],
[0.9238795325112865, -0.38268343236509034, -0.9238795325112865, 0.38268343236509034, 0.9238795325112865, -0.38268343236509034, -0.9238795325112865, 0.38268343236509034],
[0.38268343236508906, 0.9238795325112872, -0.38268343236508906, -0.9238795325112872, 0.38268343236508906, 0.9238795325112872, -0.38268343236508906, -0.9238795325112872],
[0.9807852804032303, 0.5555702330196018, 0.1950903220161283, 0.8314696123025453, -0.9807852804032303, -0.5555702330196018, -0.1950903220161283, -0.8314696123025453],
[0.5555702330196017, 0.19509032201612886, 0.8314696123025453, -0.9807852804032305, -0.5555702330196017, -0.19509032201612886, -0.8314696123025453, 0.9807852804032305],
[0.8314696123025446, -0.9807852804032307, -0.5555702330196028, -0.19509032201612753, -0.8314696123025446, 0.9807852804032307, 0.5555702330196028, 0.19509032201612753],
[0.19509032201612703, 0.8314696123025446, -0.9807852804032307, -0.5555702330196031, -0.19509032201612703, -0.8314696123025446, 0.9807852804032307, 0.5555702330196031]])

print(want-(m_l-m_r))

[   1.00000000000000   0.000000000000000    2.00000000000000    1.00000000000000    2.00000000000000    1.00000000000000    2.00000000000000    1.00000000000000]
[  0.000000000000000    1.00000000000000   0.707106781186547   0.292893218813453   0.707106781186547   0.292893218813453   0.707106781186547   0.292893218813453]
[   1.84775906502257  -0.382683432365090   -2.84775906502257  -0.617316567634910    1.84775906502257  -0.382683432365090   -1.84775906502257   0.382683432365090]
[  0.382683432365089   0.541196100146197  -0.796896994738185    1.87301746222690   0.382683432365089   0.541196100146197  -0.382683432365089  -0.541196100146197]
[   1.96157056080646   0.555570233019602   0.390180644032257   0.831469612302545   -2.96157056080646   -1.55557023301960  -0.390180644032257  -0.124362831115997]
[  0.555570233019602 -0.0808090572668158   0.831469612302545   0.406254564918919   -1.96978379539270   0.787915838453362   0.168530387697455  -0.406254564918919]
[   1.66293922460509  -0.980785280403231   -1.11114046603920  -0.195090322016128   -1.66293922460509    1.68789206158978   0.111140466039205  -0.804909677983872]
[  0.195090322016127  -0.344405990116814  -0.980785280403231   0.230124725367501   0.804909677983873   0.344405990116814  -0.433428281969864   0.476982055819046]

Hint : try to use exact values for your equations' coefficients : 0.7071067811865475 reeks $\displaystyle\frac{\sqrt{2}}{2}$, 0.4142135623730962 $\sqrt{2}-1$, etc...