Generic matrix
71 ●4 ●11
Does Sage provide by default a kind of generic matrix ? Maple does, for instance
matrix(2, symbol='x')
a 2x2 matrix whose (i,j)-entry is the symbolic coefficient x_{i,j}
I can emulate a such matrix in Sage but this not very handy, for instance :
xij=var(' '.join(['x'+str(i)+'_'+str(j) for i in range(n) for j in range(n)]))
M=Matrix(SR, n, xij)
outputting:
[x0_0 x0_1 x0_2 x0_3]
Another suggestion ?
Looks like this is something that you have to work around as best I can tell. See the following posts: http://ask.sagemath.org/question/152/symbolic-linear-algebra and http://ask.sagemath.org/question/505/symbolic-matrices
calc314 ( 2013-06-03 04:25:31 -0500 )edit
Though perhaps something like this could be *added* to Sage as a shortcut. We do need to decide once and for all how to do indexed variables... but this could be solved at the same time.
According to the comments, I'm afraid that Sage doesn't offer any builtin feature allowing working with generic matrices without Python programming skills. From a pedagogical viewpoint this is unfortunate because generic matrices enable the learner to illustrate (or solve) easily some basic linear algebra questions such as Cayley-Hamilton theorem in low dimensions.
candide ( 2013-06-03 06:57:07 -0500 )edit
In maple, there is a built-in data-type for this purpose, (that is, for being an element of a symbolic matrix,) called "indexed", and it is a rather low-level thing. I'm new in python/sage, so I don't know whether it's a trouble to implement this. But that would be very very useful. Until that point, tcfisher's answer in http://ask.sagemath.org/question/152/symbolic-linear-algebra offers a workaround.
Szilard SZALAY ( 2013-09-17 04:11:42 -0500 )edit
Last updated: Jun 03 '13
Deriving from Matrix class
Matrix Multiplication
Symbolic matrices
how to get the diagonal of a matrix?
Yet another linear combination
Deepcopy of a Matrix SageMath
strings and other objects in matrices
How to make 1:1 matrix plots?
Converting kernel to matrix
Limit of a matrix power