Hi Vincent, On 2014-12-04, Vincent Delecroix <20100.delecr...@gmail.com> wrote: > sage: M = matrix(RR, [[-1]]) > sage: abs(M) > -1.00000000000000 > > So the problem is with abs(M). The reason is that abs(M) is calling > the method M.__abs__(). The latter one is just a shortcut for the > determinant. I really do not understand why and it looks like a bug to > me.
No, see discussion on sage-devel. > For comparison, in scipy the same function just return the matrix > where each entry is replace with its absolute value. Which is much > more natural... ... which *is* a bug, IMHO. > I opened a ticket for that: > http://trac.sagemath.org/ticket/17443 > It should be corrected in the next stable release. Better not. Expecting abs(M) to return the matrix formed by the absolute values of matrix M is a misuse. Generally, matrices in Sage are not considered to be arrays. Hence, element-wise operations generally don't seem natural. The standard notation for abs(x) is |x|, and if M is a matrix then it is relatively common to write |M| for its determinant, which justifies that use of abs(M) for that purpose (although M.det() would be clearer). Best regards, Simon -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.