# Eigenvalues of matrices of Laurent polynomials Say that I have a matrix whose entries are univariate Laurent polynomials over complex numbers. In that case, I can substitute the variable for non-zero complex numbers to obtain an ordinary complex matrix. My question is the following: what the correct way to obtain the eigenvalues of the resulting complex matrix? My first guess was to do something like the following which just throws a NotImplementedError:

sage: R = LaurentPolynomialRing(CC, 'x')
sage: x = R.gens()
sage: m = matrix([[x]])
sage: m.subs({x: 2}).eigenvalues()

edit retag close merge delete

Sort by » oldest newest most voted

One structural way of obtaining the answer you want is to first define the homomorphism from the laurent series ring to CC (or whatever ring you want); in your case the one obtained from substituting a particular complex value for x:

sage: s=Hom(R,CC)(2)
sage: s
Ring morphism:
From: Univariate Laurent Polynomial Ring in x over Complex Field with 53 bits of precision
To:   Complex Field with 53 bits of precision
Defn: 1.00000000000000*x |--> 2.00000000000000


Making sure this gets applied to a matrix properly is now just (tedious) bookkeeping:

sage: mm=matrix(s.codomain(),m.nrows(),m.ncols(),[s(n) for n in m.list()] )
sage: mm.eigenvalues()
... UserWarning ...
[2.00000000000000]


Ideally, sage would know how to do the bookkeeping so that the definition of mm above can be written as

sage: mm=m.change_ring(s)
<doesn't work currently>

more

Thanks for the answer. I'd upvote both of them if I had the karma.

Hello,

The problem with your code is that the substitution does a too naive substitution

sage: R = LaurentPolynomialRing(CC, 'x')
sage: x = R.gens()
sage: m = matrix([[x]])
sage: mm = m.subs({x: 2})
sage: mm.base_ring()
Univariate Laurent Polynomial Ring in x over Complex Field with 53 bits of precision


In order to get eigenvalues, you need to say explicitely that the matrix is now defined over complex numbers

sage: mm.change_ring(CC).eigenvalues()
... UserWarning ...
[2.00000000000000]


EDIT: as mentioned in the comment, the above solution does not work. This is because there is no way to initialize a complex number from a power series, even if it is constant

sage: a = R(CC(2,1))
sage: CC(a)
Traceback (most recent call last):
...
TypeError: unable to coerce to a ComplexNumber: <type 'sage.rings.power_series_poly.PowerSeries_poly'>


In the case the constant is real it works by some strange magic.

Vincent

more

Thanks for the answer. That almost works. If I replace the '2' of the example by a non-real, though, I get a TypeError instead. Can anything be done about that?

I also opened a sage-devel thread to modify matrix.subs(). It would also be cool to allow constant power series to be converted to their base ring.

Nifty. Hope that one goes through. I've accepted the other answer as it does the job for now.