ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 24 Aug 2014 20:13:39 +0200Minimal polynomial isn't minimal?https://ask.sagemath.org/question/23915/minimal-polynomial-isnt-minimal/Quoting [MathWorld](http://mathworld.wolfram.com/MatrixMinimalPolynomial.html),
> The minimal polynomial of a matrix $A$ is the monic polynomial in $A$ of smallest degree $n$ such that
>
> $$p(A) = \sum_{i=0}^n c_i A^i = 0$$.
I'd like to find the minimal polynomial of a matrix $A$ over the reals. My attempt:
sage: A = matrix(RR, [
....: [0,-9, 0, 0, 0, 0],
....: [1, 6, 0, 0, 0, 0],
....: [0, 0, 0,-9, 0, 0],
....: [0, 0, 1, 6, 0, 0],
....: [0, 0, 0, 0, 0,-5],
....: [0, 0, 0, 0, 1, 0]
....: ])
sage: f = A.minpoly()
sage: f.is_monic()
True
sage: f(A).is_zero()
True
However, $f$ doesn't appear to actually be the minimal polynomial:
sage: R.<x> = RR['x']
sage: g = x^4 - 6*x^3 + 14*x^2 - 30*x + 45
sage: g(x).is_monic()
True
sage: g(A).is_zero()
True
sage: g.degree() < f.degree()
True
Did I make a mistake or is this a bug?
I noticed that `A.minpoly()` gives $g$ if I do the computation over $\mathbb{Q}$ instead of $\mathbb{R}$. Perhaps the `minpoly` function just needs to be restricted to exact rings?WilsonSun, 24 Aug 2014 20:13:39 +0200https://ask.sagemath.org/question/23915/