[sage-support] Entering matrices whose elements are functions of row/column indices?

2010-03-13 Thread Alasdair
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

Re: [sage-support] Entering matrices whose elements are functions of row/column indices?

2010-03-13 Thread David Joyner
Here is another way: sage: coeffs = [[i^2-j for j in range(6)] for i in range(6)] sage: matrix(coeffs) [ 0 -1 -2 -3 -4 -5] [ 1 0 -1 -2 -3 -4] [ 4 3 2 1 0 -1] [ 9 8 7 6 5 4] [16 15 14 13 12 11] [25 24 23 22 21 20] On Sat, Mar 13, 2010 at 7:58 AM, Alasdair amc...@gmail.com wrote: This