2021-10-07 19:01:14 +0100 received badge ● Nice Question (source) 2021-10-07 11:45:38 +0100 commented answer Diagonalize matrix numerically over $\mathbb{C}$ Is there a way to display the numerically-looking numbers the way sympy does it? I.e. sqrt(2) instead of 1.414213562373 2021-10-07 11:45:23 +0100 commented answer Diagonalize matrix numerically over $\mathbb{C}$ Is there a way to display the numerically-looking numbers the sympy does it? I.e. sqrt(2) instead of 1.414213562373? 2021-10-07 11:42:28 +0100 commented answer Diagonalize matrix numerically over $\mathbb{C}$ Thank you for a good answer, I accepted it. My mistake was I didn't try other fields. I should have googled for algebrai 2021-10-07 11:41:19 +0100 received badge ● Supporter (source) 2021-10-07 11:38:38 +0100 marked best answer Diagonalize matrix numerically over $\mathbb{C}$ Suppose I have a matrix m: $$m = \left(\begin{array}{rr} 2 & -3 \\ 1 & 0 \end{array}\right).$$ It is diagonalizable and has complex eigenvalues. I now want to diagonalize it, but get an error: In : m = matrix([[2, -3], [1, 0]]); m.diagonalization() ... ValueError: matrix entries must be from a field When I specify the field m = matrix(CDF, [[2, -3], [1, 0]]), I get ValueError: base field must be exact, but Complex Double Field is not. Specifying ComplexLazyField() instead of CDF raises NotImplementedError. So, apparently, Sage is trying to diagonalize the matrix symbolically, i.e. exactly. But what if I don't care about exactness and just want a straightforward numerical answer? This is how I would do it with sympy: In : import sympy as sp ...: m = sp.Matrix([[2, -3], [1, 0]]) ...: m.diagonalize() Out: (Matrix([ [1 - sqrt(2)*I, 1 + sqrt(2)*I], [ 1, 1]]), Matrix([ [1 - sqrt(2)*I, 0], [ 0, 1 + sqrt(2)*I]])) Notice that the output is actually exact. I know I can run this same Python code in Sage, but I assume there's a more native way to do it. To sum up, how do I get Sage to diagonalize a matrix over $\mathbb{C}$? How do I change the code if I only need the numerical answer? 2021-10-07 11:38:38 +0100 received badge ● Scholar (source) 2021-10-07 11:12:54 +0100 received badge ● Student (source) 2021-10-07 11:02:56 +0100 asked a question Diagonalize matrix numerically over $\mathbb{C}$ Diagonalize matrix numerically over $\mathbb{C}$ Suppose I have a matrix m:  m = \left(\begin{array}{rr} 2 & -3 \