Wow! Perfect job! Thank you very much.

понедельник, 4 апреля 2016 г., 19:28:51 UTC+3 пользователь Aaron Meurer 
написал:
>
> You can use itertools.product: 
>
> import itertools 
>
> parts = (x, y, z, t) 
>
> N = len(parts) 
> P = itertools.product(*[(-1, 1) for i in range(N-1)]) 
> eqs = [parts[0] + sum(i*p for i, p in zip(a, parts[1:])) for a in P] 
>
> for this example, it gives 
>
> In [49]: eqs 
> Out[49]: [-t + x - y - z, t + x - y - z, -t + x - y + z, t + x - y + 
> z, -t + x + y - z, t + x + y - z, -t + x + y + z, t + x + y + z] 
>
> Aaron Meurer 
>

-- 
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 https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/e939f169-407b-4555-ad36-0b267fee0096%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to