Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Inverses of matrices of Laurent polynomials

This question is rather similar in spirit to my previous question in that it's about figuring out how to "correctly" manipulate matrices of polynomials, ensuring that everything stays in the right rings.

In this case, I have a matrix, all of whose elements are of the form Univariate Laurent Polynomial Ring in t over Integer Ring. The matrix has an inverse over this ring, yet sage insists that the entries of the inverse belong to Fraction Field of Univariate Polynomial Ring in t over Integer Ring. Here's a minimal example:

sage: R.<t> = LaurentPolynomialRing(ZZ)
sage: f = t^2
sage: mat = matrix([[f]])
sage: mat[0,0].parent()
Univariate Laurent Polynomial Ring in t over Integer Ring
sage: mat.inverse()
[1/t^2]
sage: mat.inverse()[0,0].parent()
Fraction Field of Univariate Polynomial Ring in t over Integer Ring

Desired output:

sage: mat.inverse()
[t^-2]
sage: mat.inverse()[0,0].parent()
Univariate Laurent Polynomial Ring in t over Integer Ring

What would have been the correct way to obtain what I want?

Inverses of matrices of Laurent polynomials

This question is rather similar in spirit to my previous question in that it's about figuring out how to "correctly" manipulate matrices of polynomials, ensuring that everything stays in the right rings.

In this case, I have a matrix, all of whose elements are of the form Univariate Laurent Polynomial Ring in t over Integer Ring. The matrix has an inverse over this ring, yet sage insists that the entries of the inverse belong to Fraction Field of Univariate Polynomial Ring in t over Integer Ring. Here's a minimal example:

sage: R.<t> = LaurentPolynomialRing(ZZ)
sage: f = t^2
sage: mat = matrix([[f]])
sage: mat[0,0].parent()
Univariate Laurent Polynomial Ring in t over Integer Ring
sage: mat.inverse()
[1/t^2]
sage: mat.inverse()[0,0].parent()
Fraction Field of Univariate Polynomial Ring in t over Integer Ring

Desired output:

sage: mat.inverse()
[t^-2]
sage: mat.inverse()[0,0].parent()
Univariate Laurent Polynomial Ring in t over Integer Ring

What would have been the correct way to obtain what I want?

Using apply_map to force each entry back into the right ring does not immediately do the job:

sage: mat.inverse().apply_map(lambda f: R(f))
...
TypeError: denominator must be a unit
sage: mat.inverse().apply_map(R)
...
TypeError: denominator must be a unit

Inverses of matrices of Laurent polynomials

This question is rather similar in spirit to my previous question in that it's about figuring out how to "correctly" manipulate matrices of polynomials, ensuring that everything stays in the right rings.

In this case, I have a matrix, all of whose elements are of the form Univariate Laurent Polynomial Ring in t over Integer Ring. The matrix has an inverse over this ring, yet sage insists that the entries of the inverse belong to Fraction Field of Univariate Polynomial Ring in t over Integer Ring. Here's a minimal example:

sage: R.<t> = LaurentPolynomialRing(ZZ)
sage: f = t^2
sage: mat = matrix([[f]])
sage: mat[0,0].parent()
Univariate Laurent Polynomial Ring in t over Integer Ring
sage: mat.inverse()
[1/t^2]
sage: mat.inverse()[0,0].parent()
Fraction Field of Univariate Polynomial Ring in t over Integer Ring

Desired output:

sage: mat.inverse()
[t^-2]
sage: mat.inverse()[0,0].parent()
Univariate Laurent Polynomial Ring in t over Integer Ring

What would have been the correct way to obtain what I want?

Using apply_map to force each entry back into the right ring does not immediately do the job:

sage: R(1/f)
t^-2
sage: mat.inverse().apply_map(lambda f: R(f))
...
TypeError: denominator must be a unit
sage: mat.inverse().apply_map(R)
...
TypeError: denominator must be a unit