Re: [sympy] Simplification with dot products

2017-02-27 Thread Aaron Meurer
It's possible you can get decent results just by sorting the dot products before converting to multiplication, like (* => *). I'm more worried about the order in the dot products themselves. You could sort within the dot products themselves, like => , but you might still run into problems, e.g.,

Re: [sympy] Simplification with dot products

2017-02-27 Thread Nico Schlömer
Thanks for the suggestions. The noncommutative option is probably too strict since ` != ` then. Or can I make only some multiplications noncommutative? > You might need to write a naive factor Is there any documentation on this? Cheers, Nico On Monday, February 27, 2017 at 9:44:45 PM UTC+1,

Re: [sympy] Simplification with dot products

2017-02-27 Thread Aaron Meurer
Actually, I think you can just convert the symbols to multiplications, but set them all as commutative=False so that they don't get rearranged. Then you can apply factor() (which I believe basically does the above algorithm for noncommutatives), and to convert back to dot products, convert each mul

Re: [sympy] Simplification with dot products

2017-02-27 Thread Aaron Meurer
The function that does the simplification you want is factor(): In [22]: var('a b c d') Out[22]: (a, b, c, d) In [23]: factor(a*c + b*d - a*d - b*c) Out[23]: (a - b)⋅(c - d) However, I'm not sure how to apply it here. You can't just convert your dot products to multiplications because it isn't t

Re: [sympy] Simplification with dot products

2017-02-27 Thread Nico Schlömer
Thanks for the reply. > I assume e0, e1, and e2 are arbitrary vectors. Indeed, they can be anything. (I'm looking at 3 dimensions here but given the fact that everything is a dot product I assume that doesn't play much of a role.) Cheers, Nico On Monday, February 27, 2017 at 6:37:59 PM UTC

Re: [sympy] Simplification with dot products

2017-02-27 Thread Alan Bromborsky
How the expression zeta obtained. Do input the expression you show or is it obtained by vector algebraic operations on vector expressions. I assume e0, e1, and e2 are arbitrary vectors. On Mon, Feb 27, 2017 at 12:04 PM, Nico Schlömer wrote: > I have a somewhat large expression in inner product

[sympy] Simplification with dot products

2017-02-27 Thread Nico Schlömer
I have a somewhat large expression in inner products, ``` zeta = ( - * * + 4 * * * + ( + * + * + * ) * ( + + + - - -