Hi Simon,

2014-12-04 9:54 UTC+01:00, Simon King <simon.k...@uni-jena.de>:
(posted on sage-support)
> 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.

Nope as in scipy matrices are considered as array (e.g. exp(m) applies
exp to all of the entries and is not the exponential of the matrix).
And the reason for that is numerical analysis.

I agree that Sage point of view on matrices is rather different.

>> 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.

All right, but in that case I would prefer that there is no __abs__ at
all. What about deprecating its usage and later on return a ValueError
? I found it very misleading, and I am not the only one.

> 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).

This is completely crazy!

Vincent

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to