1 | initial version |
To get some documentation on how to create custom matrices, you can do:
sage: matrix?
You will
For example, if you want that the entry [i,j]
has value i*j^2
(say), you can do:
sage: m = 4 ; n = 5
sage: matrix(QQ, m, n, lambda i, j: i*j^2)
[ 0 0 0 0 0]
[ 0 1 4 9 16]
[ 0 2 8 18 32]
[ 0 3 12 27 48]
2 | No.2 Revision |
To get some documentation on how to create custom matrices, you can do:
sage: matrix?
You will see some examples using a function taking a pair (i,j)
and returning some f(i,j)
to be placed in the entry [i,j]
of the constructed matrix.
For example, if you want that the entry [i,j]
has value i*j^2
(say), you can do:
sage: m = 4 ; n = 5
sage: matrix(QQ, m, n, lambda i, j: i*j^2)
[ 0 0 0 0 0]
[ 0 1 4 9 16]
[ 0 2 8 18 32]
[ 0 3 12 27 48]