On Monday, April 4, 2011 3:00:20 PM UTC-7, pong wrote:
>
> By that I simply mean a function that on input a real matrix M returns
> the matrix N such that n[i][j] = abs(m[i][j]).
>
> This can be achieve by something like:
>
> n = len(M.rows()); m =len(M.columns()); N = matrix(n,m,lambda i,j:
> abs(M[i][j]));
>
> However, for a square matrix M, M.abs() returns something which wasn't
> what one expected:
>
> B = matrix(2,2,lambda i,j: i-j); B; B.abs()
>
> returns
>
> [ 0 -1]
> [ 1 0]
>
> and 1
>
> Is it a bug? Or something that I missed?
>
For matrices, B.abs() returns the determinant. If you type "B.abs?", you'll
see a message like
Return the absolute value of self. (This just calls the __abs__
method, so it is equivalent to the abs() built-in function.)
Then if you type "B.__abs__?", you'll see
Synonym for self.determinant(...).
--
John
--
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-support
URL: http://www.sagemath.org