Ticket #10454 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

Add .is_singular method to matrices

Reported by: rbeezer Owned by: jason, was
Priority: minor Milestone: sage-4.6.2
Component: linear algebra Keywords:
Cc: Work issues:
Report Upstream: N/A Reviewers: Robert Bradshaw
Authors: Rob Beezer Merged in: sage-4.6.2.alpha3
Dependencies: Stopgaps:

Description (last modified by jason) (diff)

Some approaches to teaching linear algebra define nonsingular matrices before broaching matrix invertibility. This will just add is_singular, with some changes to the associated documentation. thus making it a bit easier for Sage usage to follow one possible development of the topic.

Attachments

trac_10454-matrix-is-singular.patch Download (2.8 KB) - added by rbeezer 3 years ago.

Change History

comment:1 follow-up: ↓ 2 Changed 3 years ago by jason

Do you think it might be better to add the positive phrasing, m.is_singular(), rather than the negative nonsingular version?

comment:2 in reply to: ↑ 1 Changed 3 years ago by rbeezer

Replying to jason:

Do you think it might be better to add the positive phrasing, m.is_singular(), rather than the negative nonsingular version?

I had that thought. It would then no longer be an alias, which means (a) the documentation could be separate from invertibility, and (b) it would only need to be done once (is_invertible is defined twice). Does it work for users/students? I like to define nonsingular, but there is no real good reason for that, I guess. What's your preference?

comment:3 follow-up: ↓ 4 Changed 3 years ago by jason

My advisor (who was a very good writer) taught me that when you are talking about matrices with determinant zero, and that is the focus, you should use "singular", and when you are talking about matrices with nonzero determinant, and that is the focus, you should use "invertible". This was to avoid confusing the reader with too many negatives. So I think having m.is_singular() and m.is_invertible() is a nice combination. It's easy to say "to check if a matrix is nonsingular, see if m.is_singular() is false".

Personally, I use "invertible" when talking about invertible matrices, so I guess it isn't that huge of a deal. I just thought things could be clearer by not putting a negatively-phrased is_* method in there.

comment:4 in reply to: ↑ 3 Changed 3 years ago by rbeezer

Replying to jason:

Sounds very good to me. I'll likely take this approach.

comment:5 Changed 3 years ago by jason

I guess the other philosophy at play here is that typically, is_* functions determine what an object *is*, not what it is not. There probably are exceptions, though...

Changed 3 years ago by rbeezer

comment:6 Changed 3 years ago by rbeezer

  • Status changed from new to needs_review

It is never what it seems. Over a commutative ring, the right thing to do is to define is_singular() to be the condition that the matrix has a zero determinant.

So this needs to be a new method, it is better stated as the positive version, and it is more than just a convenience.

comment:7 Changed 3 years ago by jason

  • Summary changed from Add to matrices .is_nonsingular() as an alias for .is_invertible() to Add .is_singular method to matrices
  • Description modified (diff)
  • Authors set to Rob Beezer

comment:8 Changed 3 years ago by robertwb

  • Status changed from needs_review to positive_review

Looks good to me.

comment:9 Changed 3 years ago by rbeezer

  • Reviewers set to Robert Bradshaw

comment:10 Changed 2 years ago by jdemeyer

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-4.6.2.alpha3
Note: See TracTickets for help on using tickets.