Hello, I have run into a problem with various matrices. I have read Gotchas and Pitfalls and tried to search around, but I was unable to find anything relevant.
For some matrices M, the *M.is_indefinite* simply *returns no output*. I have noticed that M.eigenvals() works for on these matrices, however, M.diagonalize() runs for more than a minute before it gives an output. Matrices that have caused this problem for me: M1 = Matrix(([4, 2, sqrt(3)], [2, 2, 0], [sqrt(3), 0, 1] )) M1.is_indefinite M2 = Matrix(([4, 2, 1], [2, 2, 0], [1, 0, 1] )) M2.is_indefinite M3 = Matrix(([14, -9, 0], [-9, 32, 30], [0, 30, 1])) M3.is_indefinite M4 = Matrix(([1, -4, -6], [-4, 2, 3], [-6, 3, 8] )) M4.is_indefinite Link to SymPy Live output <https://live.sympy.org/?evaluate=A%20%3D%20Matrix((%5B4%2C%202%2C%20sqrt(2)%5D%2C%20%5B2%2C%202%2C%200%5D%2C%20%5Bsqrt(2)%2C%200%2C%201%5D%20))%20%0A%23--%0AA.is_indefinite%0A%23--%0AM1%20%3D%20Matrix((%5B4%2C%202%2C%20sqrt(3)%5D%2C%20%5B2%2C%202%2C%200%5D%2C%20%5Bsqrt(3)%2C%200%2C%201%5D%20))%0A%23--%0AM1.is_indefinite%0A%23--%0AM2%20%3D%20Matrix((%5B4%2C%202%2C%201%5D%2C%20%5B2%2C%202%2C%200%5D%2C%20%5B1%2C%200%2C%201%5D%20))%0A%23--%0AM2.is_indefinite%0A%23--%0AM3%20%3D%20Matrix((%5B14%2C%20-9%2C%200%5D%2C%20%5B-9%2C%2032%2C%2030%5D%2C%20%5B0%2C%2030%2C%201%5D))%20%0A%23--%0AM3.is_indefinite%0A%23--%0AM4%20%3D%20Matrix((%5B1%2C%20-4%2C%20-6%5D%2C%20%5B-4%2C%202%2C%203%5D%2C%20%5B-6%2C%203%2C%208%5D%20))%0A%23--%0AM4.is_indefinite%0A%23--%0A> . Some *bigger matrices B* returns error *# Since 'simplify' flag is unsupported in roots() MatrixError: Could not compute eigenvalues for Matrix* *when using B.is_indefinite*, when I use B.*is_indefinite.* I get same kind of error for B.eigenvals() and B.diagonalize(). Matrices that have caused this problem for me: B1 = Matrix(([3, -1, 1, 1, 0, 0], [-1, 2, 0, 1, 0, 0], [1, 0, 1, 0, 0, 0], [ 1, 1, 0, 1, 1, 0], [0, 0, 0, 1, 4, 1], [0, 0, 0, 1, 1, 2] )) B1.is_indefinite B1.eigenvals() B1.diagonalize() B2 = Matrix([[12, -4, 4, 3, 1, 0], [-4, 6, -1, 2, 1, 0], [4, -1, 2, 1, 0, 0 ], [3, 2, 1, 5, 6, 3], [1, 1, 0, 6, 18, 6], [0, 0, 0, 3, 6, 5]]) # this is in fact L2 = L1.T*L1 B2.is_indefinite B2.eigenvals() B2.diagonalize() B3 = Matrix(([1, -1, 1, 0, 0, 1], [-1, 2, 1, 0, 2, 0], [1, 1, 6, 2, 3, 0], [ 0, 0, 2, 1, 4, 0], [0, 2, 3, 4, 5, 1], [1, 0, 0, 0, 1, 2] )) B3.is_indefinite B3.eigenvals() B3.diagonalize() Link to SymPy Live output <https://live.sympy.org/?evaluate=B1%20%3D%20Matrix((%5B3%2C%20-1%2C%201%2C%201%2C%200%2C%200%5D%2C%20%5B-1%2C%202%2C%200%2C%201%2C%200%2C%200%5D%2C%20%5B1%2C%200%2C%201%2C%200%2C%200%2C%200%5D%2C%20%5B1%2C%201%2C%200%2C%201%2C%201%2C%200%5D%2C%20%5B0%2C%200%2C%200%2C%201%2C%204%2C%201%5D%2C%20%5B0%2C%200%2C%200%2C%201%2C%201%2C%202%5D%20))%0A%23--%0AB1.is_indefinite%0A%23--%0AB1.eigenvals()%0A%23--%0AB1.diagonalize()%0A%23--%0AB2%20%3D%20Matrix(%5B%5B12%2C%20-4%2C%204%2C%203%2C%201%2C%200%5D%2C%20%5B-4%2C%206%2C%20-1%2C%202%2C%201%2C%200%5D%2C%20%5B4%2C%20-1%2C%202%2C%201%2C%200%2C%200%5D%2C%20%5B3%2C%202%2C%201%2C%205%2C%206%2C%203%5D%2C%20%5B1%2C%201%2C%200%2C%206%2C%2018%2C%206%5D%2C%20%5B0%2C%200%2C%200%2C%203%2C%206%2C%205%5D%5D)%0A%23--%0AB2.is_indefinite%0A%23--%0AB2.eigenvals()%0A%23--%0AB2.diagonalize()%0A%23--%0AB3%20%3D%20Matrix((%5B1%2C%20-1%2C%201%2C%200%2C%200%2C%201%5D%2C%20%5B-1%2C%202%2C%201%2C%200%2C%202%2C%200%5D%2C%20%5B1%2C%201%2C%206%2C%202%2C%203%2C%200%5D%2C%20%5B0%2C%200%2C%202%2C%201%2C%204%2C%200%5D%2C%20%5B0%2C%202%2C%203%2C%204%2C%205%2C%201%5D%2C%20%5B1%2C%200%2C%200%2C%200%2C%201%2C%202%5D%20))%0A%23--%0AB3.is_indefinite%0A%23--%0AB3.eigenvals()%0A%23--%0AB3.diagonalize()%0A%23--%0A> . I have this problem on my Linux machine (SymPy 1.5.1, Python 3.8.2-64-bit) as well as on the SymPy Live (SymPy 1.5.1, Python 2.7.12). Please, could you tell me if I’m just doing something wrong (hopefully it’s just that), or if SymPy is really unable to perform these operations? Thanks. : - ) -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/3963eddf-e9fd-487d-949a-3ce151f3988f%40googlegroups.com.