If you want to see the debug information yourself you'll have to change lines in matadd and matmul like the following
canonicalize = canon(*map(condition_matadd, rules)) canonicalize = canon(*map(condition_matadd, map(debug, rules))) On Sat, Oct 6, 2012 at 7:52 AM, Matthew Rocklin <[email protected]> wrote: > So I have a basic version up right now. I added in a quick "debug" > strategy that prints out before and after for any change. You can track > what happens as the system simplifies the expression. I don't claim that > SymPy's eventual solution should look like what I have now. I do make the > claim that I have now is neat :) > > Code is up here > https://github.com/mrocklin/sympy/tree/rr/sympy/rr > https://github.com/mrocklin/sympy/tree/rr/sympy/matrices/expressions > > MatAdd and MatMul have been weined off of Add and Mul flatten/simplify and > had the logic replaced with rules. > > You'll see some rules that don't have any apparent effect. I'll explain > them briefly here > unpack :: Type(single-arg) -> single-> arg example -- MatMul(X) -> X > flatten :: Type(a, b, Type(c)) -> Type(a, b, c) > The others should be obvious. > > > In [1]: X = MatrixSymbol('X', n, n) > > In [2]: Y = MatrixSymbol('Y', n, n) > > In [3]: Inverse(X)*X*Y + X + Y + X > Rule: xxinv > In: X^-1*X > Out: I > > Rule: unpack > In: I > Out: I > > Rule: remove_ids > In: I*Y > Out: Y > > Rule: unpack > In: Y > Out: Y > > Rule: flatten > In: Y + X + Y > Out: X + Y + Y > > Rule: factor_in_front > In: Y*2 > Out: 2*Y > > Rule: glom_MatAdd > In: X + Y + Y > Out: X + 2*Y > > Rule: unpack > In: Y > Out: Y > > Rule: factor_in_front > In: Y*2 > Out: 2*Y > > Rule: flatten > In: X + X + 2*Y > Out: X + X + 2*Y > > Rule: unpack > In: Y > Out: Y > > Rule: factor_in_front > In: X*2 > Out: 2*X > > Rule: factor_in_front > In: Y*2 > Out: 2*Y > > Rule: glom_MatAdd > In: X + X + 2*Y > Out: 2*X + 2*Y > > Rule: unpack > In: X > Out: X > > Rule: unpack > In: Y > Out: Y > > Rule: factor_in_front > In: X*2 > Out: 2*X > > Rule: factor_in_front > In: Y*2 > Out: 2*Y > > Out[3]: 2⋅X + 2⋅Y > > -- 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.
