1 | initial version |
Starting from an already defined matrix,
use its change_ring
method to produce
a matrix over a different ring.
Suppose we have defined our initial matrix:
sage: A = matrix([[25*x^3 + 50*x^2 + 1], [18*x + 11]])
sage: A
[25*x^3 + 50*x^2 + 1]
[ 18*x + 11]
Consider it over the polynomial ring over integers modulo two:
sage: B = A.change_ring(GF(2)['x'])
sage: B
[x^3 + 1]
[ 1]
If needed, move entries from there to polynomials over the integers:
sage: C = B.change_ring(ZZ['x'])
sage: C
[x^3 + 1]
[ 1]
One of them behaves modulo two, the other does not:
sage: 3 * B
[x^3 + 1]
[ 1]
sage: 3 * C
[3*x^3 + 3]
[ 3]