There have been some recent improvements to the code handling this which you could try out by installing the pre-release of 1.6 with pip:
pip install -U --pre sympy -- Oscar On Thu, 14 May 2020 at 09:07, JS <jakub.sko...@gmail.com> wrote: > > 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. > > > > 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. > > 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. -- 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/CAHVvXxTiX0%2BSZvA%2B4rbyJi3xHSxcYfaicgtU-oCeKFxoC03qyw%40mail.gmail.com.