In pull request 1015 <https://github.com/sympy/sympy/pull/1015> you can do this with the following code In [1]: A = MatrixSymbol('a', 3, 3)
In [2]: print A.as_explicit() [a(0, 0), a(0, 1), a(0, 2)] [a(1, 0), a(1, 1), a(1, 2)] [a(2, 0), a(2, 1), a(2, 2)] Each of these entries are a unique symbol (actually a function object). You can also just ask for A[1,2] and get a(1, 2) without the as_explicit call and it'll generate it on the fly. In [3]: A[1,2] Out[3]: a(1, 2) Unfortunately this is not the same text as you're looking for. A simpler and probably better solution that works in master is to use a doubly nested list comprehension. I apologize for the horizontal coding. This is effectively just a doubly nested for loop written sideways. In [4]: [[Symbol('a_%d%d'%(i,j)) for j in range(3)] for i in range(3)] Out[4]: [[a₀₀, a₀₁, a₀₂], [a₁₀, a₁₁, a₁₂], [a₂₀, a₂₁, a₂₂]] -Matt On Sun, Feb 5, 2012 at 11:54 AM, Comer <comer.dun...@gmail.com> wrote: > I am working on a project which requires that I create a matrix of > symbols. For discussion purposes say the matrix is 3 x 3. The matrix > is to contain 9 unique symbols and my preferred format is the usual > matrix format: > > a11, ..., a33 = symbols('a_11 ....a_33') > > Now obviously I could easily just type in the above for all nine > symbols. However, what I want to see how to do is to create a 3 x 3 > array as above but do it in a couple of for loops. I looked at the > symbols() function but it only seems to work with a linear sequence of > symbol names such as x0, x1, x2, .... xN. But I can not see how to do > the same for a 2d array of symbol names such as x00, x01, x02, ... . > It would be convenient in my project to be able to quickly create the > 2d array of symbols directly by calling symbols(). It would save some > typing. > > Can someone please let me know how best to do this? > > Thanks. > > Comer > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to sympy@googlegroups.com. > To unsubscribe from this group, send email to > sympy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.