#10063: Some determinants can not be computed
------------------------+---------------------------------------------------
   Reporter:  tmonteil  |       Owner:  AlexGhitza              
       Type:  defect    |      Status:  new                     
   Priority:  critical  |   Milestone:                          
  Component:  algebra   |    Keywords:  determinant, ring, ideal
     Author:            |    Upstream:  N/A                     
   Reviewer:            |      Merged:                          
Work_issues:            |  
------------------------+---------------------------------------------------
 To use some fast algorithms that only work for fields, the `determinant`
 method uses the `is_field` method for rings which uses the `is_maximal`
 method for ideals. Unfortunately, this method is not always implemented.

 The determinant is a very fundamental function, and there are many
 division-free algorithms that work in every ring, hence this method should
 never raise an error.

 Here is an example of the bug i encountered while testing a conjecture in
 combinatorics:

 {{{
 sage: A = GF(2)['x,y,z']
 sage: A.inject_variables()
 Defining x, y, z
 sage: R = A.quotient(x^2 + 1).quotient(y^2 + 1).quotient(z^2 + 1)
 sage: R.inject_variables()
 Defining xbarbarbar, ybarbarbar, zbarbarbar
 sage: M =
 
matrix([[1,1,1,1],[xbarbarbar,ybarbarbar,1,1],[0,1,zbarbarbar,1],[xbarbarbar,zbarbarbar,1,1]])
 sage: M.determinant()
 ---------------------------------------------------------------------------
 NotImplementedError                       Traceback (most recent call
 last)

 /tmp/<ipython console> in <module>()

 /opt/sagemath/sage-4.5.3/local/lib/python2.6/site-
 packages/sage/matrix/matrix2.so in sage.matrix.matrix2.Matrix.determinant
 (sage/matrix/matrix2.c:6942)()
    1092         # TODO: Find a reasonable cutoff point.  (This is field
 specific, but
    1093         # seems to be quite large for Q[x].)
 -> 1094         if (R.is_field() and R.is_exact() and algorithm is None)
 or (algorithm == "hessenberg"):
    1095             try:
    1096                 c = self.charpoly('x', algorithm="hessenberg")[0]

 /opt/sagemath/sage-4.5.3/local/lib/python2.6/site-
 packages/sage/rings/quotient_ring.pyc in is_field(self, proof)
     420         """
     421         if proof:
 --> 422             return self.defining_ideal().is_maximal()
     423         else:
     424             try:

 /opt/sagemath/sage-4.5.3/local/lib/python2.6/site-
 packages/sage/rings/ideal.pyc in is_maximal(self)
     559             NotImplementedError
     560         """
 --> 561         raise NotImplementedError
     562
     563     def is_primary(self, P=None):

 NotImplementedError:

 }}}

 A simple (maybe dirty) solution might be to add a `try` at the beginning
 of the method and an `except` that use a basic division-free formula in
 case of error.

 I am not an algebraist, so i prefer not to fix this bug by myself.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10063>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to