1 | initial version |

I'm not sure if there's a way to define a symbolic matrix the way you describe above. However, one could create a matrix populated only by distinct symbolic variables. Here's a quick, though supposedly not quickest, way to do so:

```
sage: N = 3
sage: s = join(['a_%d%d' %(i,j) for (i,j) in CartesianProduct(range(N),range(N))])
sage: a = var(s)
sage: A = matrix(SR,N,N,a)
sage: print A[1,2]
a_12
```

The second line just creates a string with the variable names $a_{ij}$ for $i,j \in \mathbb{Z}_n$ and the third parses the string and creates a list of the symbolic variables. I can now create another matrix $B$ and multiply them:

```
sage: s = join(['b_%d%d' %(i,j) for (i,j) in CartesianProduct(range(N),range(N))])
sage: b = var(s)
sage: B = matrix(SR,N,N,b)
sage: C = A*B
sage: print C[1,2]
a_10*b_02 + a_11*b_12 + a_12*b_22
```

It's not completely automatic but I hope it helps.

2 | No.2 Revision |

I'm not sure if there's a way to define a symbolic matrix the way you describe above. However, one could create a matrix populated only by distinct symbolic variables. Here's a quick, though supposedly not quickest, way to do so:

```
sage: N = 3
sage: s = join(['a_%d%d' %(i,j) for (i,j) in CartesianProduct(range(N),range(N))])
sage: a = var(s)
sage: A = matrix(SR,N,N,a)
sage: print A[1,2]
a_12
```

The second line just creates a string with the variable names $a_{ij}$ for $i,j \in \mathbb{Z}_n$ and the third parses the string and creates a list of the symbolic variables. I can now create another matrix $B$ and multiply them:

```
sage: s = join(['b_%d%d' %(i,j) for (i,j) in CartesianProduct(range(N),range(N))])
sage: b = var(s)
sage: B = matrix(SR,N,N,b)
sage: C = A*B
sage: print C[1,2]
a_10*b_02 + a_11*b_12 + a_12*b_22
```

It's not completely ~~automatic ~~automatic, and perhaps not pretty, but I hope it helps.

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.