Opened 3 years ago

Last modified 3 years ago

## #27869 new defect

# Sage can not invert some known invertible matrix

Reported by: | Vincent Delecroix | Owned by: | |
---|---|---|---|

Priority: | minor | Milestone: | |

Component: | algebra | Keywords: | |

Cc: | Merged in: | ||

Authors: | Reviewers: | ||

Report Upstream: | N/A | Work issues: | |

Branch: | Commit: | ||

Dependencies: | Stopgaps: |

### Description (last modified by )

sage: R.<a,b,c,d> = ZZ[] sage: RR = R.quotient(a*d-b*c-1) sage: a,b,c,d = RR.gens() sage: m = matrix(2, [a,b,c,d]) sage: m.det() 1 sage: m.is_unit() True sage: m.inverse_of_unit() Traceback (most recent call last): <ipython-input-172-ee149830c95e> in <module>() ----> 1 m.inverse_of_unit() /usr/lib/python2.7/site-packages/sage/categories/rings.pyc in inverse_of_unit(self) 1162 pass 1163 -> 1164 inverse = ~self 1165 if inverse not in self.parent(): 1166 raise ArithmeticError("element is not a unit") /usr/lib/python2.7/site-packages/sage/matrix/matrix0.pyx in sage.matrix.matrix0.Matrix.__invert__ (build/cythonized/sage/matrix/matrix0.c:35554)() 5358 0.9999999999999999 5359 """ -> 5360 if not self.base_ring().is_field(): 5361 try: 5362 return ~self.matrix_over_field() /usr/lib/python2.7/site-packages/sage/misc/cachefunc.pyx in sage.misc.cachefunc.CachedMethodCaller.__call__ (build/cythonized/sage/misc/cachefunc.c:10240)() 1948 return cache[k] 1949 except KeyError: -> 1950 w = self._instance_call(*args, **kwds) 1951 cache[k] = w 1952 return w /usr/lib/python2.7/site-packages/sage/misc/cachefunc.pyx in sage.misc.cachefunc.CachedMethodCaller._instance_call (build/cythonized/sage/misc/cachefunc.c:9725)() 1824 True 1825 """ -> 1826 return self.f(self._instance, *args, **kwds) 1827 1828 cdef fix_args_kwds(self, tuple args, dict kwds): /usr/lib/python2.7/site-packages/sage/rings/quotient_ring.pyc in is_field(self, proof) 815 """ 816 if proof: --> 817 return self.defining_ideal().is_maximal() 818 else: 819 try: /usr/lib/python2.7/site-packages/sage/rings/ideal.pyc in is_maximal(self) 709 return self.is_prime() 710 else: --> 711 raise NotImplementedError 712 713 def is_primary(self, P=None): NotImplementedError:

### Change History (6)

### comment:1 Changed 3 years ago by

Description: | modified (diff) |
---|

### comment:2 Changed 3 years ago by

Description: | modified (diff) |
---|

### comment:3 Changed 3 years ago by

Description: | modified (diff) |
---|

### comment:4 Changed 3 years ago by

Milestone: | sage-8.8 |
---|

### comment:5 follow-up: 6 Changed 3 years ago by

Priority: | major → minor |
---|

A reduced example of the error is as follows:

R.<a,b,c,d> = ZZ[] Q = R.quotient(-b*c + a*d - 1) Q.defining_ideal().is_maximal() # Raises a NotImplementedError

If we could correct this error, I still don't think the matrix code example will work, but this is a good start

It's also worth pointing out that the `is_maximal`

function has a TODO (line 677 of rings/ideals.py):

.. TODO:: This is not implemented for many rings. Implement it!

It's obviously not implemented for this ring!

### comment:6 Changed 3 years ago by

Replying to gh-Torrencem:

A reduced example of the error is as follows:

R.<a,b,c,d> = ZZ[] Q = R.quotient(-b*c + a*d - 1) Q.defining_ideal().is_maximal() # Raises a NotImplementedErrorIf we could correct this error, I still don't think the matrix code example will work, but this is a good start

It's also worth pointing out that the

`is_maximal`

function has a TODO (line 677 of rings/ideals.py):.. TODO:: This is not implemented for many rings. Implement it!It's obviously not implemented for this ring!

Enhancing quotients of multivariate polynomial ring is another problem. To make inversion works, one can for example compute the matrix of cofactors. And each minor can easily be done (via a division free algorithm).

**Note:**See TracTickets for help on using tickets.

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).