| 1 | initial version |
sage: Z = matrix(2,2)
sage: print Z.parent()
Full MatrixSpace of 2 by 2 dense matrices over Integer Ring
What you want is a matrix over the Symbolic Ring
sage: Z = matrix(SR,2,2)
sage: print Z.parent()
sage: Z[0,0] = sqrt(5)
sage: print Z
Alternatively a matrix over a Real Field
sage: Z = matrix(RR,2,2)
sage: print Z.parent()
sage: Z[0,0] = sqrt(5)
sage: print Z
| 2 | No.2 Revision |
sage: Z = matrix(2,2)
sage: print Z.parent()
Output:
Full MatrixSpace of 2 by 2 dense matrices over Integer RingRing
That means your matrix can contain only Integers.
What you want is a matrix over the Symbolic Ring Ring:
sage: Z = matrix(SR,2,2)
sage: print Z.parent()
sage: Z[0,0] = sqrt(5)
sage: print Z
Alternatively a matrix over a Real FieldField:
sage: Z = matrix(RR,2,2)
sage: print Z.parent()
sage: Z[0,0] = sqrt(5)
sage: print Z
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.