#2256: [with patch, needs review] matrix inverse over CC raises
ZeroDivisionError
----------------------------+-----------------------------------------------
Reporter: ncalexan | Owner: was
Type: defect | Status: new
Priority: major | Milestone: sage-4.0.2
Component: linear algebra | Keywords: matrix inverse CC complex
Reviewer: | Author:
Merged: |
----------------------------+-----------------------------------------------
Changes (by craigcitro):
* cc: jason, cwitty, robertwb (added)
Comment:
I'm attaching a patch which doesn't '''completely''' fix this, but makes
it better -- I think.
First, a brief description of the problem: the code creates an augmented
matrix, puts it in echelon form, and asks if the lower right entry of the
left half is equal to 1. This is correct over an exact field, but over an
inexact ring like `CC`, this causes trouble.
Now, if we're working over a base ring which we know is a field (or at
least models a field), then we know the lower right entry of the matrix
must be either 1 or 0. So rather than test to see if something equals 1, I
simply test that the lower right entry is '''not''' 0.
A better solution would be to ask that the determinant is nonzero --
unfortunately, our determinant over general inexact fields is a joke, and
can't even deal with a `10x10` example, so that's a no-go.
Comments:
This still isn't perfect -- it's easy enough to imagine cases where
numerical instability causes trouble. Note that the current behavior is
basically always wrong (since it almost always claims the matrix isn't
invertible when it is), and it's also pretty confusing to newcomers. The
new code has the disadvantage that it can now offer to return an inverse
for non-invertible matrices, based on numerical issues. However, I think
that to someone who's used matrices over inexact rings before in their
life, this isn't so surprising -- it's just the way it goes with
approximations.
I don't know what the "right" solution is -- we should probably ask
someone who studies numerical analysis.
I'm adding `jason`, `cwitty`, and `robertwb` to the ticket, because
they're all likely to have interesting commentary and/or review the patch.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/2256#comment:3>
Sage <http://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
-~----------~----~----~----~------~----~------~--~---