Hello. I am having to replace certain functions in expressions contained in a matrix (which I derived from using jacobian) but I find that I cannot do replace on a Matrix -- I have to do replace-assignment on each individual item in the Matrix:
>>> from sympy import symbols,Function,Matrix >>> F,G=symbols('F,G',cls=Function) >>> M=Matrix(2,2, lambda i,j: F(i+j)) >>> M [F(0), F(1)] [F(1), F(2)] >>> M.replace(F,G) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3/dist-packages/sympy/matrices/matrices.py", line 3010, in __getattr__ raise AttributeError("Matrix has no attribute %s." % attr) AttributeError: Matrix has no attribute replace. >>> for i in range(len(M)):M[i]=M[i].replace(F,G) ... >>> M [G(0), G(1)] [G(1), G(2)] This additional trouble is unnecessary IMHO. Is there a reason why Matrix cannot directly support replace when it can support subs (as seen in even the tutorial)? -- Shriramana Sharma -- 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.