[sympy] What does the second argument in apart() do?

2015-06-15 Thread Hugh
Hello, There is this block of code in the tutorial : >>> l = [] >>> frac = apart(frac, a0) >>> frac a₂⋅a₃⋅a₄ + a₂ + a₄ a₀ + ─── a₁⋅a₂⋅a₃⋅a₄ + a₁⋅a₂ + a₁⋅a₄ + a₃⋅a₄ + 1 >>> l.appen

[sympy] Re: What does the second argument in apart() do?

2015-06-26 Thread Hugh
> - ─ + ─ > x + 2 x + 1 > > > > On Monday, 15 June 2015 22:44:40 UTC+5:30, Hugh wrote: >> >> Hello, >> >> >> There is this block of code in the tutorial >> <http://docs.sympy.org/latest/tutorial/simplificati

[sympy] What to read to be good at rewriting expressions?

2015-11-03 Thread Hugh
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 sy

[sympy] Re: What to read to be good at rewriting expressions?

2015-11-03 Thread Hugh
) + b, exact = True).collect(x11).collect(x13) # Now, expr4 is in the same form as expr2 But is this the recommended approach? On Wednesday, 4 November 2015 04:47:20 UTC+8, Hugh wrote: > > import sympy > sympy.init_session() > > > x11, x12, x13, x21, x22, x23, x31, x32, x33 = sy

Re: [sympy] What to read to be good at rewriting expressions?

2015-11-04 Thread Hugh
atest/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

Re: [sympy] What to read to be good at rewriting expressions?

2015-11-04 Thread Hugh
Thanks Mateusz for sharing the code. I thought it was a clever solution to solve my problem. On Wednesday, 4 November 2015 07:35:45 UTC+8, Mateusz Paprocki wrote: > > Hi, > > On 3 November 2015 at 21:47, Hugh <714...@gmail.com > wrote: > > import sympy

Re: [sympy] What to read to be good at rewriting expressions?

2015-11-04 Thread Hugh
Okay. Thanks again for your help. On Thursday, 5 November 2015 00:36:46 UTC+8, Aaron Meurer wrote: > > Yes, for now, Mul automatically distributes constants, so you have to > use evaluate=False to factor out something like -1. > > Aaron Meurer > > On Wed, Nov 4, 2015