Hello,

On Tue, Apr 5, 2011 at 12:00 AM, pong <wypon...@gmail.com> 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]));

A bit cleaner is:

sage: B = matrix(2,2,lambda i,j: i-j); B
[ 0 -1]
[ 1  0]
sage: B.apply_map(abs)
[0 1]
[1 0]

--Mike

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to