Ask Your Question

Revision history [back]

I'm not sure what you've tried, but you need to convert the vectors to matrices:

sage: A = matrix([[1, 2, 3, 4],[4, 3, 2, 1],[2, 4, 3, 1]])
sage: II = identity_matrix(3)
sage: b = vector([10, 20, 30])
sage: c = vector([1, -2, 3, -1])
sage: z = zero_vector(3) # use a vector with 3 entries, for consistency with the size of II

sage: m = block_matrix(2, [[A, II, matrix(b).transpose()], [matrix(c), matrix(z), zero_matrix(1, 1)]])
sage: m
[ 1  2  3  4| 1  0  0|10]
[ 4  3  2  1| 0  1  0|20]
[ 2  4  3  1| 0  0  1|30]
[-----------+--------+--]
[ 1 -2  3 -1| 0  0  0| 0]

Now you can modify the subdivisions, if you don't like the current ones. For example:

sage: m.subdivisions()  # current subdivision
([3], [4, 7])
sage: m.subdivide([3], [7])
sage: m
[ 1  2  3  4  1  0  0|10]
[ 4  3  2  1  0  1  0|20]
[ 2  4  3  1  0  0  1|30]
[--------------------+--]
[ 1 -2  3 -1  0  0  0| 0]