A good start would be the simplification section of the tutorial
http://docs.sympy.org/latest/tutorial/index.html.

In this case, collect(expr1, [x11, x12, x13]) does what you want.
factor() only does complete factorizations (into products of terms).
This is explained in more depth in the tutorial.

Aaron Meurer

On Tue, Nov 3, 2015 at 2:47 PM, Hugh <[email protected]> wrote:
> import sympy
> sympy.init_session()
>
>
> x11, x12, x13, x21, x22, x23, x31, x32, x33 = symbols('x_1:4(1:4)')
>
> A = Matrix(3,3,symbols('x_1:4(1:4)'))
> expr1 = A.det()
>
> expr2 = x11*(x22*x33 - x23*x32) - x12*(x21*x33 -x23*x31) + x13*(x21*x32 -
> x22*x31)
>
> # How to get expr2 from expr1?
>
> I would like to use sympy to rewrite expressions just like how people would
> commonly do when writing proofs or doing homework. What are the
> documentation that I must read so that I can be proficient at this?
>
> I've read the tutorial and some of the modules in the module reference but
> feel that I have just barely touched the surface of sympy's capabilities.
> For example, in the above code snippet, I don't know how to manipulate expr1
> to get expr2. I thought expr1.factor() would work but it didn't.
>
> Please advise.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/9cbb1995-3987-44f1-8c72-6de11e6a4013%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2BPwK2EWr3_vt_9cNSv7afDyzWrZ-5hEF_cR05qFZ4S6g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to