This can be done in maxima:

genmatrix(lambda([i,j],i-j),6,6);

for example.  But is there an easy Sage way of doing this?  If I enter

sage: M=maxima('genmatrix(lambda([i,j],i-j),6,6)')

then I obtain a Maxima matrix, which then has to turned into a Sage
matrix (I don't know how to do this either).  Clearly I could:

sage: M=matrix(ZZ,6,6)
sage: for i in range(6):
....:     for j in range(6):
....:         M[i,j]=i-j

but that seems a bit longwinded.  Is there an easy straightforward
way?

Thanks,
Alasdair

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