Short answer, you can't yet. Current issues are as follows MatrixExprs doesn't yet support fancy indexing so you'll have to be explicit and use p[i, j] and not p[i] --- this could be fixed by improving the `__getitem__` method in MatrixExpr
p[i, j] yields a Symbol with the name "%s_ij"%p.name . This object has no connection back to the original p. --- this could be fixed by creating some sort of Element(Symbol) class. On Thu, Nov 1, 2012 at 1:36 PM, Stefan Krastanov <[email protected] > wrote: > This is unrelated to the previous question about matrix expressions. > > How can I do the following > > > >>> p = MatrixSymbol('p', 2, 1) > >>> p[0].subs(p, Matrix([5, 6])) > 5 > >>> p[x].subs(p, Matrix([5, 6])).subs(x, 0) > 5 > > The first one is more important for me than the second one. > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
