On Mon, 26 Nov 2012 at 11:34AM -0800, Ken Levasseur wrote: > I'm writing up some notes on matrices for my students and ran into this > inconsistency (I think). I start by creating a matrix and augment its > transpose, just to have a non-square matrix: > > A=Matrix([[3,1],[-1,2]]) > B=A.transpose() > C=A.augment(B) > > Now if I ask for the echelon form of C, I get this result, which isn't > fully reduced: > > C.echelon_form() > [1 5 5 3 ] > [0 7 6 5 ] > > > That's fine because > C.parent() > Full MarixSpace of 2 by 4 dense matrices over Integer Ring > > But I would expect that the inverse of A wouldn't be computed under this > condition, but > > A.inverse() > [ 2/7 -1/7 ] > [1/7 3/7 ] > > Is there a logical reason why this happens?
Good observation. I think the answer is that inverse() always bumps up to the fraction field if the parent isn't a field. So when you ask for the inverse, you are implicitly asking to change the parent if necessary; echelon_form() doesn't include that implicit request. I'm not sure if that's a "logical reason", but most people seem to like it. Should we have a "strict inverse" that throws a ValueError -- or ZeroDivisionError -- when the parent isn't a field? (That's not rhetorical or sarcastic, I really wonder if anyone thinks that's a good idea.) Dan -- --- Dan Drake ----- http://math.pugetsound.edu/~ddrake -------
signature.asc
Description: Digital signature
