Updates:
Status: Fixed
Comment #5 on issue 2060 by smi...@gmail.com: Infinite recursion on subs
http://code.google.com/p/sympy/issues/detail?id=2060
ok, 2039 is in but the syntax is now different that when this issues was
posted. Nonetheless, the following appears to work:
h[6] >>> from sympy.tensor import *
h[7] >>> [w for w in dir() if 'Index' in w]
['Indexed', 'IndexedBase']
h[8] >>> var('A B C D E')
(A, B, C, D, E)
h[9] >>> i,j,n = symbols('i j n', integer = True)
h[9] >>> i, j = map(Idx, ['i', 'j'])
h[9] >>> expr = Eq( A*Indexed('M',i,j)**n +
B*Indexed('M',i+1,j)**(n+1), C*Index
ed('M',i,j+1)**n + D*Indexed('M',i,j)**(n+1) +
E*Indexed('M',i+1,j)**(n+1) )
h[9] >>> expr1 = expr.lhs - expr.rhs
h[9] >>> from sympy.core.symbol import Dummy
h[9] >>> u=Dummy('u')
h[9] >>> IE_atoms = expr1.atoms(Indexed)
h[9] >>> collect(expr1.subs([(a**(n+1), u*a**(n+1)) for a in
IE_atoms]), u)
_u*(B*M[1 + i, j]**(1 + n) - D*M[i, j]**(1 + n) - E*M[1 + i, j]**(1 +
n)) + A*M[
i, j]**n - C*M[i, 1 + j]**n
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.