| 1 | initial version |
Is this what you want?
n=2
m=3
x = [f'x_{i+1}' for i in range(n)]
y = [f'y_{i+1}' for i in range(m)]
xy = [xi+yj for xi in x for yj in y] # x first, then y
yx = [yj+xi for xi in x for yj in y] # y first, then x
for t in Tuples((-1..1),len(xy)):
r = ' '.join([('+' if s>0 else '-')+mon for s,mon in zip(t,xy) if s])
print(r)
for t in Tuples((-1..1),len(yx)):
r = ' '.join([('+' if s>0 else '-')+mon for s,mon in zip(t,yx) if s])
print(r)
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.