Ticket #3249 (closed defect: duplicate)

Opened 5 years ago

Last modified 5 years ago

a bug in computing the inverse of the matrix

Reported by: pdenapo Owned by: was
Priority: major Milestone: sage-3.0.3
Component: linear algebra Keywords:
Cc: Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

I was doing the following, when testing the jordan_form method...

sage: A=Matrix(ComplexField(200),[[1,-2],[2,-1]])
sage: jordan=A.jordan_form(transformation=True,subdivide=False)
sage: P=jordan[1]

(P is now the transformation matrix, jordan[1] is the jordan canonical form)

sage: det(P)
1.7320508075688772935274463415058723669428052538103806280558*I

so clearly the matrix P has non zero determinant, as it should, however...

sage: P.inverse()
---------------------------------------------------------------------------
<type 'exceptions.ZeroDivisionError'>     Traceback (most recent call last)

/media/hda2/pablo.new_home/sage/sage-2.10.2/<ipython console> in <module>()

/media/hda2/pablo.new_home/sage/sage-2.10.2/matrix2.pyx in sage.matrix.matrix2.Matrix.inverse (sage/matrix/matrix2.c:19571)()

/media/hda2/pablo.new_home/sage/sage-2.10.2/matrix0.pyx in sage.matrix.matrix0.Matrix.__invert__ (sage/matrix/matrix0.c:12213)()

<type 'exceptions.ZeroDivisionError'>: self is not invertible

The most strange thing is that things depends strongly on the precision used for the complex field...the same computation using 20 bits of precision gives

sage:  A=Matrix(ComplexField(20),[[1,-2],[2,-1]])
sage: jordan=B.jordan_form(transformation=True,subdivide=False)
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'>        Traceback (most recent call last)

/media/hda2/pablo.new_home/sage/sage-2.10.2/<ipython console> in <module>()

/media/hda2/pablo.new_home/sage/sage-2.10.2/matrix2.pyx in sage.matrix.matrix2.Matrix.jordan_form (sage/matrix/matrix2.c:20606)()

<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'is_exact'

Change History

comment:1 Changed 5 years ago by mabshoff

  • Milestone set to sage-3.0.2

comment:2 Changed 5 years ago by pdenapo

Note that there are two different problems here.

The first one seems to be similar to bugs #1132,#3166

comment:3 Changed 5 years ago by pdenapo

See also #2256 (same problem)

comment:4 Changed 5 years ago by pdenapo

  • Status changed from new to closed
  • Resolution set to duplicate

The second issue reported here is fixed by my patch in #3316

Note: See TracTickets for help on using tickets.