Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sage can not invert some known invertible matrix #27869

Open
videlec opened this issue May 24, 2019 · 6 comments
Open

Sage can not invert some known invertible matrix #27869

videlec opened this issue May 24, 2019 · 6 comments

Comments

@videlec
Copy link
Contributor

videlec commented May 24, 2019

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:

Component: algebra

Issue created by migration from https://trac.sagemath.org/ticket/27869

@videlec videlec added this to the sage-8.8 milestone May 24, 2019
@videlec

This comment has been minimized.

@videlec

This comment has been minimized.

@videlec

This comment has been minimized.

@embray
Copy link
Contributor

embray commented Jun 14, 2019

comment:4

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).

@embray embray removed this from the sage-8.8 milestone Jun 14, 2019
@Torrencem
Copy link
Mannequin

Torrencem mannequin commented Jul 6, 2019

comment:5

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!

@Torrencem Torrencem mannequin added p: minor / 4 and removed p: major / 3 labels Jul 6, 2019
@videlec
Copy link
Contributor Author

videlec commented Jul 12, 2019

comment:6

Replying to @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 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!

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants